From 01505d8d58eb4f0346bc3e5854101eb25b3211d5 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 12 Mar 2003 05:39:51 +0000 Subject: [PATCH] Attempt at type correctness. --- archivers/zip.c | 16 +++++++++------- physfs.c | 2 +- physfs_internal.h | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/archivers/zip.c b/archivers/zip.c index c3c80de8..de17db46 100644 --- a/archivers/zip.c +++ b/archivers/zip.c @@ -250,7 +250,7 @@ static PHYSFS_sint64 ZIP_read(FileHandle *handle, void *buf, if (avail < maxread) { maxread = avail - (avail % objSize); - objCount = maxread / objSize; + objCount = (PHYSFS_uint32) (maxread / objSize); BAIL_IF_MACRO(objCount == 0, ERR_PAST_EOF, 0); /* quick rejection. */ __PHYSFS_setError(ERR_PAST_EOF); /* this is always true here. */ } /* if */ @@ -282,13 +282,13 @@ static PHYSFS_sint64 ZIP_read(FileHandle *handle, void *buf, br = __PHYSFS_platformRead(finfo->handle, finfo->buffer, - 1, br); + 1, (PHYSFS_uint32) br); if (br <= 0) break; - finfo->compressed_position += br; + finfo->compressed_position += (PHYSFS_uint32) br; finfo->stream.next_in = finfo->buffer; - finfo->stream.avail_in = br; + finfo->stream.avail_in = (PHYSFS_uint32) br; } /* if */ } /* if */ @@ -303,7 +303,7 @@ static PHYSFS_sint64 ZIP_read(FileHandle *handle, void *buf, } /* else */ if (retval > 0) - finfo->uncompressed_position += (retval * objSize); + finfo->uncompressed_position += (PHYSFS_uint32) (retval * objSize); return(retval); } /* ZIP_read */ @@ -341,7 +341,7 @@ static int ZIP_seek(FileHandle *handle, PHYSFS_uint64 offset) { PHYSFS_sint64 newpos = offset + entry->offset; BAIL_IF_MACRO(!__PHYSFS_platformSeek(in, newpos), NULL, 0); - finfo->uncompressed_position = newpos; + finfo->uncompressed_position = (PHYSFS_uint32) newpos; } /* if */ else @@ -371,7 +371,9 @@ static int ZIP_seek(FileHandle *handle, PHYSFS_uint64 offset) while (finfo->uncompressed_position != offset) { PHYSFS_uint8 buf[512]; - PHYSFS_uint32 maxread = offset - finfo->uncompressed_position; + PHYSFS_uint32 maxread; + + maxread = (PHYSFS_uint32) (offset - finfo->uncompressed_position); if (maxread > sizeof (buf)) maxread = sizeof (buf); diff --git a/physfs.c b/physfs.c index 92c5fdbc..b4744f4c 100644 --- a/physfs.c +++ b/physfs.c @@ -1712,7 +1712,7 @@ static PHYSFS_sint64 doBufferedRead(PHYSFS_file *handle, void *buffer, { PHYSFS_uint64 buffered = h->buffill - h->bufpos; PHYSFS_uint64 mustread = (objSize * objCount) - remainder; - PHYSFS_uint32 copied; + PHYSFS_uint64 copied; if (buffered == 0) /* need to refill buffer? */ { diff --git a/physfs_internal.h b/physfs_internal.h index 38bacdf6..7285a311 100644 --- a/physfs_internal.h +++ b/physfs_internal.h @@ -832,7 +832,7 @@ typedef struct __PHYSFS_FILEHANDLE__ /* * This is the buffer size, if one is set (0 otherwise). Don't touch. */ - PHYSFS_uint64 bufsize; + PHYSFS_uint32 bufsize; /* * This is the buffer fill size. Don't touch.