diff options
author | Salvador Cuñat <salvador.cunat@gmail.com> | 2015-07-06 22:02:03 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-07-06 13:15:29 -0700 |
commit | 1197be235bb846a08ae0de851afe2c9108513727 (patch) | |
tree | 471d5a8b1f9fcd7ce2b47510ac3914a6ebb4b066 | |
parent | e6ae3716730be6e9dba4c0ec9da622ee7e64f400 (diff) | |
download | subsurface-1197be235bb846a08ae0de851afe2c9108513727.tar.gz |
OSTCTools - Add unsigned char variable
In commit 22bfc49 an explicit cast to (char *) was introduced to silence
some compiler warnings, but an (unsigned char *) is needed if related
values are expected to be greater than 127 or we will get the usual
weirdnesses.
Just introduce such variable and use it where needed.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | ostctools.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ostctools.c b/ostctools.c index 84af67d88..45a21e924 100644 --- a/ostctools.c +++ b/ostctools.c @@ -67,7 +67,7 @@ void ostctools_import(const char *file, struct dive_table *divetable) FILE *archive; device_data_t *devdata = calloc(1, sizeof(device_data_t)); dc_family_t dc_fam; - unsigned char *buffer = calloc(65536, 1); + unsigned char *buffer = calloc(65536, 1), *uc_tmp; char *tmp; struct dive *ostcdive = alloc_dive(); dc_status_t rc = 0; @@ -85,18 +85,18 @@ void ostctools_import(const char *file, struct dive_table *divetable) } // Read dive number from the log - tmp = calloc(2,1); + uc_tmp = calloc(2, 1); fseek(archive, 258, 0); - fread(tmp, 1, 2, archive); - ostcdive->number = tmp[0] + (tmp[1] << 8); - free(tmp); + fread(uc_tmp, 1, 2, archive); + ostcdive->number = uc_tmp[0] + (uc_tmp[1] << 8); + free(uc_tmp); // Read device's serial number - tmp = calloc(2, 1); + uc_tmp = calloc(2, 1); fseek(archive, 265, 0); - fread(tmp, 1, 2, archive); - serial = tmp[0] + (tmp[1] << 8); - free(tmp); + fread(uc_tmp, 1, 2, archive); + serial = uc_tmp[0] + (uc_tmp[1] << 8); + free(uc_tmp); // Read dive's raw data, header + profile fseek(archive, 456, 0); |