Reconcile with gingerbread-release gingerbread-mr4-release
Change-Id: Ib4073e5060f6e9981a31ad5671a21bd930f403f4
diff --git a/Android.mk b/Android.mk
index 2a6eb43..4e92908 100644
--- a/Android.mk
+++ b/Android.mk
@@ -22,9 +22,18 @@
pngwtran.c \
pngwutil.c
-common_CFLAGS := ## -fomit-frame-pointer
+common_CFLAGS := -fvisibility=hidden ## -fomit-frame-pointer
-common_C_INCLUDES += \
+ifeq ($(HOST_OS),windows)
+ ifeq ($(USE_MINGW),)
+ # Case where we're building windows but not under linux (so it must be cygwin)
+ # In this case, gcc cygwin doesn't recognize -fvisibility=hidden
+ $(info libpng: Ignoring gcc flag $(common_CFLAGS) on Cygwin)
+ common_CFLAGS :=
+ endif
+endif
+
+common_C_INCLUDES +=
common_COPY_HEADERS_TO := libpng
common_COPY_HEADERS := png.h pngconf.h pngusr.h
diff --git a/pngconf.h b/pngconf.h
index 82c6008..219b42e 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1509,7 +1509,11 @@
# define PNGAPI
#endif
#ifndef PNG_IMPEXP
-# define PNG_IMPEXP
+# if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33)
+# define PNG_IMPEXP __attribute__((visibility ("default")))
+# else
+# define PNG_IMPEXP
+# endif
#endif
#ifdef PNG_BUILDSYMS
diff --git a/pngread.c b/pngread.c
index fc4788b..b301d41 100644
--- a/pngread.c
+++ b/pngread.c
@@ -776,13 +776,18 @@
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
break;
}
- if (ret != Z_OK)
+ if (ret != Z_OK) {
#ifdef PNG_INDEX_SUPPORTED
- if (png_ptr->index && png_ptr->row_number != png_ptr->height - 1)
+ if (png_ptr->index) {
+ if (png_ptr->row_number != png_ptr->height - 1) {
+ png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg :
+ "Decompression error");
+ }
+ } else
#endif
png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg :
- "Decompression error");
-
+ "Decompression error");
+ }
} while (png_ptr->zstream.avail_out);
png_ptr->row_info.color_type = png_ptr->color_type;