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' */
/* 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
@ -778,7 +778,7 @@ int try_to_open_cochran(const char *filename, struct memblock *mem)
if (mem->size < 0x40000)
return 0;
offsets = (int *) mem->buffer;
offsets = (unsigned int *) mem->buffer;
dive1 = offsets[0];
dive2 = offsets[1];

View file

@ -409,7 +409,7 @@ static uint32_t calculate_diveid(const unsigned char *fingerprint, unsigned int
#ifdef DC_FIELD_STRING
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)

View file

@ -67,8 +67,8 @@ 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),
*tmp;
unsigned char *buffer = calloc(65536, 1);
char *tmp;
struct dive *ostcdive = alloc_dive();
dc_status_t rc = 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.
ostc_prepare_data(model, dc_fam, devdata);
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);
free(tmp);

View file

@ -1736,14 +1736,14 @@ static const char *nodename(xmlNode *node, char *buf, int len)
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;
/* Make sure it's always NUL-terminated */
p[--len] = 0;
for (;;) {
const char *name = node->name;
const char *name = (const char *)node->name;
char c;
while ((c = *name++) != 0) {
/* 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)
{
char *content;
xmlChar *content;
static char buffer[MAXNAME];
const char *name;
@ -1778,7 +1778,7 @@ static bool visit_one_node(xmlNode *node)
name = nodename(node, buffer, sizeof(buffer));
return entry(name, content);
return entry(name, (char *)content);
}
static bool traverse(xmlNode *root);
@ -1874,7 +1874,7 @@ static bool traverse(xmlNode *root)
}
do {
if (!strcmp(rule->name, n->name))
if (!strcmp(rule->name, (const char *)n->name))
break;
rule++;
} while (rule->name);
@ -1921,7 +1921,7 @@ const char *preprocess_divelog_de(const char *buffer)
return buffer;
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;
}
@ -3138,17 +3138,17 @@ static xmlDoc *test_xslt_transforms(xmlDoc *doc, const char **params)
char *attribute;
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)
break;
else if (xmlGetProp(root_element, info->attribute) != NULL)
else if (xmlGetProp(root_element, (const xmlChar *)info->attribute) != NULL)
break;
}
info++;
}
if (info->root) {
attribute = xmlGetProp(xmlFirstElementChild(root_element), "name");
attribute = (char *)xmlGetProp(xmlFirstElementChild(root_element), (const xmlChar *)"name");
if (attribute) {
if (strcasecmp(attribute, "subsurface") == 0) {
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 total = dnr + gnr;
int *stoplevels = malloc(total * sizeof(int));
unsigned int *stoplevels = malloc(total * sizeof(int));
/* no gaschanges */
if (gnr == 0) {
@ -866,7 +866,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
double tissue_tolerance = 0.0;
struct gaschanges *gaschanges = NULL;
int gaschangenr;
int *stoplevels = NULL;
unsigned int *stoplevels = NULL;
bool stopping = false;
bool clear_to_ascend;
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");
goto bail;
}
decode(base64, *data, len);
decode((unsigned char *)base64, *data, len);
if (memcmp(*data, "Dive\01\00\00", 7))
fprintf(stderr, "Missing Dive100 header\n");