Changeset 2407 for libcaca/trunk/cucul/file.c
- Timestamp:
- Jun 15, 2008, 3:50:06 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/cucul/file.c
r2406 r2407 44 44 z_stream stream; 45 45 gzFile gz; 46 int eof, zip ;46 int eof, zip, total; 47 47 # endif 48 48 FILE *f; … … 58 58 cucul_file_t *fp = malloc(sizeof(*fp)); 59 59 60 fp->readonly = !strchr(mode, 'r');60 fp->readonly = strchr(mode, 'r'); 61 61 62 62 # if defined HAVE_ZLIB_H … … 73 73 fp->eof = 0; 74 74 fp->zip = 0; 75 fp->total = 0; 75 76 76 77 if(fp->readonly) … … 141 142 } 142 143 144 uint64_t cucul_file_tell(cucul_file_t *fp) 145 { 146 #if defined __KERNEL__ 147 return 0; 148 #elif defined HAVE_ZLIB_H 149 if(fp->zip) 150 return fp->total; 151 return gztell(fp->gz); 152 #else 153 return ftell(fp->f); 154 #endif 155 } 156 143 157 size_t cucul_file_read(cucul_file_t *fp, void *ptr, size_t size) 144 158 { … … 162 176 return 0; 163 177 #elif defined HAVE_ZLIB_H 178 /* FIXME: zip files are not supported */ 164 179 return gzwrite(fp->gz, ptr, size); 165 180 #else … … 247 262 { 248 263 fp->eof = 1; 264 fp->total += total_read; 249 265 return total_read; 250 266 } … … 254 270 } 255 271 272 fp->total += total_read; 256 273 return total_read; 257 274 }
Note: See TracChangeset
for help on using the changeset viewer.