Add explicit casts to silence compiler warnings

clang complais when converting (char *) to (unsigned char *), so tell
it it's fine.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2015-05-28 14:59:08 +02:00 committed by Dirk Hohndel
parent e3215123d1
commit 22bfc4936f
6 changed files with 18 additions and 18 deletions

View file

@ -200,7 +200,7 @@ static void cochran_parse_header(const unsigned char *decode, unsigned mod,
/* Do the "null decode" using a one-byte decode array of '\0' */ /* Do the "null decode" using a one-byte decode array of '\0' */
/* Copies in plaintext, will be overwritten later */ /* Copies in plaintext, will be overwritten later */
partial_decode(0, 0x0102, "", 0, 1, in, size, buf); partial_decode(0, 0x0102, (const unsigned char *)"", 0, 1, in, size, buf);
/* /*
* The header scrambling is different form the dive * The header scrambling is different form the dive
@ -778,7 +778,7 @@ int try_to_open_cochran(const char *filename, struct memblock *mem)
if (mem->size < 0x40000) if (mem->size < 0x40000)
return 0; return 0;
offsets = (int *) mem->buffer; offsets = (unsigned int *) mem->buffer;
dive1 = offsets[0]; dive1 = offsets[0];
dive2 = offsets[1]; dive2 = offsets[1];

View file

@ -409,7 +409,7 @@ static uint32_t calculate_diveid(const unsigned char *fingerprint, unsigned int
#ifdef DC_FIELD_STRING #ifdef DC_FIELD_STRING
static uint32_t calculate_string_hash(const char *str) static uint32_t calculate_string_hash(const char *str)
{ {
return calculate_diveid(str, strlen(str)); return calculate_diveid((const unsigned char *)str, strlen(str));
} }
static void parse_string_field(struct dive *dive, dc_field_string_t *str) static void parse_string_field(struct dive *dive, dc_field_string_t *str)

View file

@ -67,8 +67,8 @@ void ostctools_import(const char *file, struct dive_table *divetable)
FILE *archive; FILE *archive;
device_data_t *devdata = calloc(1, sizeof(device_data_t)); device_data_t *devdata = calloc(1, sizeof(device_data_t));
dc_family_t dc_fam; dc_family_t dc_fam;
unsigned char *buffer = calloc(65536, 1), unsigned char *buffer = calloc(65536, 1);
*tmp; char *tmp;
struct dive *ostcdive = alloc_dive(); struct dive *ostcdive = alloc_dive();
dc_status_t rc = 0; dc_status_t rc = 0;
int model = 0, i = 0; int model = 0, i = 0;
@ -125,7 +125,7 @@ void ostctools_import(const char *file, struct dive_table *divetable)
// a model number so will use 0. // a model number so will use 0.
ostc_prepare_data(model, dc_fam, devdata); ostc_prepare_data(model, dc_fam, devdata);
tmp = calloc(strlen(devdata->vendor)+strlen(devdata->model)+28,1); tmp = calloc(strlen(devdata->vendor)+strlen(devdata->model)+28,1);
sprintf(tmp,"%s %s (Imported from OSTCTools)", devdata->vendor, devdata->model); sprintf(tmp, "%s %s (Imported from OSTCTools)", devdata->vendor, devdata->model);
ostcdive->dc.model = copy_string(tmp); ostcdive->dc.model = copy_string(tmp);
free(tmp); free(tmp);

View file

@ -1736,14 +1736,14 @@ static const char *nodename(xmlNode *node, char *buf, int len)
return "root"; return "root";
} }
if (node->type == XML_CDATA_SECTION_NODE || (node->parent && !strcmp(node->name, "text"))) if (node->type == XML_CDATA_SECTION_NODE || (node->parent && !strcmp((const char *)node->name, "text")))
node = node->parent; node = node->parent;
/* Make sure it's always NUL-terminated */ /* Make sure it's always NUL-terminated */
p[--len] = 0; p[--len] = 0;
for (;;) { for (;;) {
const char *name = node->name; const char *name = (const char *)node->name;
char c; char c;
while ((c = *name++) != 0) { while ((c = *name++) != 0) {
/* Cheaper 'tolower()' for ASCII */ /* Cheaper 'tolower()' for ASCII */
@ -1768,7 +1768,7 @@ static const char *nodename(xmlNode *node, char *buf, int len)
static bool visit_one_node(xmlNode *node) static bool visit_one_node(xmlNode *node)
{ {
char *content; xmlChar *content;
static char buffer[MAXNAME]; static char buffer[MAXNAME];
const char *name; const char *name;
@ -1778,7 +1778,7 @@ static bool visit_one_node(xmlNode *node)
name = nodename(node, buffer, sizeof(buffer)); name = nodename(node, buffer, sizeof(buffer));
return entry(name, content); return entry(name, (char *)content);
} }
static bool traverse(xmlNode *root); static bool traverse(xmlNode *root);
@ -1874,7 +1874,7 @@ static bool traverse(xmlNode *root)
} }
do { do {
if (!strcmp(rule->name, n->name)) if (!strcmp(rule->name, (const char *)n->name))
break; break;
rule++; rule++;
} while (rule->name); } while (rule->name);
@ -1921,7 +1921,7 @@ const char *preprocess_divelog_de(const char *buffer)
return buffer; return buffer;
ctx = xmlCreateMemoryParserCtxt(buf, sizeof(buf)); ctx = xmlCreateMemoryParserCtxt(buf, sizeof(buf));
ret = xmlStringLenDecodeEntities(ctx, ret, strlen(ret), XML_SUBSTITUTE_REF, 0, 0, 0); ret = (char *)xmlStringLenDecodeEntities(ctx, (xmlChar *)ret, strlen(ret), XML_SUBSTITUTE_REF, 0, 0, 0);
return ret; return ret;
} }
@ -3138,17 +3138,17 @@ static xmlDoc *test_xslt_transforms(xmlDoc *doc, const char **params)
char *attribute; char *attribute;
while (info->root) { while (info->root) {
if ((strcasecmp(root_element->name, info->root) == 0)) { if ((strcasecmp((const char *)root_element->name, info->root) == 0)) {
if (info->attribute == NULL) if (info->attribute == NULL)
break; break;
else if (xmlGetProp(root_element, info->attribute) != NULL) else if (xmlGetProp(root_element, (const xmlChar *)info->attribute) != NULL)
break; break;
} }
info++; info++;
} }
if (info->root) { if (info->root) {
attribute = xmlGetProp(xmlFirstElementChild(root_element), "name"); attribute = (char *)xmlGetProp(xmlFirstElementChild(root_element), (const xmlChar *)"name");
if (attribute) { if (attribute) {
if (strcasecmp(attribute, "subsurface") == 0) { if (strcasecmp(attribute, "subsurface") == 0) {
free((void *)attribute); free((void *)attribute);

View file

@ -470,7 +470,7 @@ static unsigned int *sort_stops(int *dstops, int dnr, struct gaschanges *gstops,
{ {
int i, gi, di; int i, gi, di;
int total = dnr + gnr; int total = dnr + gnr;
int *stoplevels = malloc(total * sizeof(int)); unsigned int *stoplevels = malloc(total * sizeof(int));
/* no gaschanges */ /* no gaschanges */
if (gnr == 0) { if (gnr == 0) {
@ -866,7 +866,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
double tissue_tolerance = 0.0; double tissue_tolerance = 0.0;
struct gaschanges *gaschanges = NULL; struct gaschanges *gaschanges = NULL;
int gaschangenr; int gaschangenr;
int *stoplevels = NULL; unsigned int *stoplevels = NULL;
bool stopping = false; bool stopping = false;
bool clear_to_ascend; bool clear_to_ascend;
int clock, previous_point_time; int clock, previous_point_time;

View file

@ -90,7 +90,7 @@ static int uemis_convert_base64(char *base64, uint8_t **data)
fprintf(stderr, "Out of memory\n"); fprintf(stderr, "Out of memory\n");
goto bail; goto bail;
} }
decode(base64, *data, len); decode((unsigned char *)base64, *data, len);
if (memcmp(*data, "Dive\01\00\00", 7)) if (memcmp(*data, "Dive\01\00\00", 7))
fprintf(stderr, "Missing Dive100 header\n"); fprintf(stderr, "Missing Dive100 header\n");