[PHP-CVS] cvs: php4 /ext/exif exif.c

2003-06-20 Thread Marcus Boerger
helly   Fri Jun 20 14:24:38 2003 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  - Errors, warnings and notices start with a capital letter.
  - Show sorcode info when debugging exif.
  
  Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.151 php4/ext/exif/exif.c:1.152
--- php4/ext/exif/exif.c:1.151  Sun Jun 15 18:58:03 2003
+++ php4/ext/exif/exif.cFri Jun 20 14:24:38 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.151 2003/06/15 22:58:03 edink Exp $ */
+/* $Id: exif.c,v 1.152 2003/06/20 18:24:38 helly Exp $ */
 
 /*  ToDos
  *
@@ -49,6 +49,14 @@
  */
 #undef EXIF_DEBUG
 
+#ifdef EXIF_DEBUG
+#define EXIFERR_DC , const char *_file, size_t _line TSRMLS_DC
+#define EXIFERR_CC , __FILE__, __LINE__ TSRMLS_CC
+#else
+#define EXIFERR_DC TSRMLS_DC
+#define EXIFERR_CC TSRMLS_CC
+#endif
+
 #undef EXIF_JPEG2000
 
 #include php_exif.h
@@ -99,7 +107,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.151 2003/06/15 22:58:03 edink Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.152 2003/06/20 18:24:38 helly Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -243,10 +251,10 @@
 static const char * EXIF_ERROR_THUMBEOF  = Thumbnail goes IFD boundary or end of 
file reached;
 static const char * EXIF_ERROR_FSREALLOC = Illegal reallocating of undefined file 
section;
 
-#define EXIF_ERRLOG_FILEEOFphp_error_docref(NULL TSRMLS_CC, E_WARNING, 
EXIF_ERROR_FILEEOF);
-#define EXIF_ERRLOG_CORRUPTphp_error_docref(NULL TSRMLS_CC, E_WARNING, 
EXIF_ERROR_CORRUPT);
-#define EXIF_ERRLOG_THUMBEOF   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
EXIF_ERROR_THUMBEOF);
-#define EXIF_ERRLOG_FSREALLOC  php_error_docref(NULL TSRMLS_CC, E_WARNING, 
EXIF_ERROR_FSREALLOC);
+#define EXIF_ERRLOG_FILEEOF(ImageInfo)exif_error_docref(NULL EXIFERR_CC, 
ImageInfo, E_WARNING, EXIF_ERROR_FILEEOF);
+#define EXIF_ERRLOG_CORRUPT(ImageInfo)exif_error_docref(NULL EXIFERR_CC, 
ImageInfo, E_WARNING, EXIF_ERROR_CORRUPT);
+#define EXIF_ERRLOG_THUMBEOF(ImageInfo)   exif_error_docref(NULL EXIFERR_CC, 
ImageInfo, E_WARNING, EXIF_ERROR_THUMBEOF);
+#define EXIF_ERRLOG_FSREALLOC(ImageInfo)  exif_error_docref(NULL EXIFERR_CC, 
ImageInfo, E_WARNING, EXIF_ERROR_FSREALLOC);
 /* }}} */
 
 /* {{{ format description defines
@@ -1436,12 +1444,22 @@
 /* }}} */
 
 /* {{{ exif_error_docref */
-static void exif_error_docref(const char *docref TSRMLS_DC, const image_info_type 
*ImageInfo, int type, const char *format, ...)
+static void exif_error_docref(const char *docref EXIFERR_DC, const image_info_type 
*ImageInfo, int type, const char *format, ...)
 {
va_list args;

va_start(args, format);
+#ifdef EXIF_DEBUG
+   {
+   char *buf;
+
+   spprintf(buf, 0, %s(%d): %s, _file, _line, format);
+   php_verror(docref, ImageInfo-FileName?ImageInfo-FileName:, type, 
buf, args TSRMLS_CC);
+   efree(buf);
+   }
+#else
php_verror(docref, ImageInfo-FileName?ImageInfo-FileName:, type, format, 
args TSRMLS_CC);
+#endif
va_end(args);
 }
 /* }}} */
@@ -1494,7 +1512,7 @@
 * function parameters (requirements engineering).
 */
if (section_index = ImageInfo-file.count) {
-   EXIF_ERRLOG_FSREALLOC
+   EXIF_ERRLOG_FSREALLOC(ImageInfo)
return -1;
}
tmp = erealloc(ImageInfo-file.list[section_index].data, size);
@@ -1751,7 +1769,7 @@
info_data-name   = estrdup(name);
if (PG(magic_quotes_runtime)) {
 #ifdef EXIF_DEBUG
-   exif_error_docref(NULL TSRMLS_CC, image_info, E_NOTICE, 
Adding %s as buffer%s, name, exif_char_dump(value, length, 0));
+   exif_error_docref(NULL EXIFERR_CC, image_info, E_NOTICE, 
Adding %s as buffer%s, name, exif_char_dump(value, length, 0));
 #endif
info_data-value.s = php_addslashes(value, length, length, 0 
TSRMLS_CC);
info_data-length = length;
@@ -2334,7 +2352,7 @@
return; /* ignore this call */
}
 #ifdef EXIF_DEBUG
-   exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, Thumbnail: filetype = 
%d, ImageInfo-Thumbnail.filetype);
+   exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, Thumbnail: filetype = 
%d, ImageInfo-Thumbnail.filetype);
 #endif
switch(ImageInfo-Thumbnail.filetype) {
default:
@@ -2346,7 +2364,7 @@
info_list = ImageInfo-info_list[SECTION_THUMBNAIL];
new_size  = 8 + 2 + info_list-count * 12 + 4;
 #ifdef EXIF_DEBUG
-   exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, 
Thumbnail: size of signature + directory(%d): 0x%02X, info_list-count, new_size);
+   exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, 
Thumbnail: size of signature + directory(%d): 0x%02X, 

[PHP-CVS] cvs: php4 /ext/exif exif.c

2003-06-15 Thread Andrey Hristov
andrey  Sun Jun 15 11:28:50 2003 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  proto fixes
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.149 php4/ext/exif/exif.c:1.150
--- php4/ext/exif/exif.c:1.149  Tue Jun 10 16:03:28 2003
+++ php4/ext/exif/exif.cSun Jun 15 11:28:50 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.149 2003/06/10 20:03:28 imajes Exp $ */
+/* $Id: exif.c,v 1.150 2003/06/15 15:28:50 andrey Exp $ */
 
 /*  ToDos
  *
@@ -99,7 +99,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.149 2003/06/10 20:03:28 imajes Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.150 2003/06/15 15:28:50 andrey Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -2218,7 +2218,7 @@
 #endif
 /* }}} */
 
-/* {{{ proto string|false exif_tagname(index)
+/* {{{ proto string exif_tagname(index)
Get headername for index or false if not defined */
 PHP_FUNCTION(exif_tagname)
 {
@@ -3722,7 +3722,7 @@
 }
 /* }}} */
 
-/* {{{ proto array|false exif_read_data(string filename [, sections_needed [, 
sub_arrays[, read_thumbnail]]])
+/* {{{ proto array exif_read_data(string filename [, sections_needed [, sub_arrays[, 
read_thumbnail]]])
Reads header data from the JPEG/TIFF image filename and optionally reads the 
internal thumbnails */
 PHP_FUNCTION(exif_read_data)
 {
@@ -3913,7 +3913,7 @@
 }
 /* }}} */
 
-/* {{{ proto string|false exif_thumbnail(string filename [, width, height [, 
imagetype]])
+/* {{{ proto string exif_thumbnail(string filename [, width, height [, imagetype]])
Reads the embedded thumbnail */
 PHP_FUNCTION(exif_thumbnail)
 {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/exif exif.c exif.dsp

2003-06-15 Thread Edin Kadribasic
edink   Sun Jun 15 18:58:04 2003 EDT

  Modified files:  
/php4/ext/exif  exif.c exif.dsp 
  Log:
  Fixed win32 build
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.150 php4/ext/exif/exif.c:1.151
--- php4/ext/exif/exif.c:1.150  Sun Jun 15 11:28:50 2003
+++ php4/ext/exif/exif.cSun Jun 15 18:58:03 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.150 2003/06/15 15:28:50 andrey Exp $ */
+/* $Id: exif.c,v 1.151 2003/06/15 22:58:03 edink Exp $ */
 
 /*  ToDos
  *
@@ -99,7 +99,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.150 2003/06/15 15:28:50 andrey Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.151 2003/06/15 22:58:03 edink Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -134,7 +134,7 @@
 /* {{{ PHP_INI
  */
 
-ZEND_API ZEND_INI_MH(OnUpdateEncode)
+ZEND_INI_MH(OnUpdateEncode)
 {
 #if EXIF_USE_MBSTRING
if (new_value  strlen(new_value)  !php_mb_check_encoding_list(new_value 
TSRMLS_CC)) {
@@ -145,7 +145,7 @@
return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, 
mh_arg3, stage TSRMLS_CC);
 }
 
-ZEND_API ZEND_INI_MH(OnUpdateDecode)
+ZEND_INI_MH(OnUpdateDecode)
 {
 #if EXIF_USE_MBSTRING
if (!php_mb_check_encoding_list(new_value TSRMLS_CC)) {
Index: php4/ext/exif/exif.dsp
diff -u php4/ext/exif/exif.dsp:1.8 php4/ext/exif/exif.dsp:1.9
--- php4/ext/exif/exif.dsp:1.8  Mon Apr 15 18:23:20 2002
+++ php4/ext/exif/exif.dsp  Sun Jun 15 18:58:04 2003
@@ -44,7 +44,7 @@
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir 
 # ADD BASE CPP /nologo /MT /W3 /GX /O2 /I ..\.. /I ..\..\..\Zend /I 
..\..\..\bindlib_w32 /I ..\..\..\TSRM /D WIN32 /D NDEBUG /D _WINDOWS /D 
_MBCS /D _USRDLL /D COMPILE_DL_EXIF /D ZTS=1 /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I ..\.. /I ..\..\main /I ..\..\Zend /I 
..\..\..\bindlib_w32 /I ..\..\TSRM /D ZEND_DEBUG=0 /D WIN32 /D NDEBUG /D 
_WINDOWS /D _MBCS /D _USRDLL /D EXIF_EXPORTS /D COMPILE_DL_EXIF /D ZTS=1 /D 
ZEND_WIN32 /D PHP_WIN32 /D HAVE_EXIF=1 /D LIBZEND_EXPORTS /FR /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ..\.. /I ..\..\main /I ..\..\Zend /I 
..\..\..\bindlib_w32 /I ..\..\TSRM /D ZEND_DEBUG=0 /D WIN32 /D NDEBUG /D 
_WINDOWS /D _MBCS /D _USRDLL /D EXIF_EXPORTS /D COMPILE_DL_EXIF /D ZTS=1 /D 
ZEND_WIN32 /D PHP_WIN32 /D HAVE_EXIF=1 /FR /YX /FD /c
 # ADD BASE MTL /nologo /D NDEBUG /mktyplib203 /win32
 # ADD MTL /nologo /D NDEBUG /mktyplib203 /win32
 # ADD BASE RSC /l 0x406 /d NDEBUG



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/exif exif.c

2003-05-31 Thread Marcus Boerger
helly   Fri May 30 13:46:57 2003 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  Fix handling of ini settings
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.146 php4/ext/exif/exif.c:1.147
--- php4/ext/exif/exif.c:1.146  Mon May  5 09:46:14 2003
+++ php4/ext/exif/exif.cFri May 30 13:46:57 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.146 2003/05/05 13:46:14 hholzgra Exp $ */
+/* $Id: exif.c,v 1.147 2003/05/30 17:46:57 helly Exp $ */
 
 /*  ToDos
  *
@@ -99,7 +99,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.146 2003/05/05 13:46:14 hholzgra Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.147 2003/05/30 17:46:57 helly Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -3669,6 +3669,16 @@
 }
 /* }}} */
 
+/* {{{ estrdupx */
+static inline char * estrdupx(const char* str)
+{
+   if (str) {
+   return estrdup(str);
+   }
+   return estrdup();
+}
+/* }}} */
+
 /* {{{ exif_read_file
  */
 static int exif_read_file(image_info_type *ImageInfo, char *FileName, int 
read_thumbnail, int read_all TSRMLS_DC)
@@ -3692,12 +3702,12 @@
ImageInfo-read_all = read_all;
ImageInfo-Thumbnail.filetype = IMAGE_FILETYPE_UNKNOWN;
 
-   ImageInfo-encode_unicode= estrdup(EXIF_G(encode_unicode));
-   ImageInfo-decode_unicode_be = estrdup(EXIF_G(decode_unicode_be));
-   ImageInfo-decode_unicode_le = estrdup(EXIF_G(decode_unicode_le));
-   ImageInfo-encode_jis= estrdup(EXIF_G(encode_jis));
-   ImageInfo-decode_jis_be = estrdup(EXIF_G(decode_jis_be));
-   ImageInfo-decode_jis_le = estrdup(EXIF_G(decode_jis_le));
+   ImageInfo-encode_unicode= estrdupx(EXIF_G(encode_unicode));
+   ImageInfo-decode_unicode_be = estrdupx(EXIF_G(decode_unicode_be));
+   ImageInfo-decode_unicode_le = estrdupx(EXIF_G(decode_unicode_le));
+   ImageInfo-encode_jis= estrdupx(EXIF_G(encode_jis));
+   ImageInfo-decode_jis_be = estrdupx(EXIF_G(decode_jis_be));
+   ImageInfo-decode_jis_le = estrdupx(EXIF_G(decode_jis_le));
 
if (php_stream_is(ImageInfo-infile, PHP_STREAM_IS_STDIO)) {
if (VCWD_STAT(FileName, st) = 0) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/exif exif.c

2003-05-31 Thread Marcus Boerger
helly   Fri May 30 14:59:49 2003 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  Use safe_estrdup() instead.
  # Thanks Sascha i didn't knew about that thing.
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.147 php4/ext/exif/exif.c:1.148
--- php4/ext/exif/exif.c:1.147  Fri May 30 13:46:57 2003
+++ php4/ext/exif/exif.cFri May 30 14:59:49 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.147 2003/05/30 17:46:57 helly Exp $ */
+/* $Id: exif.c,v 1.148 2003/05/30 18:59:49 helly Exp $ */
 
 /*  ToDos
  *
@@ -99,7 +99,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.147 2003/05/30 17:46:57 helly Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.148 2003/05/30 18:59:49 helly Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -3669,16 +3669,6 @@
 }
 /* }}} */
 
-/* {{{ estrdupx */
-static inline char * estrdupx(const char* str)
-{
-   if (str) {
-   return estrdup(str);
-   }
-   return estrdup();
-}
-/* }}} */
-
 /* {{{ exif_read_file
  */
 static int exif_read_file(image_info_type *ImageInfo, char *FileName, int 
read_thumbnail, int read_all TSRMLS_DC)
@@ -3702,12 +3692,12 @@
ImageInfo-read_all = read_all;
ImageInfo-Thumbnail.filetype = IMAGE_FILETYPE_UNKNOWN;
 
-   ImageInfo-encode_unicode= estrdupx(EXIF_G(encode_unicode));
-   ImageInfo-decode_unicode_be = estrdupx(EXIF_G(decode_unicode_be));
-   ImageInfo-decode_unicode_le = estrdupx(EXIF_G(decode_unicode_le));
-   ImageInfo-encode_jis= estrdupx(EXIF_G(encode_jis));
-   ImageInfo-decode_jis_be = estrdupx(EXIF_G(decode_jis_be));
-   ImageInfo-decode_jis_le = estrdupx(EXIF_G(decode_jis_le));
+   ImageInfo-encode_unicode= safe_estrdup(EXIF_G(encode_unicode));
+   ImageInfo-decode_unicode_be = safe_estrdup(EXIF_G(decode_unicode_be));
+   ImageInfo-decode_unicode_le = safe_estrdup(EXIF_G(decode_unicode_le));
+   ImageInfo-encode_jis= safe_estrdup(EXIF_G(encode_jis));
+   ImageInfo-decode_jis_be = safe_estrdup(EXIF_G(decode_jis_be));
+   ImageInfo-decode_jis_le = safe_estrdup(EXIF_G(decode_jis_le));
 
if (php_stream_is(ImageInfo-infile, PHP_STREAM_IS_STDIO)) {
if (VCWD_STAT(FileName, st) = 0) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 /ext/exif exif.c

2003-05-31 Thread Jani Taskinen
  
MFH?

--Jani


On Fri, 30 May 2003, Marcus Boerger wrote:

helly  Fri May 30 14:59:49 2003 EDT

  Modified files:  
/php4/ext/exif exif.c 
  Log:
  Use safe_estrdup() instead.
  # Thanks Sascha i didn't knew about that thing.
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.147 php4/ext/exif/exif.c:1.148
--- php4/ext/exif/exif.c:1.147 Fri May 30 13:46:57 2003
+++ php4/ext/exif/exif.c   Fri May 30 14:59:49 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.147 2003/05/30 17:46:57 helly Exp $ */
+/* $Id: exif.c,v 1.148 2003/05/30 18:59:49 helly Exp $ */
 
 /*  ToDos
  *
@@ -99,7 +99,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.147 2003/05/30 17:46:57 helly Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.148 2003/05/30 18:59:49 helly Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -3669,16 +3669,6 @@
 }
 /* }}} */
 
-/* {{{ estrdupx */
-static inline char * estrdupx(const char* str)
-{
-  if (str) {
-  return estrdup(str);
-  }
-  return estrdup();
-}
-/* }}} */
-
 /* {{{ exif_read_file
  */
 static int exif_read_file(image_info_type *ImageInfo, char *FileName, int 
 read_thumbnail, int read_all TSRMLS_DC)
@@ -3702,12 +3692,12 @@
   ImageInfo-read_all = read_all;
   ImageInfo-Thumbnail.filetype = IMAGE_FILETYPE_UNKNOWN;
 
-  ImageInfo-encode_unicode= estrdupx(EXIF_G(encode_unicode));
-  ImageInfo-decode_unicode_be = estrdupx(EXIF_G(decode_unicode_be));
-  ImageInfo-decode_unicode_le = estrdupx(EXIF_G(decode_unicode_le));
-  ImageInfo-encode_jis= estrdupx(EXIF_G(encode_jis));
-  ImageInfo-decode_jis_be = estrdupx(EXIF_G(decode_jis_be));
-  ImageInfo-decode_jis_le = estrdupx(EXIF_G(decode_jis_le));
+  ImageInfo-encode_unicode= safe_estrdup(EXIF_G(encode_unicode));
+  ImageInfo-decode_unicode_be = safe_estrdup(EXIF_G(decode_unicode_be));
+  ImageInfo-decode_unicode_le = safe_estrdup(EXIF_G(decode_unicode_le));
+  ImageInfo-encode_jis= safe_estrdup(EXIF_G(encode_jis));
+  ImageInfo-decode_jis_be = safe_estrdup(EXIF_G(decode_jis_be));
+  ImageInfo-decode_jis_le = safe_estrdup(EXIF_G(decode_jis_le));
 
   if (php_stream_is(ImageInfo-infile, PHP_STREAM_IS_STDIO)) {
   if (VCWD_STAT(FileName, st) = 0) {





-- 
https://www.paypal.com/affil/pal=sniper%40php.net


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 /ext/exif exif.c

2003-05-31 Thread Marcus Börger
At 23:26 30.05.2003, Jani Taskinen wrote:
MFH?



If you insist then, yes, otherwise both versions are fine :-)

marcus

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-CVS] cvs: php4 /ext/exif exif.c

2003-05-31 Thread Jani Taskinen
On Sat, 31 May 2003, Marcus Börger wrote:

At 23:26 30.05.2003, Jani Taskinen wrote:

 MFH?



If you insist then, yes, otherwise both versions are fine :-)

marcus


Yes, I insist.

--Jani


-- 
https://www.paypal.com/xclick/[EMAIL PROTECTED]no_note=1tax=0currency_code=EUR
 


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/exif exif.c

2003-04-03 Thread Rasmus Lerdorf
rasmus  Thu Apr  3 17:45:26 2003 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  MFB
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.142 php4/ext/exif/exif.c:1.143
--- php4/ext/exif/exif.c:1.142  Wed Apr  2 17:07:22 2003
+++ php4/ext/exif/exif.cThu Apr  3 17:45:25 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.142 2003/04/02 22:07:22 rasmus Exp $ */
+/* $Id: exif.c,v 1.143 2003/04/03 22:45:25 rasmus Exp $ */
 
 /*  ToDos
  *
@@ -95,7 +95,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.142 2003/04/02 22:07:22 rasmus Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.143 2003/04/03 22:45:25 rasmus Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -3909,19 +3909,22 @@
Reads the embedded thumbnail */
 PHP_FUNCTION(exif_thumbnail)
 {
-   zval **p_name, **p_width, **p_height, **p_imagetype;
-   int ret, arg_c = ZEND_NUM_ARGS();
+   zval *p_width, *p_height, *p_imagetype;
+   char *p_name;
+   int p_name_len, ret, arg_c = ZEND_NUM_ARGS();
image_info_type ImageInfo;
 
memset(ImageInfo, 0, sizeof(ImageInfo));
 
-   if ((arg_c!=1  arg_c!=3  arg_c!=4) || zend_get_parameters_ex(arg_c, 
p_name, p_width, p_height, p_imagetype) == FAILURE) {
+   if (arg_c!=1  arg_c!=3  arg_c!=4) {
WRONG_PARAM_COUNT;
}
 
-   convert_to_string_ex(p_name);
+   if (zend_parse_parameters(arg_c TSRMLS_CC, s|z/z/z/, p_name, p_name_len, 
p_width, p_height, p_imagetype) == FAILURE) {
+   return;
+   }
 
-   ret = exif_read_file(ImageInfo, Z_STRVAL_PP(p_name), 1, 0 TSRMLS_CC);
+   ret = exif_read_file(ImageInfo, p_name, 1, 0 TSRMLS_CC);
if (ret==FALSE) {
RETURN_FALSE;
}
@@ -3943,11 +3946,14 @@
if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
exif_scan_thumbnail(ImageInfo TSRMLS_CC);
}
-   ZVAL_LONG(*p_width,  ImageInfo.Thumbnail.width);
-   ZVAL_LONG(*p_height, ImageInfo.Thumbnail.height);
+   zval_dtor(p_width);
+   zval_dtor(p_height);
+   ZVAL_LONG(p_width,  ImageInfo.Thumbnail.width);
+   ZVAL_LONG(p_height, ImageInfo.Thumbnail.height);
}
if (arg_c = 4) {
-   ZVAL_LONG(*p_imagetype, ImageInfo.Thumbnail.filetype);
+   zval_dtor(p_imagetype);
+   ZVAL_LONG(p_imagetype, ImageInfo.Thumbnail.filetype);
}
 
 #ifdef EXIF_DEBUG
@@ -3957,7 +3963,7 @@
exif_discard_imageinfo(ImageInfo);
 
 #ifdef EXIF_DEBUG
-   php_error_docref1(NULL TSRMLS_CC, Z_STRVAL_PP(p_name), E_NOTICE, done);
+   php_error_docref1(NULL TSRMLS_CC, p_name, E_NOTICE, done);
 #endif
 }
 /* }}} */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/exif exif.c

2003-04-02 Thread Rasmus Lerdorf
rasmus  Wed Apr  2 17:07:22 2003 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  MFB: Get rid of bogus dtors
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.141 php4/ext/exif/exif.c:1.142
--- php4/ext/exif/exif.c:1.141  Tue Apr  1 13:50:31 2003
+++ php4/ext/exif/exif.cWed Apr  2 17:07:22 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.141 2003/04/01 18:50:31 rasmus Exp $ */
+/* $Id: exif.c,v 1.142 2003/04/02 22:07:22 rasmus Exp $ */
 
 /*  ToDos
  *
@@ -95,7 +95,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.141 2003/04/01 18:50:31 rasmus Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.142 2003/04/02 22:07:22 rasmus Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -3943,13 +3943,10 @@
if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
exif_scan_thumbnail(ImageInfo TSRMLS_CC);
}
-   zval_dtor(*p_width);
-   zval_dtor(*p_height);
ZVAL_LONG(*p_width,  ImageInfo.Thumbnail.width);
ZVAL_LONG(*p_height, ImageInfo.Thumbnail.height);
}
if (arg_c = 4) {
-   zval_dtor(*p_imagetype);
ZVAL_LONG(*p_imagetype, ImageInfo.Thumbnail.filetype);
}
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 /ext/exif exif.c

2003-04-02 Thread Andi Gutmans
I don't have time to look through this in a thorough way but I think it 
could leak now. Maybe it's best if you move this function to 
getParameters() and convert_to_string() w/o _ex.

Andi

At 10:07 PM 4/2/2003 +, Rasmus Lerdorf wrote:
rasmus  Wed Apr  2 17:07:22 2003 EDT

  Modified files:
/php4/ext/exif  exif.c
  Log:
  MFB: Get rid of bogus dtors
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.141 php4/ext/exif/exif.c:1.142
--- php4/ext/exif/exif.c:1.141  Tue Apr  1 13:50:31 2003
+++ php4/ext/exif/exif.cWed Apr  2 17:07:22 2003
@@ -17,7 +17,7 @@
+--+
  */
-/* $Id: exif.c,v 1.141 2003/04/01 18:50:31 rasmus Exp $ */
+/* $Id: exif.c,v 1.142 2003/04/02 22:07:22 rasmus Exp $ */
 /*  ToDos
  *
@@ -95,7 +95,7 @@
 };
 /* }}} */
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.141 2003/04/01 18:50:31 rasmus 
Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.142 2003/04/02 22:07:22 rasmus 
Exp $

 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -3943,13 +3943,10 @@
if (!ImageInfo.Thumbnail.width || 
!ImageInfo.Thumbnail.height) {
exif_scan_thumbnail(ImageInfo TSRMLS_CC);
}
-   zval_dtor(*p_width);
-   zval_dtor(*p_height);
ZVAL_LONG(*p_width,  ImageInfo.Thumbnail.width);
ZVAL_LONG(*p_height, ImageInfo.Thumbnail.height);
}
if (arg_c = 4) {
-   zval_dtor(*p_imagetype);
ZVAL_LONG(*p_imagetype, ImageInfo.Thumbnail.filetype);
}



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-CVS] cvs: php4 /ext/exif exif.c

2003-04-01 Thread Rasmus Lerdorf
rasmus  Tue Apr  1 13:50:31 2003 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  MFB
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.140 php4/ext/exif/exif.c:1.141
--- php4/ext/exif/exif.c:1.140  Sat Jan 18 14:06:29 2003
+++ php4/ext/exif/exif.cTue Apr  1 13:50:31 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.140 2003/01/18 19:06:29 helly Exp $ */
+/* $Id: exif.c,v 1.141 2003/04/01 18:50:31 rasmus Exp $ */
 
 /*  ToDos
  *
@@ -95,7 +95,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.140 2003/01/18 19:06:29 helly Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.141 2003/04/01 18:50:31 rasmus Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -3920,17 +3920,9 @@
}
 
convert_to_string_ex(p_name);
-   if (arg_c = 3) {
-   zval_dtor(*p_width);
-   zval_dtor(*p_height);
-   }
-   if (arg_c = 4) {
-   zval_dtor(*p_imagetype);
-   }
 
ret = exif_read_file(ImageInfo, Z_STRVAL_PP(p_name), 1, 0 TSRMLS_CC);
if (ret==FALSE) {
-   exif_discard_imageinfo(ImageInfo);
RETURN_FALSE;
}
 
@@ -3951,10 +3943,13 @@
if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
exif_scan_thumbnail(ImageInfo TSRMLS_CC);
}
+   zval_dtor(*p_width);
+   zval_dtor(*p_height);
ZVAL_LONG(*p_width,  ImageInfo.Thumbnail.width);
ZVAL_LONG(*p_height, ImageInfo.Thumbnail.height);
}
if (arg_c = 4) {
+   zval_dtor(*p_imagetype);
ZVAL_LONG(*p_imagetype, ImageInfo.Thumbnail.filetype);
}
 
@@ -3984,6 +3979,7 @@
if (zend_get_parameters_ex(1, arg1) == FAILURE)
WRONG_PARAM_COUNT;
 
+   convert_to_string_ex(arg1);
stream = php_stream_open_wrapper(Z_STRVAL_PP(arg1), rb, 
IGNORE_PATH|ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
 
if (stream == NULL) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/exif exif.c

2003-01-18 Thread Ilia Alshanetsky
iliaa   Sat Jan 18 13:32:21 2003 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  Removed the no longer needed memory allocation checks.
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.137 php4/ext/exif/exif.c:1.138
--- php4/ext/exif/exif.c:1.137  Tue Dec 31 11:06:32 2002
+++ php4/ext/exif/exif.cSat Jan 18 13:32:19 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.137 2002/12/31 16:06:32 sebastian Exp $ */
+/* $Id: exif.c,v 1.138 2003/01/18 18:32:19 iliaa Exp $ */
 
 /*  ToDos
  *
@@ -95,7 +95,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.137 2002/12/31 16:06:32 sebastian Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.138 2003/01/18 18:32:19 iliaa Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -234,17 +234,13 @@
 
 /* {{{ error messages
 */
-static const char * EXIF_ERROR_EALLOC= Cannot allocate memory for all data;
 static const char * EXIF_ERROR_FILEEOF   = Unexpected end of file reached;
 static const char * EXIF_ERROR_CORRUPT   = File structure corrupted;
 static const char * EXIF_ERROR_THUMBEOF  = Thumbnail goes IFD boundary or end of 
file reached;
-static const char * EXIF_ERROR_FSREALLOC = Illegal reallocating of undefined file 
section;
 
-#define EXIF_ERRLOG_EALLOC php_error_docref(NULL TSRMLS_CC, E_ERROR,   
EXIF_ERROR_EALLOC);
 #define EXIF_ERRLOG_FILEEOFphp_error_docref(NULL TSRMLS_CC, E_WARNING, 
EXIF_ERROR_FILEEOF);
 #define EXIF_ERRLOG_CORRUPTphp_error_docref(NULL TSRMLS_CC, E_WARNING, 
EXIF_ERROR_CORRUPT);
 #define EXIF_ERRLOG_THUMBEOF   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
EXIF_ERROR_THUMBEOF);
-#define EXIF_ERRLOG_FSREALLOC  php_error_docref(NULL TSRMLS_CC, E_WARNING, 
EXIF_ERROR_FSREALLOC);
 /* }}} */
 
 /* {{{ format description defines
@@ -1332,10 +1328,6 @@
len += strlen(exif_get_sectionname(i))+2;
}
sections = emalloc(len+1);
-   if (!sections) {
-   EXIF_ERRLOG_EALLOC
-   return NULL;
-   }
sections[0] = '\0';
len = 0;
for(i=0; iSECTION_COUNT; i++) {
@@ -1468,9 +1460,6 @@
int count = ImageInfo-file.count;
 
tmp = erealloc(ImageInfo-file.list, (count+1)*sizeof(file_section));
-   if (tmp == NULL) {
-   return 0;
-   }
ImageInfo-file.list = tmp;
ImageInfo-file.list[count].type = 0x;
ImageInfo-file.list[count].data = NULL;
@@ -1479,9 +1468,7 @@
if (!size) {
data = NULL;
} else if (data == NULL) {
-   if ((data = emalloc(size)) == NULL) {
-   return -1;
-   }
+   data = emalloc(size);
}
ImageInfo-file.list[count].type = type;
ImageInfo-file.list[count].data = data;
@@ -1497,14 +1484,10 @@
 {
void *tmp;
 
-   if (section_index = ImageInfo-file.count) {
-   EXIF_ERRLOG_FSREALLOC
-   return -1;
-   }
-   if (!(tmp = erealloc(ImageInfo-file.list[section_index].data, size))  size) 
{
-   EXIF_ERRLOG_EALLOC
+   if (size = 0 || section_index = ImageInfo-file.count) {
return -1;
}
+   tmp = erealloc(ImageInfo-file.list[section_index].data, size);
ImageInfo-file.list[section_index].data = tmp;
ImageInfo-file.list[section_index].size = size;
return 0;
@@ -1541,10 +1524,6 @@
image_info_data  *list;
 
list = erealloc(image_info-info_list[section_index].list, 
(image_info-info_list[section_index].count+1)*sizeof(image_info_data));
-   if (!list) {
-   EXIF_ERRLOG_EALLOC
-   return;
-   }
image_info-info_list[section_index].list = list;
 
info_data  = 
image_info-info_list[section_index].list[image_info-info_list[section_index].count];
@@ -1552,10 +1531,6 @@
info_data-format = format;
info_data-length = length;
info_data-name   = estrdup(name);
-   if (!info_data-name) {
-   EXIF_ERRLOG_EALLOC
-   return;
-   }
info_value= info_data-value;
 
switch (format) {
@@ -1572,11 +1547,6 @@
info_data-length = 0;
info_value-s = estrdup();
}
-   if (!info_value-s) {
-   EXIF_ERRLOG_EALLOC
-   info_data-length = 0;
-   break; /* better return with  instead of possible 
causing problems */
-   }
break;
 
default:
@@ -1604,10 +1574,6 @@
info_data-length = 0;
info_value-s = estrdup();
}
-   if (!info_value-s) {
-   EXIF_ERRLOG_EALLOC
-  

Re: [PHP-CVS] cvs: php4 /ext/exif exif.c

2003-01-18 Thread Marcus Börger
At 19:32 18.01.2003, Ilia Alshanetsky wrote:

iliaa   Sat Jan 18 13:32:21 2003 EDT

  Modified files:
/php4/ext/exif  exif.c
  Log:
  Removed the no longer needed memory allocation checks.




After my reworked patch - what made you sure EXIF_ERRLOG_FSREALLOC
is not needed?

marcus


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/exif exif.c

2003-01-18 Thread Ilia Alshanetsky
iliaa   Sat Jan 18 13:51:13 2003 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  Additional memory allocation fixes by Marcus Börger.
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.138 php4/ext/exif/exif.c:1.139
--- php4/ext/exif/exif.c:1.138  Sat Jan 18 13:32:19 2003
+++ php4/ext/exif/exif.cSat Jan 18 13:51:12 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.138 2003/01/18 18:32:19 iliaa Exp $ */
+/* $Id: exif.c,v 1.139 2003/01/18 18:51:12 iliaa Exp $ */
 
 /*  ToDos
  *
@@ -95,7 +95,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.138 2003/01/18 18:32:19 iliaa Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.139 2003/01/18 18:51:12 iliaa Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -237,10 +237,12 @@
 static const char * EXIF_ERROR_FILEEOF   = Unexpected end of file reached;
 static const char * EXIF_ERROR_CORRUPT   = File structure corrupted;
 static const char * EXIF_ERROR_THUMBEOF  = Thumbnail goes IFD boundary or end of 
file reached;
+static const char * EXIF_ERROR_FSREALLOC = Illegal reallocating of undefined file 
+section;
 
 #define EXIF_ERRLOG_FILEEOFphp_error_docref(NULL TSRMLS_CC, E_WARNING, 
EXIF_ERROR_FILEEOF);
 #define EXIF_ERRLOG_CORRUPTphp_error_docref(NULL TSRMLS_CC, E_WARNING, 
EXIF_ERROR_CORRUPT);
 #define EXIF_ERRLOG_THUMBEOF   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
EXIF_ERROR_THUMBEOF);
+#define EXIF_ERRLOG_FSREALLOC  php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+EXIF_ERROR_FSREALLOC);
 /* }}} */
 
 /* {{{ format description defines
@@ -1484,7 +1486,12 @@
 {
void *tmp;
 
-   if (size = 0 || section_index = ImageInfo-file.count) {
+   if (section_index = ImageInfo-file.count) {
+   EXIF_ERRLOG_FSREALLOC
+   return -1;
+   }
+   tmp = erealloc(ImageInfo-file.list[section_index].data, size);
+   if (size == 0 || section_index = ImageInfo-file.count) {
return -1;
}
tmp = erealloc(ImageInfo-file.list[section_index].data, size);
@@ -1538,7 +1545,7 @@
if (value) {
length = php_strnlen(value, length);
if (PG(magic_quotes_runtime)) {
-   info_data-value.s = php_addslashes(value, 
length, length, 0 TSRMLS_CC);
+   info_value-s = php_addslashes(value, length, 
+length, 0 TSRMLS_CC);
} else {
info_value-s = estrndup(value, length);
}
@@ -1565,7 +1572,7 @@
if (value) {
/* do not recompute length here */
if (PG(magic_quotes_runtime)) {
-   info_data-value.s = php_addslashes(value, 
length, length, 0 TSRMLS_CC);
+   info_value-s = php_addslashes(value, length, 
+length, 0 TSRMLS_CC);
} else {
info_value-s = estrndup(value, length);
}
@@ -1588,7 +1595,7 @@
break;
} else
if (length1) {
-   info_data-value.list = 
emalloc(length*sizeof(image_info_value));
+   info_value-list = 
+emalloc(length*sizeof(image_info_value));
} else {
info_value = info_data-value;
}
@@ -2799,9 +2806,7 @@
/* When there are any characters after 
the first NUL */
ImageInfo-CopyrightPhotographer  = 
estrdup(value_ptr);
ImageInfo-CopyrightEditor= 
estrdup(value_ptr+length+1);
-   ImageInfo-Copyright  = 
emalloc(strlen(value_ptr)+strlen(value_ptr+length+1)+3);
-
-   sprintf(ImageInfo-Copyright, %s, 
%s, value_ptr, value_ptr+length+1);
+   spprintf(ImageInfo-Copyright, 0, 
+%s, %s, value_ptr, value_ptr+length+1);
/* format = TAG_FMT_UNDEFINED; this 
musn't be ASCII */
/* but we are not supposed to change 
this   */
/* keep in mind that image_info does 
not store editor value */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/exif exif.c

2002-12-16 Thread Marcus Boerger
helly   Mon Dec 16 04:58:50 2002 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  change mbstring detection
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.130 php4/ext/exif/exif.c:1.131
--- php4/ext/exif/exif.c:1.130  Sun Dec 15 13:49:07 2002
+++ php4/ext/exif/exif.cMon Dec 16 04:58:49 2002
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.130 2002/12/15 18:49:07 helly Exp $ */
+/* $Id: exif.c,v 1.131 2002/12/16 09:58:49 helly Exp $ */
 
 /*  ToDos
  *
@@ -58,9 +58,11 @@
 #include ext/standard/php_image.h
 #include ext/standard/info.h 
 
-#if defined(HAVE_MBSTRING)  !defined(COMPILE_DL_MBSTRING)
+#if HAVE_MBSTRING
+#if !defined(COMPILE_DL_MBSTRING) 
 #define EXIF_USE_MBSTRING 1
 #endif
+#endif
 
 #ifdef EXIF_USE_MBSTRING
 #include ext/mbstring/mbstring.h
@@ -93,7 +95,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.130 2002/12/15 18:49:07 helly Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.131 2002/12/16 09:58:49 helly Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/exif exif.c /ext/exif/tests exif002.phpt exif003.phpt exif004.phpt exif005.phpt exif006.phpt

2002-12-16 Thread Marcus Boerger
helly   Mon Dec 16 09:48:00 2002 EDT

  Modified files:  
/php4/ext/exif  exif.c 
/php4/ext/exif/testsexif002.phpt exif003.phpt exif004.phpt 
exif005.phpt exif006.phpt 
  Log:
  -Add constant that shows whether or not exif uses mbstring.
  -Fix tests
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.131 php4/ext/exif/exif.c:1.132
--- php4/ext/exif/exif.c:1.131  Mon Dec 16 04:58:49 2002
+++ php4/ext/exif/exif.cMon Dec 16 09:47:59 2002
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.131 2002/12/16 09:58:49 helly Exp $ */
+/* $Id: exif.c,v 1.132 2002/12/16 14:47:59 helly Exp $ */
 
 /*  ToDos
  *
@@ -58,10 +58,10 @@
 #include ext/standard/php_image.h
 #include ext/standard/info.h 
 
-#if HAVE_MBSTRING
-#if !defined(COMPILE_DL_MBSTRING) 
+#if HAVE_MBSTRING  !defined(COMPILE_DL_MBSTRING) 
 #define EXIF_USE_MBSTRING 1
-#endif
+#else
+#define EXIF_USE_MBSTRING 0
 #endif
 
 #ifdef EXIF_USE_MBSTRING
@@ -95,7 +95,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.131 2002/12/16 09:58:49 helly Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.132 2002/12/16 14:47:59 helly Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -181,6 +181,7 @@
 {
ZEND_INIT_MODULE_GLOBALS(exif, php_exif_init_globals, NULL);
REGISTER_INI_ENTRIES();
+   REGISTER_LONG_CONSTANT(EXIF_USE_MBSTRING, EXIF_USE_MBSTRING, CONST_CS | 
+CONST_PERSISTENT); 
return SUCCESS;
 }
 /* }}} */
Index: php4/ext/exif/tests/exif002.phpt
diff -u php4/ext/exif/tests/exif002.phpt:1.1 php4/ext/exif/tests/exif002.phpt:1.2
--- php4/ext/exif/tests/exif002.phpt:1.1Fri Oct 25 06:59:52 2002
+++ php4/ext/exif/tests/exif002.phptMon Dec 16 09:48:00 2002
@@ -13,9 +13,9 @@
   test2.jpg is the same image but contains Exif/Comment information and a
 copy of test1.jpg as a thumbnail.
 */
-$infile = './ext/exif/tests/test1.jpg';
+$infile = dirname(__FILE__).'./test1.jpg';
 echo md5_file($infile).'_'.filesize($infile);
-$thumb = exif_thumbnail('./ext/exif/tests/test2.jpg');
+$thumb = exif_thumbnail(dirname(__FILE__).'./test2.jpg');
 echo  == ;
 echo md5($thumb).'_'.strlen($thumb);
 echo \n;
Index: php4/ext/exif/tests/exif003.phpt
diff -u php4/ext/exif/tests/exif003.phpt:1.2 php4/ext/exif/tests/exif003.phpt:1.3
--- php4/ext/exif/tests/exif003.phpt:1.2Thu Nov 14 16:43:49 2002
+++ php4/ext/exif/tests/exif003.phptMon Dec 16 09:48:00 2002
@@ -4,6 +4,7 @@
 ?php 
if (!extension_loaded('exif')) die('skip exif extension not available');
if (!extension_loaded('mbstring')) die('skip mbstring extension not 
available');
+   if (!EXIF_USE_MBSTRING) die ('skip mbstring loaded by dl');
 ?
 --INI--
 output_handler=
@@ -18,7 +19,7 @@
 copy of test1.jpg as a thumbnail.
   test3.jpg is the same as test2.jpg but with a UNICODE UserComment: 
Auml;Ouml;Uuml;szlig;auml;ouml;uuml;
 */
-var_dump(exif_read_data('./ext/exif/tests/test3.jpg','',true,false));
+var_dump(exif_read_data(dirname(__FILE__).'./test3.jpg','',true,false));
 ?
 --EXPECTF--
 array(5) {
Index: php4/ext/exif/tests/exif004.phpt
diff -u php4/ext/exif/tests/exif004.phpt:1.2 php4/ext/exif/tests/exif004.phpt:1.3
--- php4/ext/exif/tests/exif004.phpt:1.2Thu Nov 14 16:45:01 2002
+++ php4/ext/exif/tests/exif004.phptMon Dec 16 09:48:00 2002
@@ -4,6 +4,7 @@
 ?php 
if (!extension_loaded('exif')) die('skip exif extension not available');
if (!extension_loaded('mbstring')) die('skip mbstring extension not 
available');
+   if (!EXIF_USE_MBSTRING) die ('skip mbstring loaded by dl');
 ?
 --INI--
 output_handler=
@@ -16,7 +17,7 @@
 /*
   test4.jpg is a 1*1 image that contains Exif tags written by WindowsXP
 */
-$image  = exif_read_data('./ext/exif/tests/test4.jpg','',true,false);
+$image  = exif_read_data(dirname(__FILE__).'./test4.jpg','',true,false);
 echo var_dump($image['WINXP']);
 ?
 --EXPECT--
Index: php4/ext/exif/tests/exif005.phpt
diff -u php4/ext/exif/tests/exif005.phpt:1.3 php4/ext/exif/tests/exif005.phpt:1.4
--- php4/ext/exif/tests/exif005.phpt:1.3Thu Nov 14 16:45:01 2002
+++ php4/ext/exif/tests/exif005.phptMon Dec 16 09:48:00 2002
@@ -10,7 +10,7 @@
 /* Do not change this test it is a REATME.TESTING example.
  * test5.jpg is a 1*1 image that contains an Exif section with ifd = 0009h
  */
-$image  = exif_read_data('./ext/exif/tests/test5.jpg','',true,false);
+$image  = exif_read_data(dirname(__FILE__).'./test5.jpg','',true,false);
 var_dump($image['IFD0']);
 ?
 --EXPECT--
Index: php4/ext/exif/tests/exif006.phpt
diff -u php4/ext/exif/tests/exif006.phpt:1.1 php4/ext/exif/tests/exif006.phpt:1.2
--- php4/ext/exif/tests/exif006.phpt:1.1Tue Nov 26 21:31:25 2002
+++ php4/ext/exif/tests/exif006.phptMon Dec 16 09:48:00 2002
@@ -14,7 +14,7 @@
 copy of test1.jpg as a thumbnail.
   test6.jpg is the same as test2.jpg but with 

[PHP-CVS] cvs: php4 /ext/exif exif.c

2002-12-16 Thread Marcus Boerger
helly   Mon Dec 16 10:53:47 2002 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  fix compiler definition tests
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.132 php4/ext/exif/exif.c:1.133
--- php4/ext/exif/exif.c:1.132  Mon Dec 16 09:47:59 2002
+++ php4/ext/exif/exif.cMon Dec 16 10:53:46 2002
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.132 2002/12/16 14:47:59 helly Exp $ */
+/* $Id: exif.c,v 1.133 2002/12/16 15:53:46 helly Exp $ */
 
 /*  ToDos
  *
@@ -64,7 +64,7 @@
 #define EXIF_USE_MBSTRING 0
 #endif
 
-#ifdef EXIF_USE_MBSTRING
+#if EXIF_USE_MBSTRING
 #include ext/mbstring/mbstring.h
 #endif
 
@@ -95,7 +95,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.132 2002/12/16 14:47:59 helly Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.133 2002/12/16 15:53:46 helly Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -132,7 +132,7 @@
 
 ZEND_API ZEND_INI_MH(OnUpdateEncode)
 {
-#ifdef EXIF_USE_MBSTRING
+#if EXIF_USE_MBSTRING
if (new_value  strlen(new_value)  !php_mb_check_encoding_list(new_value 
TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Illegal encoding ignored: 
'%s', new_value);
return FAILURE;
@@ -143,7 +143,7 @@
 
 ZEND_API ZEND_INI_MH(OnUpdateDecode)
 {
-#ifdef EXIF_USE_MBSTRING
+#if EXIF_USE_MBSTRING
if (!php_mb_check_encoding_list(new_value TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Illegal encoding ignored: 
'%s', new_value);
return FAILURE;
@@ -2582,7 +2582,7 @@
 {
int   a;
 
-#ifdef EXIF_USE_MBSTRING
+#if EXIF_USE_MBSTRING
char  *decode;
size_t len;;
 #endif
@@ -2594,7 +2594,7 @@
*pszEncoding = estrdup((const char*)szValuePtr);
szValuePtr = szValuePtr+8;
ByteCount -= 8;
-#ifdef EXIF_USE_MBSTRING
+#if EXIF_USE_MBSTRING
/* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16) 
 * since we have no encoding support for the BOM yet we skip 
that.
 */
@@ -2627,7 +2627,7 @@
*pszEncoding = estrdup((const char*)szValuePtr);
szValuePtr = szValuePtr+8;
ByteCount -= 8;
-#ifdef EXIF_USE_MBSTRING
+#if EXIF_USE_MBSTRING
if (ImageInfo-motorola_intel) {
*pszInfoPtr = php_mb_convert_encoding(szValuePtr, 
ByteCount, ImageInfo-encode_jis, ImageInfo-decode_jis_be, len TSRMLS_CC);
} else {
@@ -2666,7 +2666,7 @@
xp_field-tag = tag;
 
/* Copy the comment */
-#ifdef EXIF_USE_MBSTRING
+#if EXIF_USE_MBSTRING
 /*  What if MS supports big-endian with XP? */
 /* if (ImageInfo-motorola_intel) {
xp_field-value = php_mb_convert_encoding(szValuePtr, ByteCount, 
ImageInfo-encode_unicode, ImageInfo-decode_unicode_be, xp_field-size TSRMLS_CC);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/exif exif.c

2002-12-15 Thread Marcus Boerger
helly   Sun Dec 15 13:49:07 2002 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  ws
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.129 php4/ext/exif/exif.c:1.130
--- php4/ext/exif/exif.c:1.129  Sat Dec 14 14:53:20 2002
+++ php4/ext/exif/exif.cSun Dec 15 13:49:07 2002
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.129 2002/12/14 19:53:20 helly Exp $ */
+/* $Id: exif.c,v 1.130 2002/12/15 18:49:07 helly Exp $ */
 
 /*  ToDos
  *
@@ -93,7 +93,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.129 2002/12/14 19:53:20 helly Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.130 2002/12/15 18:49:07 helly Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -132,7 +132,7 @@
 {
 #ifdef EXIF_USE_MBSTRING
if (new_value  strlen(new_value)  !php_mb_check_encoding_list(new_value 
TSRMLS_CC)) {
-   php_error_docref( NULL TSRMLS_CC, E_WARNING, Illegal encoding 
ignored: '%s', new_value);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Illegal encoding ignored: 
+'%s', new_value);
return FAILURE;
}
 #endif
@@ -143,7 +143,7 @@
 {
 #ifdef EXIF_USE_MBSTRING
if (!php_mb_check_encoding_list(new_value TSRMLS_CC)) {
-   php_error_docref( NULL TSRMLS_CC, E_WARNING, Illegal encoding 
ignored: '%s', new_value);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Illegal encoding ignored: 
+'%s', new_value);
return FAILURE;
}
 #endif
@@ -1134,12 +1134,12 @@
/* Not sure if this is correct (never seen float used in Exif format) 
*/
case TAG_FMT_SINGLE:
 #ifdef EXIF_DEBUG
-   php_error_docref( NULL TSRMLS_CC, E_NOTICE, Found value of 
type single);
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, Found value of 
+type single);
 #endif
return (double)*(float *)value;
case TAG_FMT_DOUBLE:
 #ifdef EXIF_DEBUG
-   php_error_docref( NULL TSRMLS_CC, E_NOTICE, Found value of 
type double);
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, Found value of 
+type double);
 #endif
return *(double *)value;
}
@@ -1183,12 +1183,12 @@
/* Not sure if this is correct (never seen float used in Exif format) 
*/
case TAG_FMT_SINGLE:
 #ifdef EXIF_DEBUG
-   php_error_docref( NULL TSRMLS_CC, E_NOTICE, Found value of 
type single);
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, Found value of 
+type single);
 #endif
return (size_t)*(float *)value;
case TAG_FMT_DOUBLE:
 #ifdef EXIF_DEBUG
-   php_error_docref( NULL TSRMLS_CC, E_NOTICE, Found value of 
type double);
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, Found value of 
+type double);
 #endif
return (size_t)*(double *)value;
}
@@ -1660,13 +1660,13 @@
 
case TAG_FMT_SINGLE:
 #ifdef EXIF_DEBUG
-   php_error_docref( NULL TSRMLS_CC, 
E_WARNING, Found value of type single);
+   php_error_docref(NULL TSRMLS_CC, 
+E_WARNING, Found value of type single);
 #endif
info_value-f = *(float *)value;
 
case TAG_FMT_DOUBLE:
 #ifdef EXIF_DEBUG
-   php_error_docref( NULL TSRMLS_CC, 
E_WARNING, Found value of type double);
+   php_error_docref(NULL TSRMLS_CC, 
+E_WARNING, Found value of type double);
 #endif
info_value-d = *(double *)value;
break;
@@ -1881,7 +1881,7 @@
pval *tmpi, *array = NULL;
 
 #ifdef EXIF_DEBUG
-/* php_error_docref( NULL TSRMLS_CC, E_NOTICE, Adding %d infos from 
section %s, image_info-info_list[section_index].count, 
exif_get_sectionname(section_index));*/
+/* php_error_docref(NULL TSRMLS_CC, E_NOTICE, Adding %d infos from 
+section %s, image_info-info_list[section_index].count, 
+exif_get_sectionname(section_index));*/
 #endif
if (image_info-info_list[section_index].count) {
if (sub_array) {
@@ -1903,7 +1903,7 @@
name = uname;
}
 #ifdef EXIF_DEBUG
-/* php_error_docref( NULL TSRMLS_CC, E_NOTICE, Adding infos: 
tag(0x%04X,%12s,L=0x%04X): %s, info_tag, exif_get_tagname(info_tag, buffer, -12, 
exif_get_tag_table(section_index) TSRMLS_CC), info_data-length, 
info_data-format==TAG_FMT_STRING?(info_valueinfo_value-s?info_value-s:no 

[PHP-CVS] cvs: php4 /ext/exif exif.c

2002-12-10 Thread Marcus Boerger
helly   Tue Dec 10 09:35:17 2002 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  -make those debug messages
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.124 php4/ext/exif/exif.c:1.125
--- php4/ext/exif/exif.c:1.124  Mon Dec  9 19:10:27 2002
+++ php4/ext/exif/exif.cTue Dec 10 09:35:13 2002
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.124 2002/12/10 00:10:27 iliaa Exp $ */
+/* $Id: exif.c,v 1.125 2002/12/10 14:35:13 helly Exp $ */
 
 /*  ToDos
  *
@@ -89,7 +89,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.124 2002/12/10 00:10:27 iliaa Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.125 2002/12/10 14:35:13 helly Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -1129,10 +1129,14 @@
 
/* Not sure if this is correct (never seen float used in Exif format) 
*/
case TAG_FMT_SINGLE:
+#ifdef EXIF_DEBUG
php_error_docref( NULL TSRMLS_CC, E_NOTICE, Found value of 
type single);
+#endif
return (double)*(float *)value;
case TAG_FMT_DOUBLE:
+#ifdef EXIF_DEBUG
php_error_docref( NULL TSRMLS_CC, E_NOTICE, Found value of 
type double);
+#endif
return *(double *)value;
}
return 0;
@@ -1174,10 +1178,14 @@
 
/* Not sure if this is correct (never seen float used in Exif format) 
*/
case TAG_FMT_SINGLE:
+#ifdef EXIF_DEBUG
php_error_docref( NULL TSRMLS_CC, E_NOTICE, Found value of 
type single);
+#endif
return (size_t)*(float *)value;
case TAG_FMT_DOUBLE:
+#ifdef EXIF_DEBUG
php_error_docref( NULL TSRMLS_CC, E_NOTICE, Found value of 
type double);
+#endif
return (size_t)*(double *)value;
}
return 0;
@@ -1647,11 +1655,15 @@
break;
 
case TAG_FMT_SINGLE:
+#ifdef EXIF_DEBUG
php_error_docref( NULL TSRMLS_CC, 
E_WARNING, Found value of type single);
+#endif
info_value-f = *(float *)value;
 
case TAG_FMT_DOUBLE:
+#ifdef EXIF_DEBUG
php_error_docref( NULL TSRMLS_CC, 
E_WARNING, Found value of type double);
+#endif
info_value-d = *(double *)value;
break;
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/exif exif.c

2002-12-09 Thread Ilia Alshanetsky
iliaa   Mon Dec  9 19:10:28 2002 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  Fixed bug #20907, patch by [EMAIL PROTECTED]
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.123 php4/ext/exif/exif.c:1.124
--- php4/ext/exif/exif.c:1.123  Tue Nov 26 21:42:41 2002
+++ php4/ext/exif/exif.cMon Dec  9 19:10:27 2002
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.123 2002/11/27 02:42:41 helly Exp $ */
+/* $Id: exif.c,v 1.124 2002/12/10 00:10:27 iliaa Exp $ */
 
 /*  ToDos
  *
@@ -89,7 +89,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.123 2002/11/27 02:42:41 helly Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.124 2002/12/10 00:10:27 iliaa Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -765,8 +765,8 @@
   { 0x, GPSVersion},
   { 0x0001, GPSLatitudeRef},
   { 0x0002, GPSLatitude},
-  { 0x0003, GPSLongitude},
-  { 0x0004, GPSLongitudeRef},
+  { 0x0003, GPSLongitudeRef},
+  { 0x0004, GPSLongitude},
   { 0x0005, GPSAltitudeRef},
   { 0x0006, GPSAltitude},
   { 0x0007, GPSTimeStamp},
@@ -1520,6 +1520,7 @@
 static void exif_iif_add_value(image_info_type *image_info, int section_index, char 
*name, int tag, int format, size_t length, void* value, int motorola_intel TSRMLS_DC)
 {
size_t index;
+   void *vptr;
image_info_value *info_value;
image_info_data  *info_data;
image_info_data  *list;
@@ -1614,35 +1615,35 @@
} else {
info_value = info_data-value;
}
-   for (index=0; indexlength; index++) {
+   for (index=0,vptr=value; indexlength; 
+index++,vptr+=php_tiff_bytes_per_format[format]) {
if (length1) {
info_value = info_data-value.list[index];
}
switch (format) {
case TAG_FMT_USHORT:
-   info_value-u = php_ifd_get16u(value, 
motorola_intel);
+   info_value-u = php_ifd_get16u(vptr, 
+motorola_intel);
break;
 
case TAG_FMT_ULONG:
-   info_value-u = php_ifd_get32u(value, 
motorola_intel);
+   info_value-u = php_ifd_get32u(vptr, 
+motorola_intel);
break;
 
case TAG_FMT_URATIONAL:
-   info_value-ur.num = 
php_ifd_get32u(value, motorola_intel);
-   info_value-ur.den = 
php_ifd_get32u(4+(char *)value, motorola_intel);
+   info_value-ur.num = 
+php_ifd_get32u(vptr, motorola_intel);
+   info_value-ur.den = 
+php_ifd_get32u(4+(char *)vptr, motorola_intel);
break;
 
case TAG_FMT_SSHORT:
-   info_value-i = php_ifd_get16s(value, 
motorola_intel);
+   info_value-i = php_ifd_get16s(vptr, 
+motorola_intel);
break;
 
case TAG_FMT_SLONG:
-   info_value-i = php_ifd_get32s(value, 
motorola_intel);
+   info_value-i = php_ifd_get32s(vptr, 
+motorola_intel);
break;
 
case TAG_FMT_SRATIONAL:
-   info_value-sr.num = 
php_ifd_get32u(value, motorola_intel);
-   info_value-sr.den = 
php_ifd_get32u(4+(char *)value, motorola_intel);
+   info_value-sr.num = 
+php_ifd_get32u(vptr, motorola_intel);
+   info_value-sr.den = 
+php_ifd_get32u(4+(char *)vptr, motorola_intel);
break;
 
case TAG_FMT_SINGLE:



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 /ext/exif exif.c

2002-11-27 Thread Derick Rethans
On Wed, 27 Nov 2002, Marcus Börger wrote:

 Would you agree adding magic_quotes_runtime support is
 new functionality or commit that also?

I see it as new functionality and the possible of breaking the releases. 
I would recommend not to merge that.

Derick

-- 

-
 Derick Rethans http://derickrethans.nl/ 
 PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
-


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/exif exif.c

2002-11-26 Thread Marcus Boerger
helly   Tue Nov 26 20:46:37 2002 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  -Add magic_quotes_runtime support
  -Fix Canon Markernote
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.120 php4/ext/exif/exif.c:1.121
--- php4/ext/exif/exif.c:1.120  Fri Nov 22 16:51:38 2002
+++ php4/ext/exif/exif.cTue Nov 26 20:46:36 2002
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.120 2002/11/22 21:51:38 iliaa Exp $ */
+/* $Id: exif.c,v 1.121 2002/11/27 01:46:36 helly Exp $ */
 
 /*  ToDos
  *
@@ -109,7 +109,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.120 2002/11/22 21:51:38 iliaa Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.121 2002/11/27 01:46:36 helly Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -924,7 +924,8 @@
 
 typedef enum mn_offset_mode_t {
MN_OFFSET_NORMAL,
-   MN_OFFSET_MARKER
+   MN_OFFSET_MARKER,
+   MN_OFFSET_GUESS
 } mn_offset_mode_t;
 
 typedef struct {
@@ -939,7 +940,8 @@
 } marker_note_type;
 
 static const marker_note_type marker_note_array[] = {
-  { tag_table_VND_CANON, Canon,   NULL,  NULL,  
 0,  0,  MN_ORDER_NORMAL,   MN_OFFSET_NORMAL},
+  { tag_table_VND_CANON, Canon,   NULL,  NULL,  
+ 0,  0,  MN_ORDER_INTEL,MN_OFFSET_GUESS},
+/*  { tag_table_VND_CANON, Canon,   NULL,  NULL,
+   0,  0,  MN_ORDER_NORMAL,   MN_OFFSET_NORMAL},*/
   { tag_table_VND_CASIO, CASIO,   NULL,  NULL,  
 0,  0,  MN_ORDER_MOTOROLA, MN_OFFSET_NORMAL},
   { tag_table_VND_FUJI,  FUJIFILM,NULL,  
FUJIFILM\x0C\x00\x00\x00, 12, 12, MN_ORDER_INTEL,MN_OFFSET_MARKER},
   { tag_table_VND_NIKON, NIKON,   NULL,  Nikon\x00\x01\x00,   
 8,  8,  MN_ORDER_NORMAL,   MN_OFFSET_NORMAL},
@@ -991,27 +993,35 @@
 /* {{{ exif_char_dump
  * Do not use! This is a debug function... */
 #ifdef EXIF_DEBUG
-static unsigned char* exif_char_dump(unsigned char * addr, int len, int hex)
+static unsigned char* exif_char_dump(unsigned char * addr, int len, int offset)
 {
-   static unsigned char buf[1024+1];
-   int c, i, p=0, n = hex ? 5 : 3;
-
-   for(i=0; ilen  p+n=sizeof(buf); i++) {
-   if (i%64==0)
-   buf[p++] = '\n';
-   c = *addr++;
-   if (hex) {
-   sprintf(buf+p, %02X , c);
-   p += 3;
-   } else {
-   if (c=32) {
-   buf[p++] = c;
+   static unsigned char buf[4096+1];
+   static unsigned char tmp[20];
+   int c, i, p=0, n = 5+31;
+
+   p += sprintf(buf+p, \nDump Len: %08X (%d), len, len);
+   if (len) {
+   for(i=0; ilen+15  p+n=sizeof(buf); i++) {
+   if (i%16==0) {
+   p += sprintf(buf+p, \n%08X: , i+offset);
+   }
+   if (ilen) {
+   c = *addr++;
+   p += sprintf(buf+p, %02X , c);
+   tmp[i%16] = c=32 ? c : '.';
+   tmp[(i%16)+1] = '\0';
} else {
-   buf[p++] = '?';
+   p += sprintf(buf+p,);
+   }
+   if (i%16==15) {
+   p += sprintf(buf+p, %s, tmp);
+   if (i=len) {
+   break;
+   }
}
}
}
-   buf[sizeof(buf)-1]=0;
+   buf[sizeof(buf)-1] = '\0';
return buf;
 }
 #endif
@@ -1556,8 +1566,12 @@
case TAG_FMT_STRING:
if (value) {
length = php_strnlen(value, length);
+   if (PG(magic_quotes_runtime)) {
+   info_data-value.s = php_addslashes(value, 
+length, length, 0 TSRMLS_CC);
+   } else {
+   info_value-s = estrndup(value, length);
+   }
info_data-length = length;
-   info_value-s = estrndup(value, length);
} else {
info_data-length = 0;
info_value-s = estrdup();
@@ -1565,7 +1579,7 @@
if (!info_value-s) {
EXIF_ERRLOG_EALLOC
info_data-length = 0;
-   break; /* better return with  instead of possible 
casing problems */
+   break; /* better return with  

[PHP-CVS] cvs: php4 /ext/exif exif.c

2002-11-26 Thread Marcus Boerger
helly   Tue Nov 26 21:28:29 2002 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  -Forgot to correct length
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.121 php4/ext/exif/exif.c:1.122
--- php4/ext/exif/exif.c:1.121  Tue Nov 26 20:46:36 2002
+++ php4/ext/exif/exif.cTue Nov 26 21:28:29 2002
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.121 2002/11/27 01:46:36 helly Exp $ */
+/* $Id: exif.c,v 1.122 2002/11/27 02:28:29 helly Exp $ */
 
 /*  ToDos
  *
@@ -109,7 +109,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.121 2002/11/27 01:46:36 helly Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.122 2002/11/27 02:28:29 helly Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -1806,6 +1806,7 @@
exif_error_docref(NULL TSRMLS_CC, image_info, E_NOTICE, 
Adding %s as buffer%s, name, exif_char_dump(value, length, 0));
 #endif
info_data-value.s = php_addslashes(value, length, length, 0 
TSRMLS_CC);
+   info_data-length = length;
} else {
info_data-value.s = emalloc(length+1);
if (!info_data-value.s) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/exif exif.c

2002-11-26 Thread Marcus Boerger
helly   Tue Nov 26 21:42:41 2002 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  -Code completley rewritten
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.122 php4/ext/exif/exif.c:1.123
--- php4/ext/exif/exif.c:1.122  Tue Nov 26 21:28:29 2002
+++ php4/ext/exif/exif.cTue Nov 26 21:42:41 2002
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.122 2002/11/27 02:28:29 helly Exp $ */
+/* $Id: exif.c,v 1.123 2002/11/27 02:42:41 helly Exp $ */
 
 /*  ToDos
  *
@@ -33,26 +33,6 @@
  *  attacker could generate an image with recursive ifd pointers...(Marcus)
  */
 
-/* Fragments of the code in this module were borrowed from the public domain
- * jhead.c package with the author's consent.
- *
- *  The original header from the jhead.c file was:
- *
- * --
- *  Program to pull the information out of various types of EFIF digital
- *  camera files and show it in a reasonably consistent way
- *
- *  Version 0.9
- *
- *  Compiles with MSVC on Windows, or with GCC on Linux
- *
- *  Compileing under linux: Must include math library.
- *  Use: cc -lm -O3 -o jhead jhead.c
- *
- *  Matthias Wandel,  Dec 1999 - April 2000
- * --
- */
-
 #ifdef HAVE_CONFIG_H
 #include config.h
 #endif
@@ -109,7 +89,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.122 2002/11/27 02:28:29 helly Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.123 2002/11/27 02:42:41 helly Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 /ext/exif exif.c

2002-11-26 Thread Marcus Börger
Thats waht i thought, too.

At 04:03 27.11.2002, Jani Taskinen wrote:


Any added code that does not fix any bugs are
not supposed to be MFH'd.

--Jani


On Wed, 27 Nov 2002, Marcus Börger wrote:

Would you agree adding magic_quotes_runtime support is
new functionality or commit that also?

marcus

AAt 02:46 27.11.2002, Marcus Boerger wrote:
helly   Tue Nov 26 20:46:37 2002 EDT

   Modified files:
 /php4/ext/exif  exif.c
   Log:
   -Add magic_quotes_runtime support
   -Fix Canon Markernote


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
- For Sale! -



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/exif exif.c

2002-11-22 Thread Ilia Alshanetsky
iliaa   Fri Nov 22 16:51:38 2002 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  Fixed bug #20560.
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.119 php4/ext/exif/exif.c:1.120
--- php4/ext/exif/exif.c:1.119  Thu Nov 14 16:43:00 2002
+++ php4/ext/exif/exif.cFri Nov 22 16:51:38 2002
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.119 2002/11/14 21:43:00 helly Exp $ */
+/* $Id: exif.c,v 1.120 2002/11/22 21:51:38 iliaa Exp $ */
 
 /*  ToDos
  *
@@ -109,7 +109,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.119 2002/11/14 21:43:00 helly Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.120 2002/11/22 21:51:38 iliaa Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -3971,7 +3971,7 @@
add_assoc_image_info(return_value, sub_arrays, ImageInfo, SECTION_ANY_TAG
TSRMLS_CC);
add_assoc_image_info(return_value, sub_arrays, ImageInfo, SECTION_IFD0   
TSRMLS_CC);
add_assoc_image_info(return_value, 1,  ImageInfo, SECTION_THUMBNAIL  
TSRMLS_CC);
-   add_assoc_image_info(return_value, sub_arrays, ImageInfo, SECTION_COMMENT
TSRMLS_CC);
+   add_assoc_image_info(return_value, 1,  ImageInfo, SECTION_COMMENT
+TSRMLS_CC);
add_assoc_image_info(return_value, sub_arrays, ImageInfo, SECTION_EXIF   
TSRMLS_CC);
add_assoc_image_info(return_value, sub_arrays, ImageInfo, SECTION_GPS
TSRMLS_CC);
add_assoc_image_info(return_value, sub_arrays, ImageInfo, SECTION_INTEROP
TSRMLS_CC);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/exif exif.c /ext/exif/tests 005.phpt test5.jpg

2002-10-19 Thread Marcus Börger
helly   Sat Oct 19 05:52:00 2002 EDT

  Added files: 
/php4/ext/exif/tests005.phpt test5.jpg 

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  Allow ifd start at offset other than 0007h and provide testcase.
  #Now we can read images modified by Exifer.
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.116 php4/ext/exif/exif.c:1.117
--- php4/ext/exif/exif.c:1.116  Thu Oct  3 06:44:13 2002
+++ php4/ext/exif/exif.cSat Oct 19 05:52:00 2002
 -17,7 +17,7 
+--+
  */
 
-/* $Id: exif.c,v 1.116 2002/10/03 10:44:13 helly Exp $ */
+/* $Id: exif.c,v 1.117 2002/10/19 09:52:00 helly Exp $ */
 
 /*  ToDos
  *
 -109,7 +109,7 
 };
 /* }}} */
 
-#define EXIF_VERSION 1.4 $Id: exif.c,v 1.116 2002/10/03 10:44:13 helly Exp $
+#define EXIF_VERSION 1.4 $Id: exif.c,v 1.117 2002/10/19 09:52:00 helly Exp $
 
 /* {{{ PHP_MINFO_FUNCTION
  */
 -3078,6 +3078,8 
 */
 static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf, 
size_t length, size_t displacement TSRMLS_DC)
 {
+   unsigned exif_value_2a, offset_of_ifd;
+
/* set the thumbnail stuff to nothing so we can test to see if they get set up 
*/
if (memcmp(CharBuf, II, 2) == 0) {
ImageInfo-motorola_intel = 0;
 -3089,16 +3091,16 
}
 
/* Check the next two values for correctness. */
-   if (php_ifd_get16u(CharBuf+2, ImageInfo-motorola_intel) != 0x2a
- || php_ifd_get32u(CharBuf+4, ImageInfo-motorola_intel) != 0x08
-   ) {
+   exif_value_2a = php_ifd_get16u(CharBuf+2, ImageInfo-motorola_intel);
+   offset_of_ifd = php_ifd_get32u(CharBuf+4, ImageInfo-motorola_intel);
+   if ( exif_value_2a != 0x2a || offset_of_ifd  0x08) {
exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_WARNING, invalid TIFF 
start (1));
return;
}
 
ImageInfo-sections_found |= FOUND_IFD0;
/* First directory starts at offset 8. Offsets starts at 0. */
-   exif_process_IFD_in_JPEG(ImageInfo, CharBuf+8, CharBuf, length/*-14*/, 
displacement, SECTION_IFD0 TSRMLS_CC);
+   exif_process_IFD_in_JPEG(ImageInfo, CharBuf+offset_of_ifd, CharBuf, 
+length/*-14*/, displacement, SECTION_IFD0 TSRMLS_CC);
 
 #ifdef EXIF_DEBUG
exif_error_docref(NULL TSRMLS_CC, ImageInfo, E_NOTICE, process TIFF in JPEG 
done);

Index: php4/ext/exif/tests/005.phpt
+++ php4/ext/exif/tests/005.phpt
--TEST--
Check for exif_read_data, unusual IFD start
--SKIPIF--
?php if (!extension_loaded(exif)) print skip;?
--FILE--
?php
/*
  test5.jpg is a 1*1 image that contain an Exif section with ifd start at 0009h
*/
$image  = exif_read_data('./ext/exif/tests/test5.jpg','',true,false);
var_dump($image['IFD0']);
?
--EXPECT--
array(2) {
  [ImageDescription]=
  string(11) Ifd0009
  [DateTime]=
  string(19) 2002:10:18 20:06:00
}


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php