Skip to content
This repository was archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
Fix problems with missing ulong
Browse files Browse the repository at this point in the history
On OS X, there were some problems with ulong type (see issue #9).
Because CRC32 should always be 32 bits long, it was exchanged to
uint32_t, which should be more widespread type. Still there exists
uLong, which is zlib-specific.
  • Loading branch information
v3l0c1r4pt0r committed Mar 5, 2018
1 parent 552b5e1 commit cbb3633
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/xsdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ DecrError decryptData(void *buffer, uint32_t *bufferSize, void *outputBuffer, vo
return DD_OK;
}

ulong countCrc(FILE *f, uint32_t hdrSize)
uint32_t countCrc(FILE *f, uint32_t hdrSize)
{
void *buffer = malloc(0x1000);
uLong crc = crc32(0L, Z_NULL, 0);
Expand All @@ -135,7 +135,7 @@ ulong countCrc(FILE *f, uint32_t hdrSize)
crc = crc32(crc, (Bytef*)buffer, bytes);
}
free(buffer);
return crc;
return (uint32_t) crc;
}

DecrError loadHeader(FILE *f, Header *hdr, uint32_t hdrSize, UnpackData *ud)
Expand Down
2 changes: 1 addition & 1 deletion src/xsdc.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ uint32_t getDataOutputSize(uint32_t inputSize);
/*
* count and return crc of sdc file's data area
*/
ulong countCrc(FILE *f, uint32_t hdrSize);
uint32_t countCrc(FILE *f, uint32_t hdrSize);

/*
* load sdc file header from current position in F into HDR buffer
Expand Down

0 comments on commit cbb3633

Please sign in to comment.