Skip to content

Commit

Permalink
Patched to compile on Visual C++.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jul 30, 2009
1 parent b2dd052 commit f0c59dc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions archive_uz2.c
Expand Up @@ -35,7 +35,7 @@ typedef struct UZ2input
{
MojoInput *io;
int64 fsize;
int64 position;
uint64 position;
uint32 compsize;
uint8 compbuf[MAXCOMPSIZE];
uint32 uncompsize;
Expand Down Expand Up @@ -99,6 +99,7 @@ static int64 MojoInput_uz2_read(MojoInput *io, void *_buf, uint32 bufsize)
while (bufsize > 0)
{
const uint32 available = input->uncompsize - input->uncompindex;
const uint32 cpy = (available < bufsize) ? available : bufsize;
if (available == 0)
{
if (input->position == input->fsize)
Expand All @@ -112,7 +113,6 @@ static int64 MojoInput_uz2_read(MojoInput *io, void *_buf, uint32 bufsize)
continue; // try again.
} // if

const uint32 cpy = (available < bufsize) ? available : bufsize;
memcpy(buf, input->uncompbuf + input->uncompindex, cpy);
buf += cpy;
bufsize -= cpy;
Expand Down Expand Up @@ -156,15 +156,15 @@ static boolean MojoInput_uz2_seek(MojoInput *io, uint64 pos)
return false;

input->position -= input->uncompsize;
input->uncompindex = pos - input->position;
input->uncompindex = (uint32) (pos - input->position);
input->position += input->uncompindex;

return true;
} // MojoInput_uz2_seek

static int64 MojoInput_uz2_tell(MojoInput *io)
{
return ((UZ2input *) io->opaque)->position;
return (int64) (((UZ2input *) io->opaque)->position);
} // MojoInput_uz2_tell

static int64 MojoInput_uz2_length(MojoInput *io)
Expand Down

0 comments on commit f0c59dc

Please sign in to comment.