⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zlib.diff

📁 qtopia-phone-2.2.0下png工具库源代码实现。
💻 DIFF
📖 第 1 页 / 共 5 页
字号:
            if (len != 0) {!             if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) {                  s->z_err = Z_ERRNO;                  return Z_ERRNO;              }--- 648,654 ----          len = Z_BUFSIZE - s->stream.avail_out;            if (len != 0) {!             if (!WriteFile(s->file, s->outbuf, len, &size, NULL) || (uInt)size != len) {                  s->z_err = Z_ERRNO;                  return Z_ERRNO;              }****************** 623,630 ****          if (done) break;          s->z_err = deflate(&(s->stream), flush);  ! 	/* Ignore the second of two consecutive flushes: */! 	if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK;            /* deflate has finished flushing only when it hasn't used up           * all the available space in the output buffer: --- 658,665 ----          if (done) break;          s->z_err = deflate(&(s->stream), flush);  !         /* Ignore the second of two consecutive flushes: */!         if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK;            /* deflate has finished flushing only when it hasn't used up           * all the available space in the output buffer: ****************** 644,650 ****      int err = do_flush (file, flush);        if (err) return err;!     fflush(s->file);      return  s->z_err == Z_STREAM_END ? Z_OK : s->z_err;  }  #endif /* NO_DEFLATE */--- 679,685 ----      int err = do_flush (file, flush);        if (err) return err;!       return  s->z_err == Z_STREAM_END ? Z_OK : s->z_err;  }  #endif /* NO_DEFLATE */****************** 665,698 ****      gz_stream *s = (gz_stream*)file;        if (s == NULL || whence == SEEK_END ||! 	s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) {! 	return -1L;      }            if (s->mode == 'w') {  #ifdef NO_DEFLATE! 	return -1L;  #else! 	if (whence == SEEK_SET) {! 	    offset -= s->stream.total_in;! 	}! 	if (offset < 0) return -1L;! ! 	/* At this point, offset is the number of zero bytes to write. */! 	if (s->inbuf == Z_NULL) {! 	    s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */! 	    zmemzero(s->inbuf, Z_BUFSIZE);! 	}! 	while (offset > 0)  {! 	    uInt size = Z_BUFSIZE;! 	    if (offset < Z_BUFSIZE) size = (uInt)offset;! ! 	    size = gzwrite(file, s->inbuf, size);! 	    if (size == 0) return -1L;! ! 	    offset -= size;! 	}! 	return (z_off_t)s->stream.total_in;  #endif      }      /* Rest of function is for reading only */--- 700,733 ----      gz_stream *s = (gz_stream*)file;        if (s == NULL || whence == SEEK_END ||!         s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) {!         return -1L;      }            if (s->mode == 'w') {  #ifdef NO_DEFLATE!         return -1L;  #else!         if (whence == SEEK_SET) {!             offset -= s->stream.total_in;!         }!         if (offset < 0) return -1L;! !         /* At this point, offset is the number of zero bytes to write. */!         if (s->inbuf == Z_NULL) {!             s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */!             zmemzero(s->inbuf, Z_BUFSIZE);!         }!         while (offset > 0)  {!             uInt size = Z_BUFSIZE;!             if (offset < Z_BUFSIZE) size = (uInt)offset;! !             size = gzwrite(file, s->inbuf, size);!             if (size == 0) return -1L;! !             offset -= size;!         }!         return (z_off_t)s->stream.total_in;  #endif      }      /* Rest of function is for reading only */****************** 699,736 ****        /* compute absolute position */      if (whence == SEEK_CUR) {! 	offset += s->stream.total_out;      }      if (offset < 0) return -1L;        if (s->transparent) {! 	/* map to fseek */! 	s->stream.avail_in = 0;! 	s->stream.next_in = s->inbuf;!         if (fseek(s->file, offset, SEEK_SET) < 0) return -1L;  ! 	s->stream.total_in = s->stream.total_out = (uLong)offset;! 	return offset;      }        /* For a negative seek, rewind and use positive seek */      if ((uLong)offset >= s->stream.total_out) {! 	offset -= s->stream.total_out;      } else if (gzrewind(file) < 0) {! 	return -1L;      }      /* offset is now the number of bytes to skip. */        if (offset != 0 && s->outbuf == Z_NULL) {! 	s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);      }      while (offset > 0)  {! 	int size = Z_BUFSIZE;! 	if (offset < Z_BUFSIZE) size = (int)offset;  ! 	size = gzread(file, s->outbuf, (uInt)size);! 	if (size <= 0) return -1L;! 	offset -= size;      }      return (z_off_t)s->stream.total_out;  }--- 734,771 ----        /* compute absolute position */      if (whence == SEEK_CUR) {!         offset += s->stream.total_out;      }      if (offset < 0) return -1L;        if (s->transparent) {!         /* map to fseek */!         s->stream.avail_in = 0;!         s->stream.next_in = s->inbuf;!         if (SetFilePointer(s->file, offset, NULL, FILE_BEGIN) == 0xFFFFFFFF) return -1L;  !         s->stream.total_in = s->stream.total_out = (uLong)offset;!         return offset;      }        /* For a negative seek, rewind and use positive seek */      if ((uLong)offset >= s->stream.total_out) {!         offset -= s->stream.total_out;      } else if (gzrewind(file) < 0) {!         return -1L;      }      /* offset is now the number of bytes to skip. */        if (offset != 0 && s->outbuf == Z_NULL) {!         s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);      }      while (offset > 0)  {!         int size = Z_BUFSIZE;!         if (offset < Z_BUFSIZE) size = (int)offset;  !         size = gzread(file, s->outbuf, (uInt)size);!         if (size <= 0) return -1L;!         offset -= size;      }      return (z_off_t)s->stream.total_out;  }****************** 742,748 ****      gzFile file;  {      gz_stream *s = (gz_stream*)file;!           if (s == NULL || s->mode != 'r') return -1;        s->z_err = Z_OK;--- 777,783 ----      gzFile file;  {      gz_stream *s = (gz_stream*)file;!       if (s == NULL || s->mode != 'r') return -1;        s->z_err = Z_OK;****************** 750,763 ****      s->stream.avail_in = 0;      s->stream.next_in = s->inbuf;      s->crc = crc32(0L, Z_NULL, 0);! 	      if (s->startpos == 0) { /* not a compressed file */! 	rewind(s->file);! 	return 0;      }        (void) inflateReset(&s->stream);!     return fseek(s->file, s->startpos, SEEK_SET);  }    /* ===========================================================================--- 785,798 ----      s->stream.avail_in = 0;      s->stream.next_in = s->inbuf;      s->crc = crc32(0L, Z_NULL, 0);!               if (s->startpos == 0) { /* not a compressed file */!         SetFilePointer(s->file, 0, NULL, FILE_BEGIN);!         return 0;      }        (void) inflateReset(&s->stream);!     return SetFilePointer(s->file, s->startpos, NULL, FILE_BEGIN);  }    /* ===========================================================================****************** 787,798 ****     Outputs a long in LSB order to the given file  */  local void putLong (file, x)!     FILE *file;      uLong x;  {      int n;      for (n = 0; n < 4; n++) {!         fputc((int)(x & 0xff), file);          x >>= 8;      }  }--- 822,836 ----     Outputs a long in LSB order to the given file  */  local void putLong (file, x)!     HANDLE file;      uLong x;  {      int n;+     char ch[1];+     DWORD size;      for (n = 0; n < 4; n++) {!         ch[0] = (int)(x & 0xff);!         WriteFile(file, ch, 1, &size, NULL);          x >>= 8;      }  }****************** 810,816 ****      x += ((uLong)get_byte(s))<<8;      x += ((uLong)get_byte(s))<<16;      c = get_byte(s);!     if (c == EOF) s->z_err = Z_DATA_ERROR;      x += ((uLong)c)<<24;      return x;  }--- 848,854 ----      x += ((uLong)get_byte(s))<<8;      x += ((uLong)get_byte(s))<<16;      c = get_byte(s);!     if (c == -1) s->z_err = Z_DATA_ERROR;      x += ((uLong)c)<<24;      return x;  }****************** 829,835 ****        if (s->mode == 'w') {  #ifdef NO_DEFLATE! 	return Z_STREAM_ERROR;  #else          err = do_flush (file, Z_FINISH);          if (err != Z_OK) return destroy((gz_stream*)file);--- 867,873 ----        if (s->mode == 'w') {  #ifdef NO_DEFLATE!         return Z_STREAM_ERROR;  #else          err = do_flush (file, Z_FINISH);          if (err != Z_OK) return destroy((gz_stream*)file);****************** 862,868 ****      *errnum = s->z_err;      if (*errnum == Z_OK) return (const char*)"";  !     m =  (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);        if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);  --- 900,906 ----      *errnum = s->z_err;      if (*errnum == Z_OK) return (const char*)"";  !     m =  (char*)(*errnum == Z_ERRNO ? zstrerror(GetLastError()) : s->stream.msg);        if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);  *** zlib113/minigzip.c	Sat Jul  8 13:59:49 2000--- zlibwce/minigzip.c	Sat Jul  8 13:58:29 2000****************** 1,5 ****--- 1,6 ----  /* minigzip.c -- simulate gzip using the zlib compression library   * 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    */  ****************** 15,21 ****--- 16,30 ----    /* @(#) $Id: qt/src/3rdparty/libpng/projects/wince/zlib.diff   2.3.12   edited 2005-10-27 $ */  + #if defined(_WIN32_WCE)+ #if _WIN32_WCE < 211+ #error (f|w)printf functions is not support old WindowsCE.+ #endif+ #undef USE_MMAP+ #include <windows.h>+ #else  #include <stdio.h>+ #endif  #include "zlib.h"    #ifdef STDC****************** 31,37 ****  #  include <sys/stat.h>  #endif  ! #if defined(MSDOS) || defined(OS2) || defined(WIN32)  #  include <fcntl.h>  #  include <io.h>  #  define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)--- 40,46 ----  #  include <sys/stat.h>  #endif  ! #if (defined(MSDOS) || defined(OS2) || defined(WIN32)) && !defined(_WIN32_WCE)  #  include <fcntl.h>  #  include <io.h>  #  define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)****************** 71,84 ****  #  define local  #endif    char *prog;    void error            OF((const char *msg));! void gz_compress      OF((FILE   *in, gzFile out));  #ifdef USE_MMAP! int  gz_compress_mmap OF((FILE   *in, gzFile out));  #endif! void gz_uncompress    OF((gzFile in, FILE   *out));  void file_compress    OF((char  *file, char *mode));  void file_uncompress  OF((char  *file));  int  main             OF((int argc, char *argv[]));--- 80,103 ----  #  define local  #endif  + #if defined(_WIN32_WCE)+ #undef  stderr+ #define stderr  stdout+ #define F_FILE  HANDLE+ #define F_NULL  INVALID_HANDLE_VALUE+ #else+ #define F_FILE  FILE*+ #define F_NULL  NULL+ #endif+   char *prog;    void error            OF((const char *msg));! void gz_compress      OF((F_FILE in, gzFile out));  #ifdef USE_MMAP! int  gz_compress_mmap OF((F_FILE in, gzFile out));  #endif! void gz_uncompress    OF((gzFile in, F_FILE out));  void file_compress    OF((char  *file, char *mode));  void file_uncompress  OF((char  *file));  int  main             OF((int argc, char *argv[]));****************** 93,104 ****      exit(1);  }    /* ===========================================================================   * Compress input to output then close both files.   */    void gz_compress(in, out)!     FILE   *in;      gzFile out;  {      local char buf[BUFLEN];--- 112,160 ----      exit(1);  }  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -