summaryrefslogtreecommitdiffstats
path: root/src/misc/bzlib/bzlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc/bzlib/bzlib.c')
-rw-r--r--src/misc/bzlib/bzlib.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/src/misc/bzlib/bzlib.c b/src/misc/bzlib/bzlib.c
index 9d040682..93aa083d 100644
--- a/src/misc/bzlib/bzlib.c
+++ b/src/misc/bzlib/bzlib.c
@@ -30,6 +30,14 @@
#include "bzlib_private.h"
+ABC_NAMESPACE_IMPL_START
+
+#ifdef _WIN32
+#define fileno _fileno
+#define fdopen _fdopen
+#define setmode _setmode
+#endif
+
/*---------------------------------------------------*/
/*--- Compression stuff ---*/
/*---------------------------------------------------*/
@@ -164,7 +172,7 @@ int BZ_API(BZ2_bzCompressInit)
if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc;
if (strm->bzfree == NULL) strm->bzfree = default_bzfree;
- s = BZALLOC( sizeof(EState) );
+ s = (EState *)BZALLOC( sizeof(EState) );
if (s == NULL) return BZ_MEM_ERROR;
s->strm = strm;
@@ -173,9 +181,9 @@ int BZ_API(BZ2_bzCompressInit)
s->ftab = NULL;
n = 100000 * blockSize100k;
- s->arr1 = BZALLOC( n * sizeof(UInt32) );
- s->arr2 = BZALLOC( (n+BZ_N_OVERSHOOT) * sizeof(UInt32) );
- s->ftab = BZALLOC( 65537 * sizeof(UInt32) );
+ s->arr1 = (unsigned *)BZALLOC( n * sizeof(UInt32) );
+ s->arr2 = (unsigned *)BZALLOC( (n+BZ_N_OVERSHOOT) * sizeof(UInt32) );
+ s->ftab = (unsigned *)BZALLOC( 65537 * sizeof(UInt32) );
if (s->arr1 == NULL || s->arr2 == NULL || s->ftab == NULL) {
if (s->arr1 != NULL) BZFREE(s->arr1);
@@ -361,7 +369,7 @@ Bool handle_compress ( bz_stream* strm )
{
Bool progress_in = False;
Bool progress_out = False;
- EState* s = strm->state;
+ EState* s = (EState *)strm->state;
while (True) {
@@ -408,7 +416,7 @@ int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action )
Bool progress;
EState* s;
if (strm == NULL) return BZ_PARAM_ERROR;
- s = strm->state;
+ s = (EState *)strm->state;
if (s == NULL) return BZ_PARAM_ERROR;
if (s->strm != strm) return BZ_PARAM_ERROR;
@@ -468,7 +476,7 @@ int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm )
{
EState* s;
if (strm == NULL) return BZ_PARAM_ERROR;
- s = strm->state;
+ s = (EState *)strm->state;
if (s == NULL) return BZ_PARAM_ERROR;
if (s->strm != strm) return BZ_PARAM_ERROR;
@@ -504,7 +512,7 @@ int BZ_API(BZ2_bzDecompressInit)
if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc;
if (strm->bzfree == NULL) strm->bzfree = default_bzfree;
- s = BZALLOC( sizeof(DState) );
+ s = (DState *)BZALLOC( sizeof(DState) );
if (s == NULL) return BZ_MEM_ERROR;
s->strm = strm;
strm->state = s;
@@ -683,7 +691,7 @@ Bool unRLE_obuf_to_output_FAST ( DState* s )
/*---------------------------------------------------*/
-__inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab )
+Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab )
{
Int32 nb, na, mid;
nb = 0;
@@ -809,7 +817,7 @@ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
Bool corrupt;
DState* s;
if (strm == NULL) return BZ_PARAM_ERROR;
- s = strm->state;
+ s = (DState *)strm->state;
if (s == NULL) return BZ_PARAM_ERROR;
if (s->strm != strm) return BZ_PARAM_ERROR;
@@ -862,7 +870,7 @@ int BZ_API(BZ2_bzDecompressEnd) ( bz_stream *strm )
{
DState* s;
if (strm == NULL) return BZ_PARAM_ERROR;
- s = strm->state;
+ s = (DState *)strm->state;
if (s == NULL) return BZ_PARAM_ERROR;
if (s->strm != strm) return BZ_PARAM_ERROR;
@@ -933,7 +941,7 @@ BZFILE* BZ_API(BZ2_bzWriteOpen)
if (ferror(f))
{ BZ_SETERR(BZ_IO_ERROR); return NULL; };
- bzf = malloc ( sizeof(bzFile) );
+ bzf = (bzFile *)malloc ( sizeof(bzFile) );
if (bzf == NULL)
{ BZ_SETERR(BZ_MEM_ERROR); return NULL; };
@@ -981,7 +989,7 @@ void BZ_API(BZ2_bzWrite)
{ BZ_SETERR(BZ_OK); return; };
bzf->strm.avail_in = len;
- bzf->strm.next_in = buf;
+ bzf->strm.next_in = (char *)buf;
while (True) {
bzf->strm.avail_out = BZ_MAX_UNUSED;
@@ -1106,7 +1114,7 @@ BZFILE* BZ_API(BZ2_bzReadOpen)
if (ferror(f))
{ BZ_SETERR(BZ_IO_ERROR); return NULL; };
- bzf = malloc ( sizeof(bzFile) );
+ bzf = (bzFile *)malloc ( sizeof(bzFile) );
if (bzf == NULL)
{ BZ_SETERR(BZ_MEM_ERROR); return NULL; };
@@ -1178,7 +1186,7 @@ int BZ_API(BZ2_bzRead)
{ BZ_SETERR(BZ_OK); return 0; };
bzf->strm.avail_out = len;
- bzf->strm.next_out = buf;
+ bzf->strm.next_out = (char *)buf;
while (True) {
@@ -1427,7 +1435,7 @@ BZFILE * bzopen_or_bzdopen
#ifdef BZ_STRICT_ANSI
fp = NULL;
#else
- fp = fdopen(fd,mode2);
+ fp = (FILE *)fdopen(fd,mode2);
#endif
}
if (fp == NULL) return NULL;
@@ -1569,3 +1577,8 @@ const char * BZ_API(BZ2_bzerror) (BZFILE *b, int *errnum)
/*-------------------------------------------------------------*/
/*--- end bzlib.c ---*/
/*-------------------------------------------------------------*/
+
+ABC_NAMESPACE_IMPL_END
+
+
+