archivers/zip.c
changeset 163 fc2b8ee5b420
parent 161 4fcc863fdc5f
child 194 09c353d30cd4
equal deleted inserted replaced
162:06ed1dc94f73 163:fc2b8ee5b420
   166     } /* while */
   166     } /* while */
   167     BAIL_IF_MACRO(buf == NULL, ERR_OUT_OF_MEMORY, 0);
   167     BAIL_IF_MACRO(buf == NULL, ERR_OUT_OF_MEMORY, 0);
   168 
   168 
   169     while (offset > 0)
   169     while (offset > 0)
   170     {
   170     {
   171         /* !!! - RYAN, CHECK THIS CAST */
       
   172         /* !!! This should be okay since offset will be <= bufsize */
       
   173         PHYSFS_uint32 chunk = (offset > bufsize) ? bufsize : (PHYSFS_uint32)offset;
   171         PHYSFS_uint32 chunk = (offset > bufsize) ? bufsize : (PHYSFS_uint32)offset;
   174         PHYSFS_sint32 rc = unzReadCurrentFile(fh, buf, chunk);
   172         PHYSFS_sint32 rc = unzReadCurrentFile(fh, buf, chunk);
   175         BAIL_IF_MACRO(rc == 0, ERR_IO_ERROR, 0);  /* shouldn't happen. */
   173         BAIL_IF_MACRO(rc == 0, ERR_IO_ERROR, 0);  /* shouldn't happen. */
   176         BAIL_IF_MACRO(rc == UNZ_ERRNO, ERR_IO_ERROR, 0);
   174         BAIL_IF_MACRO(rc == UNZ_ERRNO, ERR_IO_ERROR, 0);
   177         BAIL_IF_MACRO(rc < 0, ERR_COMPRESSION, 0);
   175         BAIL_IF_MACRO(rc < 0, ERR_COMPRESSION, 0);
   271 
   269 
   272 
   270 
   273 static int version_does_symlinks(uLong version)
   271 static int version_does_symlinks(uLong version)
   274 {
   272 {
   275     int retval = 0;
   273     int retval = 0;
   276     /* !!! - RYAN, CHECK THIS CAST */
   274     PHYSFS_uint8 hosttype = (PHYSFS_uint8) ((version >> 8) & 0xFF);
   277     /* !!! - You AND the result with 0xFF, so it can't be larger than 0xFF */
       
   278     unsigned char hosttype = (unsigned char)((version >> 8) & 0xFF);
       
   279 
   275 
   280     /*
   276     /*
   281      * These are the platforms that can build an archive with symlinks,
   277      * These are the platforms that can build an archive with symlinks,
   282      *  according to the Info-ZIP project.
   278      *  according to the Info-ZIP project.
   283      */
   279      */