summaryrefslogtreecommitdiff
path: root/components/external
diff options
context:
space:
mode:
Diffstat (limited to 'components/external')
-rw-r--r--components/external/libpng/pngconf.h6
-rw-r--r--components/external/libz/zutil.c21
2 files changed, 24 insertions, 3 deletions
diff --git a/components/external/libpng/pngconf.h b/components/external/libpng/pngconf.h
index 0cc2fc3551..047376302d 100644
--- a/components/external/libpng/pngconf.h
+++ b/components/external/libpng/pngconf.h
@@ -22,13 +22,13 @@
#ifdef __RT_THREAD__
#include <rtthread.h>
#define PNG_MAX_MALLOC_64K
+#define PNG_NO_STDIO
#ifndef RT_USING_NEWLIB
#define PNG_NO_WRITE_SUPPORTED
-#define PNG_NO_STDIO
#define PNG_NO_SETJMP_SUPPORTED
-#define malloc rtgui_malloc
-#define free rtgui_free
+#define malloc rtgui_malloc
+#define free rtgui_free
#endif
#endif
diff --git a/components/external/libz/zutil.c b/components/external/libz/zutil.c
index 19d2760e6c..16e9ac962e 100644
--- a/components/external/libz/zutil.c
+++ b/components/external/libz/zutil.c
@@ -291,6 +291,7 @@ void zcfree (voidpf opaque, voidpf ptr)
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
+#ifdef RT_USING_RTGUI
extern voidp rtgui_malloc OF((uInt size));
extern voidp rtgui_calloc OF((uInt items, uInt size));
extern void rtgui_free OF((voidpf ptr));
@@ -312,5 +313,25 @@ void zcfree (opaque, ptr)
rtgui_free(ptr);
if (opaque) return; /* make compiler happy */
}
+#else
+voidpf zcalloc (opaque, items, size)
+ voidpf opaque;
+ unsigned items;
+ unsigned size;
+{
+ if (opaque) items += size - size; /* make compiler happy */
+ return sizeof(uInt) > 2 ? (voidpf)rt_malloc(items * size) :
+ (voidpf)rt_calloc(items, size);
+}
+
+void zcfree (opaque, ptr)
+ voidpf opaque;
+ voidpf ptr;
+{
+ rt_free(ptr);
+ if (opaque) return; /* make compiler happy */
+}
+
+#endif
#endif /* MY_ZCALLOC */