Merge pull request #1 from Tiiffi/fixes

Corrections to make it compile on Mac OS X.
This commit is contained in:
devinacker 2013-06-20 04:39:00 -07:00
commit 361ee95fac
4 changed files with 9 additions and 7 deletions

View file

@ -40,7 +40,7 @@ typedef struct {
method_e method;
} rle_t;
size_t pack (uint8_t *unpacked, size_t inputsize, uint8_t *packed, int fast);
size_t pack (uint8_t *unpacked, uint32_t inputsize, uint8_t *packed, int fast);
size_t unpack (uint8_t *packed, uint8_t *unpacked);
size_t unpack_from_file (FILE *file, unsigned int offset, uint8_t *unpacked);

View file

@ -51,7 +51,7 @@ int main (int argc, char **argv) {
fseek(outfile, 0, SEEK_SET);
fwrite((const void*)unpacked, 1, outputsize, outfile);
printf("\nUncompressed size: %d bytes\n", outputsize);
printf("\nUncompressed size: %zd bytes\n", outputsize);
fclose(infile);
fclose(outfile);

View file

@ -75,7 +75,7 @@ int main (int argc, char **argv) {
fseek(infile, 0, SEEK_END);
inputsize = ftell(infile);
printf("Uncompressed size: %d bytes\n", inputsize);
printf("Uncompressed size: %zd bytes\n", inputsize);
if (inputsize > DATA_SIZE) {
printf("Error: File must be a maximum of 65,536 bytes!\n");
@ -94,11 +94,11 @@ int main (int argc, char **argv) {
fseek(outfile, fileoffset, SEEK_SET);
fwrite((const void*)packed, 1, outputsize, outfile);
printf("Compressed size: %d bytes\n", outputsize);
printf("Compressed size: %zd bytes\n", outputsize);
printf("Compression ratio: %4.2f%%\n", 100 * (double)outputsize / inputsize);
printf("Compression time: %4.3f seconds\n\n", (double)time / CLOCKS_PER_SEC);
printf("Inserted at 0x%06X - 0x%06X\n", fileoffset, ftell(outfile) - 1);
printf("Inserted at 0x%06X - 0x%06lX\n", fileoffset, ftell(outfile) - 1);
fclose(infile);
fclose(outfile);

View file

@ -4,10 +4,12 @@
CC = gcc
FLAGS = -std=c99 -O2 -Wall
DELETE = rm
# Add extension when compiling for Windows
ifdef SystemRoot
EXT = .exe
DELETE = del
endif
# Comment this line to suppress detailed decompression information on stdout
@ -18,7 +20,7 @@ DEFINES += -DEXTRA_OUT
all: inhal$(EXT) exhal$(EXT)
clean:
del inhal$(EXT) exhal$(EXT) compress.o
$(DELETE) inhal$(EXT) exhal$(EXT) compress.o
inhal$(EXT): inhal.c compress.o
$(CC) $(DEFINES) $(FLAGS) -o inhal$(EXT) inhal.c compress.o
@ -27,4 +29,4 @@ exhal$(EXT): exhal.c compress.o
$(CC) $(DEFINES) $(FLAGS) -o exhal$(EXT) exhal.c compress.o
compress.o: compress.c
$(CC) $(DEFINES) $(FLAGS) -c compress.c
$(CC) $(DEFINES) $(FLAGS) -c compress.c