summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYasuo Ohgaki <yohgaki@php.net>2002-09-04 05:17:16 +0000
committerYasuo Ohgaki <yohgaki@php.net>2002-09-04 05:17:16 +0000
commit38ef35e5b0e36ca012cf675175067e4e582e229a (patch)
treeec8a280f2e3e8be51f29c67e99eb05599fe0759e
parent610b2b76d74ae760d19580695464581c49e5fe19 (diff)
downloadphp-git-38ef35e5b0e36ca012cf675175067e4e582e229a.tar.gz
Fixed undefiend referece at build time.
Fixed transilit test script. Make fixes available on Windows. Patch by Yoshimori Koizumi<readjust@deneb.freemail.ne.jp>
-rw-r--r--ext/iconv/config.m46
-rw-r--r--ext/iconv/iconv.c32
-rw-r--r--ext/iconv/iconv.dsp2
-rw-r--r--ext/iconv/php_iconv.h3
-rw-r--r--ext/iconv/tests/translit.phpt2
5 files changed, 23 insertions, 22 deletions
diff --git a/ext/iconv/config.m4 b/ext/iconv/config.m4
index 063937fa93..d075046ecd 100644
--- a/ext/iconv/config.m4
+++ b/ext/iconv/config.m4
@@ -38,12 +38,14 @@ int main() {
}
],[
AC_MSG_RESULT(yes)
- AC_DEFINE(ICONV_SUPPORTS_ERRNO,1,[Whether iconv supports error no or not])
+ PHP_DEFINE([ICONV_SUPPORTS_ERRNO],1)
+ AC_DEFINE(ICONV_SUPPORTS_ERRNO,1,[Whether iconv supports error no or not])
],[
+ PHP_DEFINE([ICONV_SUPPORTS_ERRNO],0)
+ AC_DEFINE(ICONV_SUPPORTS_ERRNO,0,[Whether iconv supports error no or not])
AC_MSG_RESULT(no)
])
- AC_DEFINE(HAVE_ICONV,1,[Whether to build ICONV support or not])
PHP_NEW_EXTENSION(iconv, iconv.c, $ext_shared)
PHP_SUBST(ICONV_SHARED_LIBADD)
], [
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 8252aa0844..ca100c78e3 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -24,8 +24,17 @@
#endif
#include "php.h"
+#include "php_globals.h"
+#include "ext/standard/info.h"
+#include "main/php_output.h"
+#include "SAPI.h"
+#include "php_ini.h"
-#if HAVE_ICONV
+#include <errno.h>
+
+#include "php_iconv.h"
+
+#ifdef HAVE_ICONV
#ifdef HAVE_GICONV_H
#include <giconv.h>
@@ -33,17 +42,7 @@
#include <iconv.h>
#endif
-#include <errno.h>
-
-#include "php_globals.h"
-#include "php_iconv.h"
-#include "ext/standard/info.h"
-#include "main/php_output.h"
-#include "SAPI.h"
-#include "php_ini.h"
-
-
-#if HAVE_LIBICONV
+#ifdef HAVE_LIBICONV
#define LIBICONV_PLUG
#define icv_open(a, b) libiconv_open(a, b)
#define icv_close(a) libiconv_close(a)
@@ -51,10 +50,9 @@
#else
#define icv_open(a, b) iconv_open(a, b)
#define icv_close(a) iconv_close(a)
-#define icv(a, b, c, d, e) iconv(a, b, c, d, e)
+#define icv(a, b, c, d, e) iconv(a, (char **) b, c, d, e)
#endif
-
/* {{{ iconv_functions[]
*/
function_entry iconv_functions[] = {
@@ -141,7 +139,7 @@ static int php_iconv_string(const char *in_p, size_t in_len,
char **out, size_t *out_len,
const char *in_charset, const char *out_charset, int *err TSRMLS_DC)
{
-#if !defined(ICONV_SUPPORTS_ERRNO)
+#if ICONV_SUPPORTS_ERRNO
unsigned int in_size, out_size, out_left;
char *out_buffer, *out_p;
iconv_t cd;
@@ -175,7 +173,7 @@ static int php_iconv_string(const char *in_p, size_t in_len,
return FAILURE;
}
- result = icv(cd, (char **) &in_p, &in_size, (char **)
+ result = icv(cd, (const char **) &in_p, &in_size, (char **)
&out_p, &out_left);
if (result == (size_t)(-1)) {
@@ -222,7 +220,7 @@ static int php_iconv_string(const char *in_p, size_t in_len,
out_p = out_buf;
while(in_left > 0) {
- result = icv(cd, (const char **)&in_p, &in_left, (char **) &out_p, &out_left);
+ result = icv(cd, (const char **) &in_p, &in_left, (char **) &out_p, &out_left);
out_size = bsz - out_left;
if( result == (size_t)(-1) ) {
if( errno == E2BIG && in_left > 0 ) {
diff --git a/ext/iconv/iconv.dsp b/ext/iconv/iconv.dsp
index 3ba74f8497..946fa2dfb9 100644
--- a/ext/iconv/iconv.dsp
+++ b/ext/iconv/iconv.dsp
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ICONV_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /I "..\..\..\php_build\iconv\include" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_ICONV" /D "HAVE_ICONV" /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZTS=1 /D "HAVE_LIBICONV" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /I "..\..\..\php_build\iconv\include" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_ICONV" /D "HAVE_ICONV" /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZTS=1 /D "ICONV_SUPPORTS_ERRNO" /D "HAVE_LIBICONV" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x407 /d "NDEBUG"
diff --git a/ext/iconv/php_iconv.h b/ext/iconv/php_iconv.h
index 247f4cc615..5ee76c6549 100644
--- a/ext/iconv/php_iconv.h
+++ b/ext/iconv/php_iconv.h
@@ -28,10 +28,11 @@
#ifdef PHP_ATOM_INC
#include "php_have_iconv.h"
+#include "php_have_libiconv.h"
#endif
-#if HAVE_ICONV
+#ifdef HAVE_ICONV
extern zend_module_entry iconv_module_entry;
#define iconv_module_ptr &iconv_module_entry
diff --git a/ext/iconv/tests/translit.phpt b/ext/iconv/tests/translit.phpt
index 2d16d80ba0..c844fcd6e5 100644
--- a/ext/iconv/tests/translit.phpt
+++ b/ext/iconv/tests/translit.phpt
@@ -1,7 +1,7 @@
--TEST--
ICONV: LIBICONV transliteration (bug #16069)
--SKIPIF--
-<?php include('skipif.inc'); if( iconv('CP932', 'EUC-JP//TRANSLIT', "\x87\x6d") == '' ) die("skip(no libiconv)\n"); ?>
+<?php include( 'skipif.inc' ); if( iconv('CP932', 'EUC-JP//TRANSLIT', "\x87\x6d") == '' ) die("skip\n"); ?>
--POST--
--GET--
--FILE--