Matthias,

The attached .patch file for xpwn fixes the build to work with libpng16. This allows xpwn to build and link against it successfully. The CMakeLists.txt chunk is the existing patch.

Hanspeter

--
Hanspeter Niederstrasser
hanspeter AT snaggledworks DOT com

diff -Nurd -x'*~' posixninja-xpwn-7609d82.orig/ipsw-patch/CMakeLists.txt 
posixninja-xpwn-7609d82/ipsw-patch/CMakeLists.txt
--- posixninja-xpwn-7609d82.orig/ipsw-patch/CMakeLists.txt      2010-05-07 
12:09:49.000000000 -0400
+++ posixninja-xpwn-7609d82/ipsw-patch/CMakeLists.txt   2013-08-05 
16:58:54.000000000 -0400
@@ -1,3 +1,8 @@
+include_directories(${PROJECT_SOURCE_DIR}/minizip)
+link_directories(${PROJECT_BINARY_DIR}/minizip)
+
+link_directories(${PROJECT_BINARY_DIR}/common ${PROJECT_BINARY_DIR}/hfs 
${PROJECT_BINARY_DIR}/dmg)
+
 INCLUDE(FindZLIB)
 INCLUDE(FindBZip2)
 INCLUDE(FindPNG)
@@ -37,11 +42,6 @@
 include_directories(${PNG_INCLUDE_DIR})
 link_directories(${PNG_LIBRARIES})
 
-include_directories(${PROJECT_SOURCE_DIR}/minizip)
-link_directories(${PROJECT_BINARY_DIR}/minizip)
-
-link_directories(${PROJECT_BINARY_DIR}/common ${PROJECT_BINARY_DIR}/hfs 
${PROJECT_BINARY_DIR}/dmg)
-
 IF(HAVE_HW_CRYPTO)
        add_definitions(-DHAVE_HW_CRYPTO)
 ENDIF(HAVE_HW_CRYPTO)
--- a/ipsw-patch/ibootim.c      2013-08-11 10:17:08.000000000 -0400
+++ b/ipsw-patch/ibootim.c      2013-08-11 10:36:10.000000000 -0400
@@ -255,9 +255,11 @@
        uint8_t *imageBuffer = malloc(imageFile->getLength(imageFile));
        imageFile->read(imageFile, imageBuffer, 
imageFile->getLength(imageFile));
 
+       png_uint_32 height = png_get_image_height(png_ptr, info_ptr);
+
        png_bytepp row_pointers = (png_bytepp) malloc(sizeof(png_bytep) * 
info->header.height);
        int i;
-       for(i = 0; i < info_ptr->height; i++) {
+       for(i = 0; i < height; i++) {
                row_pointers[i] = imageBuffer + (info->header.width * 
bytes_per_pixel * i);
        }
 
@@ -274,7 +276,24 @@
        AbstractFile* imageFile;
        unsigned char header[8];
        InfoIBootIM* info;
+       png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 
NULL, pngError, pngWarn);
+       if (!png_ptr) {
+               return NULL;
+       }
+
+       png_infop info_ptr = png_create_info_struct(png_ptr);
+       if (!info_ptr)
+       {
+               png_destroy_read_struct(&png_ptr, (png_infopp)NULL, 
(png_infopp)NULL);
+               return NULL;
+       }
        png_uint_32 i;
+       png_byte bit_depth = png_get_bit_depth(png_ptr, info_ptr);
+       png_byte color_type = png_get_color_type(png_ptr, info_ptr);
+       png_uint_32 height = png_get_image_height(png_ptr, info_ptr);
+       png_uint_32 width = png_get_image_width(png_ptr, info_ptr);
+       png_uint_32 rowbytes = png_get_rowbytes(png_ptr, info_ptr);
+
        png_bytepp row_pointers;
        
        uint8_t* imageBuffer;
@@ -287,18 +306,6 @@
        }
        png->seek(png, 0);
 
-       png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 
NULL, pngError, pngWarn);
-       if (!png_ptr) {
-               return NULL;
-       }
-
-       png_infop info_ptr = png_create_info_struct(png_ptr);
-       if (!info_ptr)
-       {
-               png_destroy_read_struct(&png_ptr, (png_infopp)NULL, 
(png_infopp)NULL);
-               return NULL;
-       }
-
        png_infop end_info = png_create_info_struct(png_ptr);
        if (!end_info)
        {
@@ -318,15 +325,15 @@
 
        png_read_info(png_ptr, info_ptr);
        
-       if(info_ptr->bit_depth > 8) {
-               XLOG(0, "warning: bit depth per channel is greater than 8 (%d). 
Attempting to strip, but image quality will be degraded.\n", 
info_ptr->bit_depth);
+       if(bit_depth > 8) {
+               XLOG(0, "warning: bit depth per channel is greater than 8 (%d). 
Attempting to strip, but image quality will be degraded.\n", bit_depth);
        }
        
-       if(info_ptr->color_type == PNG_COLOR_TYPE_GRAY || info_ptr->color_type 
== PNG_COLOR_TYPE_RGB) {
+       if(color_type == PNG_COLOR_TYPE_GRAY || color_type == 
PNG_COLOR_TYPE_RGB) {
                XLOG(0, "notice: attempting to add dummy transparency 
channel\n");
        }
        
-       if(info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
+       if(color_type == PNG_COLOR_TYPE_PALETTE) {
                XLOG(0, "notice: attempting to expand palette into full rgb\n");
        }
        
@@ -339,24 +346,24 @@
        png_read_update_info(png_ptr, info_ptr);
        
 
-       if(info_ptr->width > 320 || info_ptr->height > 480) {
-               XLOG(0, "error: dimensions out of range, must be within 
320x480, not %lux%lu\n", info_ptr->width, info_ptr->height);
+       if(width > 320 || height > 480) {
+               XLOG(0, "error: dimensions out of range, must be within 
320x480, not %lux%lu\n", width, height);
                png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
                return NULL;
        }
 
-       if(info_ptr->bit_depth != 8) {
-               XLOG(0, "error: bit depth per channel must be 8 not %d!\n", 
info_ptr->bit_depth);
+       if(bit_depth != 8) {
+               XLOG(0, "error: bit depth per channel must be 8 not %d!\n", 
bit_depth);
                png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
                return NULL;
        }
 
-       if(info_ptr->color_type != PNG_COLOR_TYPE_GRAY_ALPHA && 
info_ptr->color_type != PNG_COLOR_TYPE_RGB_ALPHA) {
+       if(color_type != PNG_COLOR_TYPE_GRAY_ALPHA && color_type != 
PNG_COLOR_TYPE_RGB_ALPHA) {
                XLOG(0, "error: incorrect color type, must be greyscale with 
alpha, or rgb with alpha\n");
-               if(info_ptr->color_type == PNG_COLOR_TYPE_GRAY || 
info_ptr->color_type == PNG_COLOR_TYPE_RGB) {
+               if(color_type == PNG_COLOR_TYPE_GRAY || color_type == 
PNG_COLOR_TYPE_RGB) {
                        XLOG(0, "It appears you're missing an alpha channel. 
Add transparency to your image\n");
                }
-               if(info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
+               if(color_type == PNG_COLOR_TYPE_PALETTE) {
                        XLOG(0, "This PNG is saved with the palette color type 
rather than ARGB.\n");
                }
                png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
@@ -364,10 +371,10 @@
                return NULL;
        }
 
-       row_pointers = (png_bytepp) malloc(sizeof(png_bytep) * 
info_ptr->height);
-       imageBuffer = malloc(info_ptr->height * info_ptr->rowbytes);
-       for(i = 0; i < info_ptr->height; i++) {
-               row_pointers[i] = imageBuffer + (info_ptr->rowbytes * i);
+       row_pointers = (png_bytepp) malloc(sizeof(png_bytep) * height);
+       imageBuffer = malloc(height * rowbytes);
+       for(i = 0; i < height; i++) {
+               row_pointers[i] = imageBuffer + (rowbytes * i);
        }
 
        png_read_image(png_ptr, row_pointers);
@@ -383,15 +390,15 @@
        }
        info = (InfoIBootIM*) (imageFile->data);
        
-       info->header.width = (uint16_t) info_ptr->width;
-       info->header.height = (uint16_t) info_ptr->height;
-       if(info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
+       info->header.width = (uint16_t) width;
+       info->header.height = (uint16_t) height;
+       if(color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
                info->header.format = IBOOTIM_GREY;
        } else {
                info->header.format = IBOOTIM_ARGB;
        }
        
-       imageFile->write(imageFile, imageBuffer, info_ptr->height * 
info_ptr->rowbytes);
+       imageFile->write(imageFile, imageBuffer, height * rowbytes);
        
        imageFile->close(imageFile);
 
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Fink-devel mailing list
Fink-devel@lists.sourceforge.net
List archive:
http://news.gmane.org/gmane.os.apple.fink.devel
Subscription management:
https://lists.sourceforge.net/lists/listinfo/fink-devel

Reply via email to