summaryrefslogtreecommitdiff
path: root/ext/iconv
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:34:59 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:34:59 -0400
commitce7edc9b3c7370f32fec0bc7a8ec3e29ed9a5f61 (patch)
treeacdb9a8816483652a9db1a47db71df5df43707c5 /ext/iconv
parent10f5b47dc7c1cf2b9a00991629f43652710322d3 (diff)
downloadphp-ce7edc9b3c7370f32fec0bc7a8ec3e29ed9a5f61.tar.gz
Imported Upstream version 5.1.1upstream/5.1.1
Diffstat (limited to 'ext/iconv')
-rw-r--r--ext/iconv/config.m421
-rw-r--r--ext/iconv/config.w322
-rw-r--r--ext/iconv/iconv.c52
-rw-r--r--ext/iconv/php_iconv.h4
-rw-r--r--ext/iconv/tests/bug16069.phpt4
-rw-r--r--ext/iconv/tests/eucjp2iso2022jp.phpt2
-rw-r--r--ext/iconv/tests/eucjp2sjis.phpt2
-rw-r--r--ext/iconv/tests/eucjp2utf8.phpt2
-rw-r--r--ext/iconv/tests/iconv001.phpt2
-rw-r--r--ext/iconv/tests/iconv002.phpt2
-rw-r--r--ext/iconv/tests/iconv_mime_encode.phpt2
-rw-r--r--ext/iconv/tests/iconv_substr.phpt2
-rw-r--r--ext/iconv/tests/ob_iconv_handler.phpt2
-rw-r--r--ext/iconv/tests/skipif.inc9
-rw-r--r--ext/iconv/tests/translit-failure.phpt2
-rw-r--r--ext/iconv/tests/translit-utf8.phpt2
16 files changed, 65 insertions, 47 deletions
diff --git a/ext/iconv/config.m4 b/ext/iconv/config.m4
index 097c66263..7400c507f 100644
--- a/ext/iconv/config.m4
+++ b/ext/iconv/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.27.2.2 2005/01/10 21:37:59 tony2001 Exp $
+dnl $Id: config.m4,v 1.33.2.2 2005/10/13 19:28:58 sniper Exp $
dnl
PHP_ARG_WITH(iconv, for iconv support,
@@ -18,15 +18,23 @@ if test "$PHP_ICONV" != "no"; then
iconv_ldflags_save="$LDFLAGS"
if test -z "$ICONV_DIR"; then
- PHP_ICONV_PREFIX="/usr"
+ for i in /usr/local /usr; do
+ if test -f "$i/include/iconv.h" || test -f "$i/include/giconv.h"; then
+ PHP_ICONV_PREFIX="$i"
+ break
+ fi
+ done
+ if test -z "$PHP_ICONV_PREFIX"; then
+ PHP_ICONV_PREFIX="/usr"
+ fi
else
PHP_ICONV_PREFIX="$ICONV_DIR"
fi
CFLAGS="-I$PHP_ICONV_PREFIX/include $CFLAGS"
- LDFLAGS="-L$PHP_ICONV_PREFIX/lib $LDFLAGS"
+ LDFLAGS="-L$PHP_ICONV_PREFIX/$PHP_LIBDIR $LDFLAGS"
- if test -r $PHP_ICONV_PREFIX/include/giconv.h; then
+ if test -r "$PHP_ICONV_PREFIX/include/giconv.h"; then
PHP_ICONV_H_PATH="$PHP_ICONV_PREFIX/include/giconv.h"
else
PHP_ICONV_H_PATH="$PHP_ICONV_PREFIX/include/iconv.h"
@@ -115,6 +123,10 @@ int main() {
AC_MSG_RESULT(no)
PHP_DEFINE([ICONV_SUPPORTS_ERRNO],0,[ext/iconv])
AC_DEFINE([ICONV_SUPPORTS_ERRNO],0,[Whether iconv supports error no or not])
+ ],[
+ AC_MSG_RESULT(no, cross-compiling)
+ PHP_DEFINE([ICONV_SUPPORTS_ERRNO],0,[ext/iconv])
+ AC_DEFINE([ICONV_SUPPORTS_ERRNO],0,[Whether iconv supports error no or not])
])
AC_MSG_CHECKING([if your cpp allows macro usage in include lines])
@@ -134,6 +146,7 @@ int main() {
PHP_NEW_EXTENSION(iconv, iconv.c, $ext_shared,, [-I\"$PHP_ICONV_PREFIX/include\"])
PHP_SUBST(ICONV_SHARED_LIBADD)
+ PHP_INSTALL_HEADERS([ext/iconv/])
else
AC_MSG_ERROR(Please reinstall the iconv library.)
fi
diff --git a/ext/iconv/config.w32 b/ext/iconv/config.w32
index b640dbef4..8822ffd29 100644
--- a/ext/iconv/config.w32
+++ b/ext/iconv/config.w32
@@ -1,4 +1,4 @@
-// $Id: config.w32,v 1.4.2.2 2004/11/23 12:07:25 edink Exp $
+// $Id: config.w32,v 1.6 2004/11/23 12:04:07 edink Exp $
// vim: ft=javascript
ARG_WITH("iconv", "iconv support", "yes");
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index bd5cc15b8..4710f34f3 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
+ | Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: iconv.c,v 1.117.2.6 2005/06/08 23:51:05 iliaa Exp $ */
+/* $Id: iconv.c,v 1.124.2.2 2005/10/20 16:51:03 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -583,26 +583,38 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval,
size_t out_left;
unsigned int cnt;
-
+ unsigned int total_len;
+
+ err = _php_iconv_strlen(&total_len, str, nbytes, enc);
+ if (err != PHP_ICONV_ERR_SUCCESS) {
+ return err;
+ }
+
/* normalize the offset and the length */
- if (offset < 0 || len < 0) {
- unsigned int total_len;
- err = _php_iconv_strlen(&total_len, str, nbytes, enc);
- if (err != PHP_ICONV_ERR_SUCCESS) {
- return err;
- }
- if (offset < 0) {
- if ((offset += total_len) < 0) {
- offset = 0;
- }
+ if (offset < 0) {
+ if ((offset += total_len) < 0) {
+ offset = 0;
}
- if (len < 0) {
- if ((len += (total_len - offset)) < 0) {
- len = 0;
- }
+ }
+ if (len < 0) {
+ if ((len += (total_len - offset)) < 0) {
+ len = 0;
}
}
+ if (offset >= total_len) {
+ return PHP_ICONV_ERR_SUCCESS;
+ }
+
+ if ((offset + len) > total_len) {
+ /* trying to compute the length */
+ len = total_len - offset;
+ }
+
+ if (len == 0) {
+ return PHP_ICONV_ERR_SUCCESS;
+ }
+
cd1 = iconv_open(GENERIC_SUPERSET_NAME, enc);
if (cd1 == (iconv_t)(-1)) {
@@ -1230,7 +1242,7 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
const char *encoded_word = NULL;
const char *spaces = NULL;
- php_iconv_enc_scheme_t enc_scheme = 0;
+ php_iconv_enc_scheme_t enc_scheme = PHP_ICONV_ENC_SCHEME_BASE64;
if (next_pos != NULL) {
*next_pos = NULL;
@@ -1689,7 +1701,7 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
if (scan_stat == 1) {
_php_iconv_appendc(pretval, '=', cd_pl);
}
- err = 0;
+ err = PHP_ICONV_ERR_SUCCESS;
} else {
err = PHP_ICONV_ERR_MALFORMED;
goto out;
@@ -2064,7 +2076,7 @@ PHP_FUNCTION(iconv_mime_decode_headers)
int charset_len;
long mode = 0;
- php_iconv_err_t err = 0;
+ php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;
charset = ICONVG(internal_encoding);
diff --git a/ext/iconv/php_iconv.h b/ext/iconv/php_iconv.h
index 5a0f77c53..9310e3825 100644
--- a/ext/iconv/php_iconv.h
+++ b/ext/iconv/php_iconv.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
+ | Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Revision: 1.22.2.5 $ */
+/* $Revision: 1.28 $ */
#ifndef PHP_ICONV_H
#define PHP_ICONV_H
diff --git a/ext/iconv/tests/bug16069.phpt b/ext/iconv/tests/bug16069.phpt
index 0d58defe3..246b90c6c 100644
--- a/ext/iconv/tests/bug16069.phpt
+++ b/ext/iconv/tests/bug16069.phpt
@@ -2,9 +2,9 @@
Bug #16069
--SKIPIF--
<?php
-/* include( 'skipif.inc' ); */
+include( 'skipif.inc' );
if (@iconv('CP932', 'EUC-JP//TRANSLIT', "\x87\x6d")=='') {
- die("skip CP932 translit not available\n");
+ die("skip CP932 to EUC-JP translit not available\n");
}
?>
--INI--
diff --git a/ext/iconv/tests/eucjp2iso2022jp.phpt b/ext/iconv/tests/eucjp2iso2022jp.phpt
index 13dab43d4..9318c60de 100644
--- a/ext/iconv/tests/eucjp2iso2022jp.phpt
+++ b/ext/iconv/tests/eucjp2iso2022jp.phpt
@@ -1,7 +1,7 @@
--TEST--
EUC-JP to ISO-2022-JP
--SKIPIF--
-<?php /* include('skipif.inc'); */ ?>
+<?php include('skipif.inc'); ?>
--INI--
error_reporting=2039
--FILE--
diff --git a/ext/iconv/tests/eucjp2sjis.phpt b/ext/iconv/tests/eucjp2sjis.phpt
index c1cac62e8..a99512581 100644
--- a/ext/iconv/tests/eucjp2sjis.phpt
+++ b/ext/iconv/tests/eucjp2sjis.phpt
@@ -1,7 +1,7 @@
--TEST--
EUC-JP to SJIS
--SKIPIF--
-<?php /* include('skipif.inc'); */ ?>
+<?php include('skipif.inc'); ?>
--INI--
error_reporting=2039
--FILE--
diff --git a/ext/iconv/tests/eucjp2utf8.phpt b/ext/iconv/tests/eucjp2utf8.phpt
index 2100385cd..4ffcfef51 100644
--- a/ext/iconv/tests/eucjp2utf8.phpt
+++ b/ext/iconv/tests/eucjp2utf8.phpt
@@ -1,7 +1,7 @@
--TEST--
EUC-JP to UTF8
--SKIPIF--
-<?php /* include('skipif.inc'); */ ?>
+<?php include('skipif.inc'); ?>
--INI--
error_reporting=2039
--FILE--
diff --git a/ext/iconv/tests/iconv001.phpt b/ext/iconv/tests/iconv001.phpt
index d2c1f3ed6..3ef49246e 100644
--- a/ext/iconv/tests/iconv001.phpt
+++ b/ext/iconv/tests/iconv001.phpt
@@ -1,7 +1,7 @@
--TEST--
iconv() test 1
--SKIPIF--
-<?php /* include('skipif.inc'); */ ?>
+<?php include('skipif.inc'); ?>
--INI--
error_reporting=2039
--FILE--
diff --git a/ext/iconv/tests/iconv002.phpt b/ext/iconv/tests/iconv002.phpt
index 8aded5886..034b3761f 100644
--- a/ext/iconv/tests/iconv002.phpt
+++ b/ext/iconv/tests/iconv002.phpt
@@ -2,7 +2,7 @@
iconv() test 2 (UCS4BE to ASCII)
--SKIPIF--
<?php
-/* include('skipif.inc'); */
+include('skipif.inc');
if (@iconv("ascii","UCS-4LE", "abcd") == '') {
die("skip conversion to UCS-4LE not supported");
}
diff --git a/ext/iconv/tests/iconv_mime_encode.phpt b/ext/iconv/tests/iconv_mime_encode.phpt
index fd6cc6909..bd090e4d5 100644
--- a/ext/iconv/tests/iconv_mime_encode.phpt
+++ b/ext/iconv/tests/iconv_mime_encode.phpt
@@ -23,7 +23,7 @@ for ($line_len= 0; $line_len < 80; ++$line_len) {
$result = iconv_mime_encode("From", "サンプル文字列サンプル文字列日本語テキスト", $preference);
var_dump($result);
if ($result !== false) {
- $max = max(array_map("strlen", explode("\n", $result)));
+ $max = max(array_map("strlen", explode("\n", $result)));
print "-------- ";
var_dump(($max <= $line_len));
} else {
diff --git a/ext/iconv/tests/iconv_substr.phpt b/ext/iconv/tests/iconv_substr.phpt
index efa746e6d..5ee01d488 100644
--- a/ext/iconv/tests/iconv_substr.phpt
+++ b/ext/iconv/tests/iconv_substr.phpt
@@ -9,7 +9,7 @@ iconv.internal_charset=ISO-8859-1
function hexdump($str) {
$len = strlen($str);
for ($i = 0; $i < $len; ++$i) {
- printf("%02x", ord($str{$i}));
+ printf("%02x", ord($str[$i]));
}
print "\n";
}
diff --git a/ext/iconv/tests/ob_iconv_handler.phpt b/ext/iconv/tests/ob_iconv_handler.phpt
index f26f87e97..20f916935 100644
--- a/ext/iconv/tests/ob_iconv_handler.phpt
+++ b/ext/iconv/tests/ob_iconv_handler.phpt
@@ -1,7 +1,7 @@
--TEST--
ob_iconv_handler()
--SKIPIF--
-<?php /* include('skipif.inc'); */ ?>
+<?php include('skipif.inc'); ?>
--INI--
error_reporting=2039
--FILE--
diff --git a/ext/iconv/tests/skipif.inc b/ext/iconv/tests/skipif.inc
index 6f7bbf2b8..70d006744 100644
--- a/ext/iconv/tests/skipif.inc
+++ b/ext/iconv/tests/skipif.inc
@@ -1,12 +1,5 @@
<?php
-// This script prints "skip" if condition does not meet.
-
-// Do not dl load extension
-//if (!extension_loaded("iconv") && ini_get("enable_dl")) {
-// $dlext = (substr(PHP_OS, 0, 3) == "WIN") ? ".dll" : ".so";
-// @dl("iconv$dlext");
-//}
if (!extension_loaded("iconv")) {
die("skip iconv extension not available\n");
}
-?> \ No newline at end of file
+?>
diff --git a/ext/iconv/tests/translit-failure.phpt b/ext/iconv/tests/translit-failure.phpt
index a97e29c02..d8b9fbff8 100644
--- a/ext/iconv/tests/translit-failure.phpt
+++ b/ext/iconv/tests/translit-failure.phpt
@@ -2,7 +2,7 @@
Translit failure
--SKIPIF--
<?php
-/* include('skipif.inc'); */
+include('skipif.inc');
( ICONV_IMPL != "libiconv" ) and die("skip ICONV_IMPL != \"libiconv\"");
?>
--INI--
diff --git a/ext/iconv/tests/translit-utf8.phpt b/ext/iconv/tests/translit-utf8.phpt
index 64991aab8..aa5131f2c 100644
--- a/ext/iconv/tests/translit-utf8.phpt
+++ b/ext/iconv/tests/translit-utf8.phpt
@@ -2,7 +2,7 @@
Translit UTF-8 quotes
--SKIPIF--
<?php
-/* include('skipif.inc'); */
+include('skipif.inc');
( ICONV_IMPL != "libiconv" ) and die("skip ICONV_IMPL != \"libiconv\"");
?>
--INI--