aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/bzip2/lib/bzlib_stdio_private.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/bzip2/lib/bzlib_stdio_private.h')
-rw-r--r--src/cmd/bzip2/lib/bzlib_stdio_private.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/cmd/bzip2/lib/bzlib_stdio_private.h b/src/cmd/bzip2/lib/bzlib_stdio_private.h
new file mode 100644
index 00000000..24b31144
--- /dev/null
+++ b/src/cmd/bzip2/lib/bzlib_stdio_private.h
@@ -0,0 +1,69 @@
+/*
+ * THIS FILE IS NOT IDENTICAL TO THE ORIGINAL
+ * FROM THE BZIP2 DISTRIBUTION.
+ *
+ * It has been modified, mainly to break the library
+ * into smaller pieces.
+ *
+ * Russ Cox
+ * rsc@plan9.bell-labs.com
+ * July 2000
+ */
+
+extern void BZ2_bz__AssertH__fail ( int errcode );
+
+/* undo definitions in bzlib_private.h */
+#undef AssertH
+#undef AssertD
+#undef VPrintf0
+#undef VPrintf1
+#undef VPrintf2
+#undef VPrintf3
+#undef VPrintf4
+#undef VPrintf5
+
+#define AssertH(cond,errcode) \
+ { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); }
+#if BZ_DEBUG
+#define AssertD(cond,msg) \
+ { if (!(cond)) { \
+ fprintf ( stderr, \
+ "\n\nlibbzip2(debug build): internal error\n\t%s\n", msg );\
+ exit(1); \
+ }}
+#else
+#define AssertD(cond,msg) /* */
+#endif
+#define VPrintf0(zf) \
+ fprintf(stderr,zf)
+#define VPrintf1(zf,za1) \
+ fprintf(stderr,zf,za1)
+#define VPrintf2(zf,za1,za2) \
+ fprintf(stderr,zf,za1,za2)
+#define VPrintf3(zf,za1,za2,za3) \
+ fprintf(stderr,zf,za1,za2,za3)
+#define VPrintf4(zf,za1,za2,za3,za4) \
+ fprintf(stderr,zf,za1,za2,za3,za4)
+#define VPrintf5(zf,za1,za2,za3,za4,za5) \
+ fprintf(stderr,zf,za1,za2,za3,za4,za5)
+
+#define BZ_SETERR(eee) \
+{ \
+ if (bzerror != NULL) *bzerror = eee; \
+ if (bzf != NULL) bzf->lastErr = eee; \
+}
+
+typedef
+ struct {
+ FILE* handle;
+ Char buf[BZ_MAX_UNUSED];
+ Int32 bufN;
+ Bool writing;
+ bz_stream strm;
+ Int32 lastErr;
+ Bool initialisedOk;
+ }
+ bzFile;
+
+extern Bool bz_feof( FILE* );
+