cellog          Sun Feb 15 19:22:42 2009 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/phar   zip.c 
  Log:
  fix getting/setting of all 16/32 values in zip
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/zip.c?r1=1.47.2.25&r2=1.47.2.26&diff_format=u
Index: php-src/ext/phar/zip.c
diff -u php-src/ext/phar/zip.c:1.47.2.25 php-src/ext/phar/zip.c:1.47.2.26
--- php-src/ext/phar/zip.c:1.47.2.25    Wed Dec 31 11:15:42 2008
+++ php-src/ext/phar/zip.c      Sun Feb 15 19:22:42 2009
@@ -19,12 +19,19 @@
 #include "phar_internal.h"
 
 #ifdef WORDS_BIGENDIAN
-# define PHAR_GET_32(buffer) (((((unsigned char*)(buffer))[3]) << 24) \
-               | ((((unsigned char*)(buffer))[2]) << 16) \
-               | ((((unsigned char*)(buffer))[1]) <<  8) \
-               | (((unsigned char*)(buffer))[0]))
-# define PHAR_GET_16(buffer) (((((unsigned char*)(buffer))[1]) <<  8) \
-               | (((unsigned char*)(buffer))[0]))
+static inline php_uint32 phar_fix_32(php_uint32 buffer)
+{
+       return ((((unsigned char *)&buffer)[3]) << 24) |
+               ((((unsigned char *)&buffer)[2]) << 16) |
+               ((((unsigned char *)&buffer)[1]) << 8) |
+               (((unsigned char *)&buffer)[0]);
+}
+static inline php_uint16 phar_fix_16(php_uint16 buffer)
+{
+       return ((((unsigned char *)&buffer)[1]) << 8) | ((unsigned char 
*)&buffer)[0];
+}
+# define PHAR_GET_32(buffer) phar_fix_32((php_uint32)(buffer))
+# define PHAR_GET_16(buffer) phar_fix_16((php_uint16)(buffer))
 # define PHAR_SET_32(buffer) PHAR_GET_32(buffer)
 # define PHAR_SET_16(buffer) PHAR_GET_16(buffer)
 #else
@@ -687,7 +694,6 @@
        php_uint32 newcrc32;
        off_t offset;
        int not_really_modified = 0;
-
        entry = (phar_entry_info *)data;
        p = (struct _phar_zip_pass*) arg;
 



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

Reply via email to