diff --git a/Makefile b/Makefile index 10ff447..44de5f8 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ all: gimginfo gimgfixcmd gimgxor gimgunlock gimgch gimgextract cmdc gimginfo: gimginfo.o $(GIMGLIB_OBJS) gimgfixcmd: gimgfixcmd.o cmdlib.o $(GIMGLIB_OBJS) - $(CC) -o $@ -lm $^ + $(CC) -o $@ $^ -lm gimgxor: gimgxor.o @@ -19,7 +19,7 @@ gimgch: gimgch.o gimgextract: gimgextract.o cmdc: cmdc.o - $(CC) -o $@ -lm $< + $(CC) -o $@ $< -lm .PHONY: clean clean: diff --git a/cmdlib.c b/cmdlib.c index 2d3439f..3aad32d 100644 --- a/cmdlib.c +++ b/cmdlib.c @@ -12,7 +12,7 @@ short *cmd_devs = NULL; int cmd_init (const char *path) { FILE *fp = fopen(path, "rb"); - if (fopen == NULL) { + if (fp == NULL) { printf("cannot open %s\n", path); goto errout; } diff --git a/gimglib.h b/gimglib.h index 275fb42..6a5e197 100644 --- a/gimglib.h +++ b/gimglib.h @@ -17,6 +17,7 @@ # include # include # include +# include # include # include # include diff --git a/gimgunlock.c b/gimgunlock.c index d2e33d9..3ebcb19 100644 --- a/gimgunlock.c +++ b/gimgunlock.c @@ -71,9 +71,9 @@ int read_byte_at (FILE *fp, unsigned long offset) return getc(fp); } -int read_2byte_at (FILE *fp, unsigned long offset) +unsigned int read_2byte_at (FILE *fp, unsigned long offset) { - int n = 0; + unsigned int n = 0; if (fseek(fp, offset, SEEK_SET)) { perror(NULL); exit(1); @@ -87,7 +87,7 @@ int read_2byte_at (FILE *fp, unsigned long offset) unsigned int read_4byte_at (FILE *fp, unsigned long offset) { - int n = 0; + unsigned int n = 0; if (fseek(fp, offset, SEEK_SET)) { perror(NULL); exit(1); diff --git a/sf_gmp.c b/sf_gmp.c index 14620d0..8dc9992 100644 --- a/sf_gmp.c +++ b/sf_gmp.c @@ -18,7 +18,7 @@ void dump_gmp (struct subfile_struct *sf) printf("unknown_02d: 0x%x\n", header->unknown_02d); if (header->comm.hlen > sizeof(struct garmin_gmp)) - printf("from 0x%x to 0x%x (0x%x bytes): %s\n", + printf("from 0x%lx to 0x%x (0x%lx bytes): %s\n", sizeof(struct garmin_gmp), header->comm.hlen - 1, header->comm.hlen - sizeof(struct garmin_gmp), dump_unknown_bytes((uint8_t *)header + sizeof(struct garmin_gmp), header->comm.hlen - sizeof(struct garmin_gmp)));