cvs: php4 /ext/exif exif.c
| From: | Marcus Boerger | Date: | Thu, 14 Nov 2002 21:43:00 +0000 |
| Subject: | cvs: php4 /ext/exif exif.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-16196@lists.php.net to get a copy of this message | ||
helly Thu Nov 14 16:43:00 2002 EDT
Modified files:
/php4/ext/exif exif.c
Log:
Test is affected by mbstring
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.118 php4/ext/exif/exif.c:1.119
--- php4/ext/exif/exif.c:1.118 Thu Nov 7 20:08:01 2002
+++ php4/ext/exif/exif.c Thu Nov 14 16:43:00 2002
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: exif.c,v 1.118 2002/11/08 01:08:01 iliaa Exp $ */
+/* $Id: exif.c,v 1.119 2002/11/14 21:43:00 helly Exp $ */
/* ToDos
*
@@ -109,7 +109,7 @@
};
/* }}} */
-#define EXIF_VERSION "1.4 $Id: exif.c,v 1.118 2002/11/08 01:08:01 iliaa Exp $"
+#define EXIF_VERSION "1.4 $Id: exif.c,v 1.119 2002/11/14 21:43:00 helly Exp $"
/* {{{ PHP_MINFO_FUNCTION
*/
@@ -2549,6 +2549,7 @@
static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoPtr, char
**pszEncoding, char *szValuePtr, int ByteCount TSRMLS_DC)
{
int a;
+ char *decode;
#ifdef HAVE_MBSTRING
size_t len;;
@@ -2562,11 +2563,23 @@
szValuePtr = szValuePtr+8;
ByteCount -= 8;
#ifdef HAVE_MBSTRING
- if (ImageInfo->motorola_intel) {
- *pszInfoPtr = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo->encode_unicode,
ImageInfo->decode_unicode_be, &len TSRMLS_CC);
+ /* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16)
+ * since we have no encoding support for the BOM yet we skip that.
+ */
+ if (!memcmp(szValuePtr, "\xFE\xFF", 2)) {
+ decode = "UCS-2BE";
+ szValuePtr = szValuePtr+2;
+ ByteCount -= 2;
+ } else if (!memcmp(szValuePtr, "\xFF\xFE", 2)) {
+ decode = "UCS-2LE";
+ szValuePtr = szValuePtr+2;
+ ByteCount -= 2;
+ } else if (ImageInfo->motorola_intel) {
+ decode = ImageInfo->decode_unicode_be;
} else {
- *pszInfoPtr = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo->encode_unicode,
ImageInfo->decode_unicode_le, &len TSRMLS_CC);
+ decode = ImageInfo->decode_unicode_le;
}
+ *pszInfoPtr = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo->encode_unicode,
decode, &len TSRMLS_CC);
return len;
#else
return exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);