📄 zlib.diff
字号:
diff -ac zlib113/deflate.c zlibwce/deflate.c*** zlib113/deflate.c Fri Jul 10 01:06:12 1998--- zlibwce/deflate.c Thu May 25 16:42:18 2000****************** 921,926 ****--- 921,930 ---- #endif /* ASMV */ #ifdef DEBUG+ #ifdef _WIN32_WCE+ /* Windows CE is not support DEBUG version's zlib */+ # define check_match(s, start, match, length)+ #else /* =========================================================================== * Check that the match at match_start is indeed a match. */****************** 944,949 ****--- 948,954 ---- do { putc(s->window[start++], stderr); } while (--length != 0); } }+ #endif #else # define check_match(s, start, match, length) #endifdiff -ac zlib113/trees.c zlibwce/trees.c*** zlib113/trees.c Thu Jul 09 01:32:58 1998--- zlibwce/trees.c Thu May 25 16:42:50 2000****************** 168,176 ****--- 168,182 ---- /* Send a code of the given tree. c and tree must not have side effects */ #else /* DEBUG */+ #ifdef _WIN32_WCE+ /* Windows CE is not support DEBUG version's zlib */+ # define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)+ + #else # define send_code(s, c, tree) \ { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ send_bits(s, tree[c].Code, tree[c].Len); }+ #endif #endif /* ===========================================================================diff -ac zlib113/zconf.h zlibwce/zconf.h*** zlib113/zconf.h Thu Jul 09 02:55:28 1998--- zlibwce/zconf.h Thu May 25 16:36:16 2000****************** 96,101 ****--- 96,106 ---- # define NEED_DUMMY_RETURN #endif + /* Windows CE is not have errno.h file: */+ #if defined(_WIN32_WCE)+ # define NO_ERRNO_H+ #endif+ /* Maximum value for memLevel in deflateInit2 */ #ifndef MAX_MEM_LEVEL****************** 162,168 **** /* Compile with -DZLIB_DLL for Windows DLL support */ #if defined(ZLIB_DLL)! # if defined(_WINDOWS) || defined(WINDOWS) # ifdef FAR # undef FAR # endif--- 167,173 ---- /* Compile with -DZLIB_DLL for Windows DLL support */ #if defined(ZLIB_DLL)! # if defined(_WINDOWS) || defined(WINDOWS) || defined(_WIN32_WCE) # ifdef FAR # undef FAR # endifdiff -ac zlib113/zutil.c zlibwce/zutil.c*** zlib113/zutil.c Thu Jul 09 02:01:48 1998--- zlibwce/zutil.c Thu May 25 16:43:34 2000****************** 32,37 ****--- 32,40 ---- } #ifdef DEBUG+ #ifdef _WIN32_WCE+ /* Windows CE is not support DEBUG version's zlib */+ #else # ifndef verbose # define verbose 0****************** 45,50 ****--- 48,54 ---- exit(1); } #endif+ #endif /* exported to allow conversion of error code to string for compress() and * uncompress()****************** 211,217 ****--- 215,225 ---- unsigned size; { if (opaque) items += size - size; /* make compiler happy */+ #ifdef _WIN32_WCE+ return (voidpf)malloc(items * size);+ #else return (voidpf)calloc(items, size);+ #endif } void zcfree (opaque, ptr)diff -ac zlib113/zutil.h zlibwce/zutil.h*** zlib113/zutil.h Thu Jul 09 02:01:48 1998--- zlibwce/zutil.h Thu May 25 16:41:44 2000****************** 16,22 ****--- 16,26 ---- #include "zlib.h" #ifdef STDC+ #ifdef _WIN32_WCE+ # include <malloc.h>+ #else # include <stddef.h>+ #endif # include <string.h> # include <stdlib.h> #endif****************** 188,193 ****--- 192,206 ---- /* Diagnostic functions */ #ifdef DEBUG+ #ifdef _WIN32_WCE+ /* Windows CE is not support DEBUG version's zlib */+ # define Assert(cond,msg)+ # define Trace(x)+ # define Tracev(x)+ # define Tracevv(x)+ # define Tracec(c,x)+ # define Tracecv(c,x)+ #else # include <stdio.h> extern int z_verbose; extern void z_error OF((char *m));****************** 197,202 ****--- 210,216 ---- # define Tracevv(x) {if (z_verbose>1) fprintf x ;} # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}+ #endif #else # define Assert(cond,msg) # define Trace(x)*** zlib113/gzio.c Sat Jul 8 13:59:49 2000--- zlibwce/gzio.c Sat Jul 8 13:58:29 2000****************** 1,5 ****! /* gzio.c -- IO on .gz files * Copyright (C) 1995-1998 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h * * Compile this file with -DNO_DEFLATE to avoid the compression code.--- 1,6 ----! /* gzio.c -- IO on .gz files for WindowsCE * Copyright (C) 1995-1998 Jean-loup Gailly.+ * Copyright (C) 2000 Tenik Co.,Ltd. * For conditions of distribution and use, see copyright notice in zlib.h * * Compile this file with -DNO_DEFLATE to avoid the compression code.****************** 7,13 **** /* @(#) $Id: qt/src/3rdparty/libpng/projects/wince/zlib.diff 2.3.12 edited 2005-10-27 $ */ ! #include <stdio.h> #include "zutil.h" --- 8,14 ---- /* @(#) $Id: qt/src/3rdparty/libpng/projects/wince/zlib.diff 2.3.12 edited 2005-10-27 $ */ ! #include <windows.h> #include "zutil.h" ****************** 41,47 **** z_stream stream; int z_err; /* error code for last stream operation */ int z_eof; /* set if end of input file */! FILE *file; /* .gz file */ Byte *inbuf; /* input buffer */ Byte *outbuf; /* output buffer */ uLong crc; /* crc32 of uncompressed data */--- 42,48 ---- z_stream stream; int z_err; /* error code for last stream operation */ int z_eof; /* set if end of input file */! HANDLE file; /* .gz file */ Byte *inbuf; /* input buffer */ Byte *outbuf; /* output buffer */ uLong crc; /* crc32 of uncompressed data */****************** 58,64 **** local int get_byte OF((gz_stream *s)); local void check_header OF((gz_stream *s)); local int destroy OF((gz_stream *s));! local void putLong OF((FILE *file, uLong x)); local uLong getLong OF((gz_stream *s)); /* ===========================================================================--- 59,65 ---- local int get_byte OF((gz_stream *s)); local void check_header OF((gz_stream *s)); local int destroy OF((gz_stream *s));! local void putLong OF((HANDLE file, uLong x)); local uLong getLong OF((gz_stream *s)); /* ===========================================================================****************** 82,87 ****--- 83,91 ---- gz_stream *s; char fmode[80]; /* copy of mode, without the compression level */ char *m = fmode;+ char cbuff[10];+ DWORD size;+ TCHAR file[MAX_PATH]; if (!path || !mode) return Z_NULL; ****************** 94,100 **** s->stream.next_in = s->inbuf = Z_NULL; s->stream.next_out = s->outbuf = Z_NULL; s->stream.avail_in = s->stream.avail_out = 0;! s->file = NULL; s->z_err = Z_OK; s->z_eof = 0; s->crc = crc32(0L, Z_NULL, 0);--- 98,104 ---- s->stream.next_in = s->inbuf = Z_NULL; s->stream.next_out = s->outbuf = Z_NULL; s->stream.avail_in = s->stream.avail_out = 0;! s->file = INVALID_HANDLE_VALUE; s->z_err = Z_OK; s->z_eof = 0; s->crc = crc32(0L, Z_NULL, 0);****************** 112,125 **** if (*p == 'r') s->mode = 'r'; if (*p == 'w' || *p == 'a') s->mode = 'w'; if (*p >= '0' && *p <= '9') {! level = *p - '0';! } else if (*p == 'f') {! strategy = Z_FILTERED;! } else if (*p == 'h') {! strategy = Z_HUFFMAN_ONLY;! } else {! *m++ = *p; /* copy the mode */! } } while (*p++ && m != fmode + sizeof(fmode)); if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL; --- 116,129 ---- if (*p == 'r') s->mode = 'r'; if (*p == 'w' || *p == 'a') s->mode = 'w'; if (*p >= '0' && *p <= '9') {! level = *p - '0';! } else if (*p == 'f') {! strategy = Z_FILTERED;! } else if (*p == 'h') {! strategy = Z_HUFFMAN_ONLY;! } else {! *m++ = *p; /* copy the mode */! } } while (*p++ && m != fmode + sizeof(fmode)); if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL; ****************** 152,177 **** } s->stream.avail_out = Z_BUFSIZE; ! errno = 0;! s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode); ! if (s->file == NULL) { return destroy(s), (gzFile)Z_NULL; } if (s->mode == 'w') { /* Write a very simple .gz header: */! fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],! Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE);! s->startpos = 10L;! /* We use 10L instead of ftell(s->file) to because ftell causes an * fflush on some systems. This version of the library doesn't use * startpos anyway in write mode, so this initialization is not * necessary. */ } else {! check_header(s); /* skip the .gz header */! s->startpos = (ftell(s->file) - s->stream.avail_in); } return (gzFile)s;--- 156,195 ---- } s->stream.avail_out = Z_BUFSIZE; ! SetLastError(NO_ERROR);! if ((HANDLE)fd == INVALID_HANDLE_VALUE) {! MultiByteToWideChar(CP_ACP, 0, path, -1, file, MAX_PATH);! s->file = CreateFile(file, GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, 0, NULL);! } else {! s->file = (HANDLE)fd;! } ! if (s->file == INVALID_HANDLE_VALUE) { return destroy(s), (gzFile)Z_NULL; } if (s->mode == 'w') { /* Write a very simple .gz header: */! cbuff[0] = gz_magic[0];! cbuff[1] = gz_magic[1];! cbuff[2] = Z_DEFLATED;! cbuff[3] = 0; /*flags*/! cbuff[4] = 0;! cbuff[5] = 0;! cbuff[6] = 0;! cbuff[7] = 0; /*time*/;! cbuff[8] = 0; /*xflags*/;! cbuff[9] = OS_CODE;! WriteFile(s->file, cbuff, 10, &size, NULL);! s->startpos = 10L;! /* We use 10L instead of ftell(s->file) to because ftell causes an * fflush on some systems. This version of the library doesn't use * startpos anyway in write mode, so this initialization is not * necessary. */ } else {! check_header(s); /* skip the .gz header */! s->startpos = (SetFilePointer(s->file, 0, NULL, FILE_CURRENT) - s->stream.avail_in); } return (gzFile)s;****************** 197,205 **** { char name[20]; ! if (fd < 0) return (gzFile)Z_NULL;! sprintf(name, "<fd:%d>", fd); /* for debugging */ return gz_open (name, mode, fd); } --- 215,225 ---- { char name[20]; ! if ((HANDLE)fd == INVALID_HANDLE_VALUE)! return (gzFile)Z_NULL; + strcpy(name, "<gzdopen>"); /* for debugging */+ return gz_open (name, mode, fd); } ****************** 212,217 ****--- 232,238 ---- int strategy; { gz_stream *s = (gz_stream*)file;+ DWORD size; if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; ****************** 218,228 **** /* Make room to allow flushing */ if (s->stream.avail_out == 0) { ! s->stream.next_out = s->outbuf;! if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {! s->z_err = Z_ERRNO;! }! s->stream.avail_out = Z_BUFSIZE; } return deflateParams (&(s->stream), level, strategy);--- 239,249 ---- /* Make room to allow flushing */ if (s->stream.avail_out == 0) { ! s->stream.next_out = s->outbuf;! if (!WriteFile(s->file, s->outbuf, Z_BUFSIZE, &size, NULL) || size != Z_BUFSIZE) {! s->z_err = Z_ERRNO;! }! s->stream.avail_out = Z_BUFSIZE; } return deflateParams (&(s->stream), level, strategy);****************** 236,251 **** local int get_byte(s) gz_stream *s; {! if (s->z_eof) return EOF; if (s->stream.avail_in == 0) {! errno = 0;! s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file);! if (s->stream.avail_in == 0) {! s->z_eof = 1;! if (ferror(s->file)) s->z_err = Z_ERRNO;! return EOF;! }! s->stream.next_in = s->inbuf;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -