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

📄 zlib.diff

📁 qtopia-phone-2.2.0下png工具库源代码实现。
💻 DIFF
📖 第 1 页 / 共 5 页
字号:
    /* ===========================================================================--- 54,75 ----  uLong dictId; /* Adler32 value of the dictionary */    void test_compress      OF((Byte *compr, uLong comprLen,!                             Byte *uncompr, uLong uncomprLen));  void test_gzio          OF((const char *out, const char *in, !                             Byte *uncompr, int uncomprLen));  void test_deflate       OF((Byte *compr, uLong comprLen));  void test_inflate       OF((Byte *compr, uLong comprLen,!                             Byte *uncompr, uLong uncomprLen));  void test_large_deflate OF((Byte *compr, uLong comprLen,!                             Byte *uncompr, uLong uncomprLen));  void test_large_inflate OF((Byte *compr, uLong comprLen,!                             Byte *uncompr, uLong uncomprLen));  void test_flush         OF((Byte *compr, uLong *comprLen));  void test_sync          OF((Byte *compr, uLong comprLen,!                             Byte *uncompr, uLong uncomprLen));  void test_dict_deflate  OF((Byte *compr, uLong comprLen));  void test_dict_inflate  OF((Byte *compr, uLong comprLen,!                             Byte *uncompr, uLong uncomprLen));  int  main               OF((int argc, char *argv[]));    /* ===========================================================================****************** 75,81 ****        if (strcmp((char*)uncompr, hello)) {          fprintf(stderr, "bad uncompress\n");! 	exit(1);      } else {          printf("uncompress(): %s\n", (char *)uncompr);      }--- 92,98 ----        if (strcmp((char*)uncompr, hello)) {          fprintf(stderr, "bad uncompress\n");!         exit(1);      } else {          printf("uncompress(): %s\n", (char *)uncompr);      }****************** 96,102 ****      z_off_t pos;        file = gzopen(out, "wb");!     if (file == NULL) {          fprintf(stderr, "gzopen error\n");          exit(1);      }--- 113,119 ----      z_off_t pos;        file = gzopen(out, "wb");!     if (file == F_NULL) {          fprintf(stderr, "gzopen error\n");          exit(1);      }****************** 103,119 ****      gzputc(file, 'h');      if (gzputs(file, "ello") != 4) {          fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err));! 	exit(1);      }      if (gzprintf(file, ", %s!", "hello") != 8) {          fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err));! 	exit(1);      }      gzseek(file, 1L, SEEK_CUR); /* add one zero byte */      gzclose(file);        file = gzopen(in, "rb");!     if (file == NULL) {          fprintf(stderr, "gzopen error\n");      }      strcpy((char*)uncompr, "garbage");--- 120,136 ----      gzputc(file, 'h');      if (gzputs(file, "ello") != 4) {          fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err));!         exit(1);      }      if (gzprintf(file, ", %s!", "hello") != 8) {          fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err));!         exit(1);      }      gzseek(file, 1L, SEEK_CUR); /* add one zero byte */      gzclose(file);        file = gzopen(in, "rb");!     if (file == F_NULL) {          fprintf(stderr, "gzopen error\n");      }      strcpy((char*)uncompr, "garbage");****************** 121,131 ****      uncomprLen = gzread(file, uncompr, (unsigned)uncomprLen);      if (uncomprLen != len) {          fprintf(stderr, "gzread err: %s\n", gzerror(file, &err));! 	exit(1);      }      if (strcmp((char*)uncompr, hello)) {          fprintf(stderr, "bad gzread: %s\n", (char*)uncompr);! 	exit(1);      } else {          printf("gzread(): %s\n", (char *)uncompr);      }--- 138,148 ----      uncomprLen = gzread(file, uncompr, (unsigned)uncomprLen);      if (uncomprLen != len) {          fprintf(stderr, "gzread err: %s\n", gzerror(file, &err));!         exit(1);      }      if (strcmp((char*)uncompr, hello)) {          fprintf(stderr, "bad gzread: %s\n", (char*)uncompr);!         exit(1);      } else {          printf("gzread(): %s\n", (char *)uncompr);      }****************** 132,145 ****        pos = gzseek(file, -8L, SEEK_CUR);      if (pos != 6 || gztell(file) != pos) {! 	fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n",! 		(long)pos, (long)gztell(file));! 	exit(1);      }        if (gzgetc(file) != ' ') {! 	fprintf(stderr, "gzgetc error\n");! 	exit(1);      }        gzgets(file, (char*)uncompr, uncomprLen);--- 149,162 ----        pos = gzseek(file, -8L, SEEK_CUR);      if (pos != 6 || gztell(file) != pos) {!         fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n",!                 (long)pos, (long)gztell(file));!         exit(1);      }        if (gzgetc(file) != ' ') {!         fprintf(stderr, "gzgetc error\n");!         exit(1);      }        gzgets(file, (char*)uncompr, uncomprLen);****************** 146,156 ****      uncomprLen = strlen((char*)uncompr);      if (uncomprLen != 6) { /* "hello!" */          fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err));! 	exit(1);      }      if (strcmp((char*)uncompr, hello+7)) {          fprintf(stderr, "bad gzgets after gzseek\n");! 	exit(1);      } else {          printf("gzgets() after gzseek: %s\n", (char *)uncompr);      }--- 163,173 ----      uncomprLen = strlen((char*)uncompr);      if (uncomprLen != 6) { /* "hello!" */          fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err));!         exit(1);      }      if (strcmp((char*)uncompr, hello+7)) {          fprintf(stderr, "bad gzgets after gzseek\n");!         exit(1);      } else {          printf("gzgets() after gzseek: %s\n", (char *)uncompr);      }****************** 231,237 ****        if (strcmp((char*)uncompr, hello)) {          fprintf(stderr, "bad inflate\n");! 	exit(1);      } else {          printf("inflate(): %s\n", (char *)uncompr);      }--- 248,254 ----        if (strcmp((char*)uncompr, hello)) {          fprintf(stderr, "bad inflate\n");!         exit(1);      } else {          printf("inflate(): %s\n", (char *)uncompr);      }****************** 266,272 ****      CHECK_ERR(err, "deflate");      if (c_stream.avail_in != 0) {          fprintf(stderr, "deflate not greedy\n");! 	exit(1);      }        /* Feed in already compressed data and switch to no compression: */--- 283,289 ----      CHECK_ERR(err, "deflate");      if (c_stream.avail_in != 0) {          fprintf(stderr, "deflate not greedy\n");!         exit(1);      }        /* Feed in already compressed data and switch to no compression: */****************** 286,292 ****      err = deflate(&c_stream, Z_FINISH);      if (err != Z_STREAM_END) {          fprintf(stderr, "deflate should report Z_STREAM_END\n");! 	exit(1);      }      err = deflateEnd(&c_stream);      CHECK_ERR(err, "deflateEnd");--- 303,309 ----      err = deflate(&c_stream, Z_FINISH);      if (err != Z_STREAM_END) {          fprintf(stderr, "deflate should report Z_STREAM_END\n");!         exit(1);      }      err = deflateEnd(&c_stream);      CHECK_ERR(err, "deflateEnd");****************** 316,322 ****        for (;;) {          d_stream.next_out = uncompr;            /* discard the output */! 	d_stream.avail_out = (uInt)uncomprLen;          err = inflate(&d_stream, Z_NO_FLUSH);          if (err == Z_STREAM_END) break;          CHECK_ERR(err, "large inflate");--- 333,339 ----        for (;;) {          d_stream.next_out = uncompr;            /* discard the output */!         d_stream.avail_out = (uInt)uncomprLen;          err = inflate(&d_stream, Z_NO_FLUSH);          if (err == Z_STREAM_END) break;          CHECK_ERR(err, "large inflate");****************** 327,333 ****        if (d_stream.total_out != 2*uncomprLen + comprLen/2) {          fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out);! 	exit(1);      } else {          printf("large_inflate(): OK\n");      }--- 344,350 ----        if (d_stream.total_out != 2*uncomprLen + comprLen/2) {          fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out);!         exit(1);      } else {          printf("large_inflate(): OK\n");      }****************** 407,413 ****      if (err != Z_DATA_ERROR) {          fprintf(stderr, "inflate should report DATA_ERROR\n");          /* Because of incorrect adler32 */! 	exit(1);      }      err = inflateEnd(&d_stream);      CHECK_ERR(err, "inflateEnd");--- 424,430 ----      if (err != Z_DATA_ERROR) {          fprintf(stderr, "inflate should report DATA_ERROR\n");          /* Because of incorrect adler32 */!         exit(1);      }      err = inflateEnd(&d_stream);      CHECK_ERR(err, "inflateEnd");****************** 433,439 ****      CHECK_ERR(err, "deflateInit");        err = deflateSetDictionary(&c_stream,! 			       (const Bytef*)dictionary, sizeof(dictionary));      CHECK_ERR(err, "deflateSetDictionary");        dictId = c_stream.adler;--- 450,456 ----      CHECK_ERR(err, "deflateInit");        err = deflateSetDictionary(&c_stream,!                                (const Bytef*)dictionary, sizeof(dictionary));      CHECK_ERR(err, "deflateSetDictionary");        dictId = c_stream.adler;****************** 446,452 ****      err = deflate(&c_stream, Z_FINISH);      if (err != Z_STREAM_END) {          fprintf(stderr, "deflate should report Z_STREAM_END\n");! 	exit(1);      }      err = deflateEnd(&c_stream);      CHECK_ERR(err, "deflateEnd");--- 463,469 ----      err = deflate(&c_stream, Z_FINISH);      if (err != Z_STREAM_END) {          fprintf(stderr, "deflate should report Z_STREAM_END\n");!         exit(1);      }      err = deflateEnd(&c_stream);      CHECK_ERR(err, "deflateEnd");****************** 480,493 ****      for (;;) {          err = inflate(&d_stream, Z_NO_FLUSH);          if (err == Z_STREAM_END) break;! 	if (err == Z_NEED_DICT) {! 	    if (d_stream.adler != dictId) {! 		fprintf(stderr, "unexpected dictionary");! 		exit(1);! 	    }! 	    err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary,! 				       sizeof(dictionary));! 	}          CHECK_ERR(err, "inflate with dict");      }  --- 497,510 ----      for (;;) {          err = inflate(&d_stream, Z_NO_FLUSH);          if (err == Z_STREAM_END) break;!         if (err == Z_NEED_DICT) {!             if (d_stream.adler != dictId) {!                 fprintf(stderr, "unexpected dictionary");!                 exit(1);!             }!             err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary,!                                        sizeof(dictionary));!         }          CHECK_ERR(err, "inflate with dict");      }  ****************** 496,502 ****        if (strcmp((char*)uncompr, hello)) {          fprintf(stderr, "bad inflate with dict\n");! 	exit(1);      } else {          printf("inflate with dictionary: %s\n", (char *)uncompr);      }--- 513,519 ----        if (strcmp((char*)uncompr, hello)) {          fprintf(stderr, "bad inflate with dict\n");!         exit(1);      } else {          printf("inflate with dictionary: %s\n", (char *)uncompr);      }****************** 530,542 ****       */      if (compr == Z_NULL || uncompr == Z_NULL) {          printf("out of memory\n");! 	exit(1);      }      test_compress(compr, comprLen, uncompr, uncomprLen);        test_gzio((argc > 1 ? argv[1] : TESTFILE),                (argc > 2 ? argv[2] : TESTFILE),! 	      uncompr, (int)uncomprLen);        test_deflate(compr, comprLen);      test_inflate(compr, comprLen, uncompr, uncomprLen);--- 547,559 ----       */      if (compr == Z_NULL || uncompr == Z_NULL) {          printf("out of memory\n");!         exit(1);      }      test_compress(compr, comprLen, uncompr, uncomprLen);        test_gzio((argc > 1 ? argv[1] : TESTFILE),                (argc > 2 ? argv[2] : TESTFILE),!               uncompr, (int)uncomprLen);        test_deflate(compr, comprLen);      test_inflate(compr, comprLen, uncompr, uncomprLen);****************** 554,556 ****--- 571,609 ----      exit(0);      return 0; /* to avoid warning */  }+ + #if defined(_WIN32_WCE)+ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR lpszCmdLine, int nCmdShow)+ {+     #define SIZE_ARGV   (32)+     int argc;+     char *argv[SIZE_ARGV];+     int size;+     char *buff;+     char *argp;+ +     size = WideCharToMultiByte(CP_ACP, 0, lpszCmdLine, -1, NULL, 0, NULL, NULL);+     buff = (char *)malloc(size);+     size = WideCharToMultiByte(CP_ACP, 0, lpszCmdLine, -1, buff, size, NULL, NULL);+     argp = buff;+     argc = 0;+     argv[argc++] = "example.exe";+     if (*argp) {+         argv[argc++] = argp;+         while (*argp) {+             if (*argp == ' ') {+                 *argp++ = '\0';+                 while (*argp && *argp == ' ') {+                     argp++;+                 }+                 if (*argp && argc < SIZE_ARGV) {+                     argv[argc++] = argp;+                 }+             } else {+                 argp++;+             }+         }+     }+     return main(argc, argv);+ }+ #endif

⌨️ 快捷键说明

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