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.0 -0400
+++ posixninja-xpwn-7609d82/ipsw-patch/CMakeLists.txt 2013-08-05
16:58:54.0 -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.0 -0400
+++ b/ipsw-patch/ibootim.c 2013-08-11 10:36:10.0 -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_dep