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>
This commit is contained in:
Salvador Cuñat 2015-07-06 22:02:03 +02:00 committed by Dirk Hohndel
parent e6ae371673
commit 1197be235b

View file

@ -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);