r91718 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91717‎ | r91718 | r91719 >
Date:08:00, 8 July 2011
Author:ariel
Status:deferred
Tags:
Comment:
add bzlib.h plus document that, since it's a different license; also fix makefile install issues
Modified paths:
  • /branches/ariel/xmldumps-backup/mwbzutils/Makefile (modified) (history)
  • /branches/ariel/xmldumps-backup/mwbzutils/README (modified) (history)
  • /branches/ariel/xmldumps-backup/mwbzutils/bzlib.h (added) (history)

Diff [purge]

Index: branches/ariel/xmldumps-backup/mwbzutils/bzlib.h
@@ -0,0 +1,282 @@
 2+
 3+/*-------------------------------------------------------------*/
 4+/*--- Public header file for the library. ---*/
 5+/*--- bzlib.h ---*/
 6+/*-------------------------------------------------------------*/
 7+
 8+/* ------------------------------------------------------------------
 9+ This file is part of bzip2/libbzip2, a program and library for
 10+ lossless, block-sorting data compression.
 11+
 12+ bzip2/libbzip2 version 1.0.6 of 6 September 2010
 13+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
 14+
 15+ Please read the WARNING, DISCLAIMER and PATENTS sections in the
 16+ README file.
 17+
 18+ This program is released under the terms of the license contained
 19+ in the file LICENSE.
 20+ ------------------------------------------------------------------ */
 21+
 22+
 23+#ifndef _BZLIB_H
 24+#define _BZLIB_H
 25+
 26+#ifdef __cplusplus
 27+extern "C" {
 28+#endif
 29+
 30+#define BZ_RUN 0
 31+#define BZ_FLUSH 1
 32+#define BZ_FINISH 2
 33+
 34+#define BZ_OK 0
 35+#define BZ_RUN_OK 1
 36+#define BZ_FLUSH_OK 2
 37+#define BZ_FINISH_OK 3
 38+#define BZ_STREAM_END 4
 39+#define BZ_SEQUENCE_ERROR (-1)
 40+#define BZ_PARAM_ERROR (-2)
 41+#define BZ_MEM_ERROR (-3)
 42+#define BZ_DATA_ERROR (-4)
 43+#define BZ_DATA_ERROR_MAGIC (-5)
 44+#define BZ_IO_ERROR (-6)
 45+#define BZ_UNEXPECTED_EOF (-7)
 46+#define BZ_OUTBUFF_FULL (-8)
 47+#define BZ_CONFIG_ERROR (-9)
 48+
 49+typedef
 50+ struct {
 51+ char *next_in;
 52+ unsigned int avail_in;
 53+ unsigned int total_in_lo32;
 54+ unsigned int total_in_hi32;
 55+
 56+ char *next_out;
 57+ unsigned int avail_out;
 58+ unsigned int total_out_lo32;
 59+ unsigned int total_out_hi32;
 60+
 61+ void *state;
 62+
 63+ void *(*bzalloc)(void *,int,int);
 64+ void (*bzfree)(void *,void *);
 65+ void *opaque;
 66+ }
 67+ bz_stream;
 68+
 69+
 70+#ifndef BZ_IMPORT
 71+#define BZ_EXPORT
 72+#endif
 73+
 74+#ifndef BZ_NO_STDIO
 75+/* Need a definitition for FILE */
 76+#include <stdio.h>
 77+#endif
 78+
 79+#ifdef _WIN32
 80+# include <windows.h>
 81+# ifdef small
 82+ /* windows.h define small to char */
 83+# undef small
 84+# endif
 85+# ifdef BZ_EXPORT
 86+# define BZ_API(func) WINAPI func
 87+# define BZ_EXTERN extern
 88+# else
 89+ /* import windows dll dynamically */
 90+# define BZ_API(func) (WINAPI * func)
 91+# define BZ_EXTERN
 92+# endif
 93+#else
 94+# define BZ_API(func) func
 95+# define BZ_EXTERN extern
 96+#endif
 97+
 98+
 99+/*-- Core (low-level) library functions --*/
 100+
 101+BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
 102+ bz_stream* strm,
 103+ int blockSize100k,
 104+ int verbosity,
 105+ int workFactor
 106+ );
 107+
 108+BZ_EXTERN int BZ_API(BZ2_bzCompress) (
 109+ bz_stream* strm,
 110+ int action
 111+ );
 112+
 113+BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
 114+ bz_stream* strm
 115+ );
 116+
 117+BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
 118+ bz_stream *strm,
 119+ int verbosity,
 120+ int small
 121+ );
 122+
 123+BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
 124+ bz_stream* strm
 125+ );
 126+
 127+BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
 128+ bz_stream *strm
 129+ );
 130+
 131+
 132+
 133+/*-- High(er) level library functions --*/
 134+
 135+#ifndef BZ_NO_STDIO
 136+#define BZ_MAX_UNUSED 5000
 137+
 138+typedef void BZFILE;
 139+
 140+BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
 141+ int* bzerror,
 142+ FILE* f,
 143+ int verbosity,
 144+ int small,
 145+ void* unused,
 146+ int nUnused
 147+ );
 148+
 149+BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
 150+ int* bzerror,
 151+ BZFILE* b
 152+ );
 153+
 154+BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
 155+ int* bzerror,
 156+ BZFILE* b,
 157+ void** unused,
 158+ int* nUnused
 159+ );
 160+
 161+BZ_EXTERN int BZ_API(BZ2_bzRead) (
 162+ int* bzerror,
 163+ BZFILE* b,
 164+ void* buf,
 165+ int len
 166+ );
 167+
 168+BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
 169+ int* bzerror,
 170+ FILE* f,
 171+ int blockSize100k,
 172+ int verbosity,
 173+ int workFactor
 174+ );
 175+
 176+BZ_EXTERN void BZ_API(BZ2_bzWrite) (
 177+ int* bzerror,
 178+ BZFILE* b,
 179+ void* buf,
 180+ int len
 181+ );
 182+
 183+BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
 184+ int* bzerror,
 185+ BZFILE* b,
 186+ int abandon,
 187+ unsigned int* nbytes_in,
 188+ unsigned int* nbytes_out
 189+ );
 190+
 191+BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
 192+ int* bzerror,
 193+ BZFILE* b,
 194+ int abandon,
 195+ unsigned int* nbytes_in_lo32,
 196+ unsigned int* nbytes_in_hi32,
 197+ unsigned int* nbytes_out_lo32,
 198+ unsigned int* nbytes_out_hi32
 199+ );
 200+#endif
 201+
 202+
 203+/*-- Utility functions --*/
 204+
 205+BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
 206+ char* dest,
 207+ unsigned int* destLen,
 208+ char* source,
 209+ unsigned int sourceLen,
 210+ int blockSize100k,
 211+ int verbosity,
 212+ int workFactor
 213+ );
 214+
 215+BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
 216+ char* dest,
 217+ unsigned int* destLen,
 218+ char* source,
 219+ unsigned int sourceLen,
 220+ int small,
 221+ int verbosity
 222+ );
 223+
 224+
 225+/*--
 226+ Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
 227+ to support better zlib compatibility.
 228+ This code is not _officially_ part of libbzip2 (yet);
 229+ I haven't tested it, documented it, or considered the
 230+ threading-safeness of it.
 231+ If this code breaks, please contact both Yoshioka and me.
 232+--*/
 233+
 234+BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
 235+ void
 236+ );
 237+
 238+#ifndef BZ_NO_STDIO
 239+BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
 240+ const char *path,
 241+ const char *mode
 242+ );
 243+
 244+BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
 245+ int fd,
 246+ const char *mode
 247+ );
 248+
 249+BZ_EXTERN int BZ_API(BZ2_bzread) (
 250+ BZFILE* b,
 251+ void* buf,
 252+ int len
 253+ );
 254+
 255+BZ_EXTERN int BZ_API(BZ2_bzwrite) (
 256+ BZFILE* b,
 257+ void* buf,
 258+ int len
 259+ );
 260+
 261+BZ_EXTERN int BZ_API(BZ2_bzflush) (
 262+ BZFILE* b
 263+ );
 264+
 265+BZ_EXTERN void BZ_API(BZ2_bzclose) (
 266+ BZFILE* b
 267+ );
 268+
 269+BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
 270+ BZFILE *b,
 271+ int *errnum
 272+ );
 273+#endif
 274+
 275+#ifdef __cplusplus
 276+}
 277+#endif
 278+
 279+#endif
 280+
 281+/*-------------------------------------------------------------*/
 282+/*--- end bzlib.h ---*/
 283+/*-------------------------------------------------------------*/
Property changes on: branches/ariel/xmldumps-backup/mwbzutils/bzlib.h
___________________________________________________________________
Added: svn:eol-style
1284 + native
Index: branches/ariel/xmldumps-backup/mwbzutils/Makefile
@@ -1,6 +1,6 @@
22 # ------------------------------------------------------------------
3 -# This Makefile builds binaries which rely on two source files
4 -# from libbzip2 version 1.0.6. (See bz2libfuncs.c and
 3+# This Makefile builds binaries which rely on three source files
 4+# from libbzip2 version 1.0.6. (See bz2libfuncs.c, bzlib.h and
55 # bzlib_private.h; the first is slightly modified while the
66 # second is unchanged from the library version.)
77 #
@@ -45,11 +45,10 @@
4646
4747 install: dumplastbz2block findpageidinbz2xml checkforbz2footer dumpbz2filefromoffset
4848 if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi
49 - if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi
50 - cp -f bzip2 $(PREFIX)/bin/dumplastbz2block
51 - cp -f bzip2 $(PREFIX)/bin/findpageidinbz2xml
52 - cp -f bzip2 $(PREFIX)/bin/checkforbz2footer
53 - cp -f bzip2 $(PREFIX)/bin/dumpbz2filefromoffset
 49+ cp -f dumplastbz2block $(PREFIX)/bin/dumplastbz2block
 50+ cp -f findpageidinbz2xml $(PREFIX)/bin/findpageidinbz2xml
 51+ cp -f checkforbz2footer $(PREFIX)/bin/checkforbz2footer
 52+ cp -f dumpbz2filefromoffset $(PREFIX)/bin/dumpbz2filefromoffset
5453 chmod a+x $(PREFIX)/bin/dumplastbz2block
5554 chmod a+x $(PREFIX)/bin/findpageidinbz2xml
5655 chmod a+x $(PREFIX)/bin/checkforbz2footer
@@ -59,9 +58,9 @@
6059 rm -f *.o *.a dumplastbz2block findpageidinbz2xml \
6160 checkforbz2footer dumpbz2filefromoffset
6261
63 -bzlibfuncs.o: bzlibfuncs.c
 62+bzlibfuncs.o: bzlibfuncs.c bzlib.h bzlib_private.h
6463 $(CC) $(CFLAGS) -c bzlibfuncs.c
65 -mwbzlib.o: mwbzlib.c
 64+mwbzlib.o: mwbzlib.c bzlib.h bzlib_private.h mwbzutils.h
6665 $(CC) $(CFLAGS) -c mwbzlib.c
6766 dumplastbz2block.o: dumplastbz2block.c
6867 $(CC) $(CFLAGS) -c dumplastbz2block.c
@@ -86,6 +85,7 @@
8786 $(DISTNAME)/mwbzlib.c \
8887 $(DISTNAME)/mwbzutils.h \
8988 $(DISTNAME)/bzlibfuncs.c \
 89+ $(DISTNAME)/bzlib.h \
9090 $(DISTNAME)/bzlib_private.h \
9191 $(DISTNAME)/Makefile \
9292 $(DISTNAME)/LICENSE_BZ \
Index: branches/ariel/xmldumps-backup/mwbzutils/README
@@ -7,7 +7,7 @@
88 quickly instead of requiring a serial read/decompress of the file. Some
99 of these files range from 2 to 30 GB in size, so serial access is too slow.
1010
11 -The files bz2libfuncs.c and bzlib_private.h are taken from bzip2/libbzip2
 11+The files bz2libfuncs.c, bzlib.h and bzlib_private.h are taken from bzip2/libbzip2
1212 version 1.0.6 of 6 September 2010 (Copyright (C) 1996-2010 Julian Seward
1313 <jseward@bzip.org>) and as such their copyright license is in the file
1414 LICENSE_BZ; all other files in the package are released under the GPL,

Status & tagging log