Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/zlib/gzio.c

Issue 17358: Apply Gears modifications to zlib to our copy, so we're both using the same... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/zlib/README.google ('k') | third_party/zlib/zutil.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* gzio.c -- IO on .gz files 1 /* gzio.c -- IO on .gz files
2 * Copyright (C) 1995-2005 Jean-loup Gailly. 2 * Copyright (C) 1995-2005 Jean-loup Gailly.
3 * For conditions of distribution and use, see copyright notice in zlib.h 3 * For conditions of distribution and use, see copyright notice in zlib.h
4 * 4 *
5 * Compile this file with -DNO_GZCOMPRESS to avoid the compression code. 5 * Compile this file with -DNO_GZCOMPRESS to avoid the compression code.
6 */ 6 */
7 7
8 /* @(#) $Id: gzio.c,v 3.7 2005/08/04 19:14:14 tor%cs.brown.edu Exp $ */ 8 /* @(#) $Id: gzio.c,v 3.7 2005/08/04 19:14:14 tor%cs.brown.edu Exp $ */
9 9
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 char mode; /* 'w' or 'r' */ 67 char mode; /* 'w' or 'r' */
68 z_off_t start; /* start of compressed data in file (header skipped) */ 68 z_off_t start; /* start of compressed data in file (header skipped) */
69 z_off_t in; /* bytes into deflate or inflate */ 69 z_off_t in; /* bytes into deflate or inflate */
70 z_off_t out; /* bytes out of deflate or inflate */ 70 z_off_t out; /* bytes out of deflate or inflate */
71 int back; /* one character push-back */ 71 int back; /* one character push-back */
72 int last; /* true if push-back is last character */ 72 int last; /* true if push-back is last character */
73 } gz_stream; 73 } gz_stream;
74 74
75 75
76 local gzFile gz_open OF((const char *path, const char *mode, int fd)); 76 local gzFile gz_open OF((const char *path, const char *mode, int fd));
77 #ifndef NO_GZCOMPRESS // Google Gears addition, to avoid compile warning
77 local int do_flush OF((gzFile file, int flush)); 78 local int do_flush OF((gzFile file, int flush));
79 #endif
78 local int get_byte OF((gz_stream *s)); 80 local int get_byte OF((gz_stream *s));
79 local void check_header OF((gz_stream *s)); 81 local void check_header OF((gz_stream *s));
80 local int destroy OF((gz_stream *s)); 82 local int destroy OF((gz_stream *s));
83 #ifndef NO_GZCOMPRESS // Google Gears addition, to avoid compile warning
81 local void putLong OF((FILE *file, uLong x)); 84 local void putLong OF((FILE *file, uLong x));
85 #endif
82 local uLong getLong OF((gz_stream *s)); 86 local uLong getLong OF((gz_stream *s));
83 87
84 /* =========================================================================== 88 /* ===========================================================================
85 Opens a gzip (.gz) file for reading or writing. The mode parameter 89 Opens a gzip (.gz) file for reading or writing. The mode parameter
86 is as in fopen ("rb" or "wb"). The file is given either by file descriptor 90 is as in fopen ("rb" or "wb"). The file is given either by file descriptor
87 or path name (if fd == -1). 91 or path name (if fd == -1).
88 gz_open returns NULL if the file could not be opened or if there was 92 gz_open returns NULL if the file could not be opened or if there was
89 insufficient memory to allocate the (de)compression state; errno 93 insufficient memory to allocate the (de)compression state; errno
90 can be checked to distinguish the two cases (if errno is zero, the 94 can be checked to distinguish the two cases (if errno is zero, the
91 zlib error is Z_MEM_ERROR). 95 zlib error is Z_MEM_ERROR).
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 */ 911 */
908 int ZEXPORT gzdirect (file) 912 int ZEXPORT gzdirect (file)
909 gzFile file; 913 gzFile file;
910 { 914 {
911 gz_stream *s = (gz_stream*)file; 915 gz_stream *s = (gz_stream*)file;
912 916
913 if (s == NULL || s->mode != 'r') return 0; 917 if (s == NULL || s->mode != 'r') return 0;
914 return s->transparent; 918 return s->transparent;
915 } 919 }
916 920
921 #ifndef NO_GZCOMPRESS // Google Gears addition, to avoid compile warning
917 /* =========================================================================== 922 /* ===========================================================================
918 Outputs a long in LSB order to the given file 923 Outputs a long in LSB order to the given file
919 */ 924 */
920 local void putLong (file, x) 925 local void putLong (file, x)
921 FILE *file; 926 FILE *file;
922 uLong x; 927 uLong x;
923 { 928 {
924 int n; 929 int n;
925 for (n = 0; n < 4; n++) { 930 for (n = 0; n < 4; n++) {
926 fputc((int)(x & 0xff), file); 931 fputc((int)(x & 0xff), file);
927 x >>= 8; 932 x >>= 8;
928 } 933 }
929 } 934 }
935 #endif
930 936
931 /* =========================================================================== 937 /* ===========================================================================
932 Reads a long in LSB order from the given gz_stream. Sets z_err in case 938 Reads a long in LSB order from the given gz_stream. Sets z_err in case
933 of error. 939 of error.
934 */ 940 */
935 local uLong getLong (s) 941 local uLong getLong (s)
936 gz_stream *s; 942 gz_stream *s;
937 { 943 {
938 uLong x = (uLong)get_byte(s); 944 uLong x = (uLong)get_byte(s);
939 int c; 945 int c;
(...skipping 24 matching lines...) Expand all
964 if (do_flush (file, Z_FINISH) != Z_OK) 970 if (do_flush (file, Z_FINISH) != Z_OK)
965 return destroy((gz_stream*)file); 971 return destroy((gz_stream*)file);
966 972
967 putLong (s->file, s->crc); 973 putLong (s->file, s->crc);
968 putLong (s->file, (uLong)(s->in & 0xffffffff)); 974 putLong (s->file, (uLong)(s->in & 0xffffffff));
969 #endif 975 #endif
970 } 976 }
971 return destroy((gz_stream*)file); 977 return destroy((gz_stream*)file);
972 } 978 }
973 979
974 #ifdef STDC 980 // Google Gears modification: strerror is not present on WinCE.
981 #if defined(STDC) && !defined(_WIN32_WCE)
975 # define zstrerror(errnum) strerror(errnum) 982 # define zstrerror(errnum) strerror(errnum)
976 #else 983 #else
977 # define zstrerror(errnum) "" 984 # define zstrerror(errnum) ""
978 #endif 985 #endif
979 986
980 /* =========================================================================== 987 /* ===========================================================================
981 Returns the error message for the last error which occurred on the 988 Returns the error message for the last error which occurred on the
982 given compressed file. errnum is set to zlib error number. If an 989 given compressed file. errnum is set to zlib error number. If an
983 error occurred in the file system and not in the compression library, 990 error occurred in the file system and not in the compression library,
984 errnum is set to Z_ERRNO and the application may consult errno 991 errnum is set to Z_ERRNO and the application may consult errno
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 void ZEXPORT gzclearerr (file) 1024 void ZEXPORT gzclearerr (file)
1018 gzFile file; 1025 gzFile file;
1019 { 1026 {
1020 gz_stream *s = (gz_stream*)file; 1027 gz_stream *s = (gz_stream*)file;
1021 1028
1022 if (s == NULL) return; 1029 if (s == NULL) return;
1023 if (s->z_err != Z_STREAM_END) s->z_err = Z_OK; 1030 if (s->z_err != Z_STREAM_END) s->z_err = Z_OK;
1024 s->z_eof = 0; 1031 s->z_eof = 0;
1025 clearerr(s->file); 1032 clearerr(s->file);
1026 } 1033 }
OLDNEW
« no previous file with comments | « third_party/zlib/README.google ('k') | third_party/zlib/zutil.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698