summaryrefslogtreecommitdiffstats
path: root/lib/zlib/zutil.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-04-08 12:23:30 +0000
committerWolfgang Denk <wd@denx.de>2011-04-30 20:21:45 +0200
commite89516f031dbf711b71e6ee4d131cdc8b9946fb0 (patch)
treecb36d506165e971849cc1237565798fcc236af0b /lib/zlib/zutil.c
parent56c1769806a437c994355422f5b52ca3eee70834 (diff)
downloadtalos-obmc-uboot-e89516f031dbf711b71e6ee4d131cdc8b9946fb0.tar.gz
talos-obmc-uboot-e89516f031dbf711b71e6ee4d131cdc8b9946fb0.zip
zlib: split up to match original source tree
While looking to upgrade to zlib-1.2.5, the current mondo merge of multiple files into a single was making things way more difficult than it should have been. Hard to pick out what has been changed to port it to U-Boot, been removed as useless, and bug fixes added after the fact. So split the single file up into the original file names, and merge non-essential changes back from the original tree (for some reason, style in code in a bunch of places was changed to U-Boot style even though this isn't "U-Boot" code). The original build style is retained -- we have a single zlib.c that includes all the other files, and that is the only file we compile. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'lib/zlib/zutil.c')
-rw-r--r--lib/zlib/zutil.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/lib/zlib/zutil.c b/lib/zlib/zutil.c
new file mode 100644
index 0000000000..65f9554747
--- /dev/null
+++ b/lib/zlib/zutil.c
@@ -0,0 +1,73 @@
+/* zutil.c -- target dependent utility functions for the compression library
+ * Copyright (C) 1995-2005 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id$ */
+
+#include "zutil.h"
+
+#ifndef NO_DUMMY_DECL
+struct internal_state {int dummy;}; /* for buggy compilers */
+#endif
+
+const char * const z_errmsg[10] = {
+"need dictionary", /* Z_NEED_DICT 2 */
+"stream end", /* Z_STREAM_END 1 */
+"", /* Z_OK 0 */
+"file error", /* Z_ERRNO (-1) */
+"stream error", /* Z_STREAM_ERROR (-2) */
+"data error", /* Z_DATA_ERROR (-3) */
+"insufficient memory", /* Z_MEM_ERROR (-4) */
+"buffer error", /* Z_BUF_ERROR (-5) */
+"incompatible version",/* Z_VERSION_ERROR (-6) */
+""};
+
+#ifdef DEBUG
+
+#ifndef verbose
+#define verbose 0
+#endif
+int z_verbose = verbose;
+
+void z_error (m)
+ char *m;
+{
+ fprintf(stderr, "%s\n", m);
+ hang ();
+}
+#endif
+
+/* exported to allow conversion of error code to string for compress() and
+ * uncompress()
+ */
+#ifndef MY_ZCALLOC /* Any system without a special alloc function */
+
+#ifndef STDC
+extern voidp malloc OF((uInt size));
+extern voidp calloc OF((uInt items, uInt size));
+extern void free OF((voidpf ptr));
+#endif
+
+voidpf zcalloc (opaque, items, size)
+ voidpf opaque;
+ unsigned items;
+ unsigned size;
+{
+ if (opaque)
+ items += size - size; /* make compiler happy */
+ return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
+ (voidpf)calloc(items, size);
+}
+
+void zcfree (opaque, ptr, nb)
+ voidpf opaque;
+ voidpf ptr;
+ unsigned nb;
+{
+ free(ptr);
+ if (opaque)
+ return; /* make compiler happy */
+}
+
+#endif /* MY_ZCALLOC */
OpenPOWER on IntegriCloud