Silence compiler warnings

This commit is contained in:
Stefan Rueger
2024-08-23 23:30:08 +01:00
parent 79f85d048f
commit 43fc4ff81f
4 changed files with 14 additions and 13 deletions

View File

@@ -454,7 +454,7 @@ static int is_jumpable(int address) {
// Format output for a label list r referenced by mnemonic m
static void output_references(const char *m, char *r) {
disasm_out("; %c%s from ", toupper(*m), m + 1);
disasm_out("; %c%s from ", toupper(*m & 0xff), m + 1);
for(char *s = r;;) {
char *c = strchr(s + 1, ',');
@@ -513,7 +513,7 @@ static void lineout(const char *code, const char *comment,
const char *mnestr = avr_opcodes[mne].opcode;
disasm_out("%-*s ; %s\n", commentcol(), str_ccprintf("%s:", name),
str_ccprintf("%c%s from %s", toupper(*mnestr), mnestr + 1, reflist));
str_ccprintf("%c%s from %s", toupper(*mnestr & 0xff), mnestr + 1, reflist));
} else {
output_references(avr_opcodes[mne].opcode, reflist);
if(comment)

View File

@@ -248,7 +248,7 @@ char *str_sprintf(const char *fmt, ...) {
// Compute size
va_start(ap, fmt);
size = vsnprintf(NULL, size, fmt, ap);
size = vsnprintf(NULL, 0, fmt, ap);
va_end(ap);
if(size < 0)
@@ -274,7 +274,7 @@ const char *str_ccprintf(const char *fmt, ...) {
// Compute size
va_start(ap, fmt);
size = vsnprintf(NULL, size, fmt, ap);
size = vsnprintf(NULL, 0, fmt, ap);
va_end(ap);
if(size < 0)
@@ -827,7 +827,7 @@ Str2data *str_todata(const char *s, int type, const AVRPART *part, const char *m
// Parse suffixes: ULL, LL, UL, L ... UHH, HH
for(char *p = end_ptr; *p; p++) {
switch(toupper(*p)) {
switch(toupper(*p & 0xff)) {
case 'U':
nu++;
break;
@@ -847,7 +847,7 @@ Str2data *str_todata(const char *s, int type, const AVRPART *part, const char *m
if(nx == 0 && nu < 2 && nl < 3 && nh < 3 && ns < 2) { // Could be valid integer suffix
// If U, then must be at start or end
if(nu == 0 || toupper(*end_ptr) == 'U' || toupper(str[arglen - 1]) == 'U') {
if(nu == 0 || toupper(*end_ptr & 0xff) == 'U' || toupper(str[arglen - 1] & 0xff) == 'U') {
bool is_hex, is_bin;
int ndigits;
@@ -940,7 +940,7 @@ Str2data *str_todata(const char *s, int type, const AVRPART *part, const char *m
if(type & STR_DOUBLE) { // Try double next, must have D suffix
sd->d = strtod(str, &end_ptr);
if(end_ptr != str && toupper(*end_ptr) == 'D' && end_ptr[1] == 0) {
if(end_ptr != str && toupper(*end_ptr & 0xff) == 'D' && end_ptr[1] == 0) {
sd->size = 8;
sd->type = STR_DOUBLE;
mmt_free(str);
@@ -951,7 +951,7 @@ Str2data *str_todata(const char *s, int type, const AVRPART *part, const char *m
if(type & STR_FLOAT) { // Try float next
sd->size = 0;
sd->f = strtof(str, &end_ptr);
if(end_ptr != str && toupper(*end_ptr) == 'F' && end_ptr[1] == 0)
if(end_ptr != str && toupper(*end_ptr & 0xff) == 'F' && end_ptr[1] == 0)
sd->size = 4;
// Do not accept valid mantissa-only floats that are integer rejects (eg, 078 or ULL overflows)
if(end_ptr != str && *end_ptr == 0 && !is_mantissa_only(str))

View File

@@ -258,7 +258,7 @@ static unsigned char *readbuf(const PROGRAMMER *pgm, const AVRPART *p, int argc,
if(mi < 0 || mi >= Nmems)
mi = 0;
const char *cmd = tolower(**argv) == 'r'? "read": str_casestarts(*argv, "di")? "disasm": "dump";
const char *cmd = tolower(**argv & 0xff) == 'r'? "read": str_casestarts(*argv, "di")? "disasm": "dump";
int is_disasm = cmd[1] == 'i';
int default_len = is_disasm? 32: 256;
@@ -1603,7 +1603,7 @@ static void printproperty(Cnfg *cc, int ii, Cfg_opts o) {
if(o.verb > 1)
term_out("# Mask 0x%02x of %s: %.*s\n", cc->t[ii].mask, cc[ii].memstr, cclen, ccom);
else if(*cc[ii].t->ccomment)
term_out("# %c%.*s\n", toupper(*cc[ii].t->ccomment), cclen - 1, cc[ii].t->ccomment + 1);
term_out("# %c%.*s\n", toupper(*cc[ii].t->ccomment & 0xff), cclen - 1, cc[ii].t->ccomment + 1);
else
term_out("# %s\n", cc[ii].t->name);
}

View File

@@ -230,9 +230,9 @@ static void xbeeStatsAdd(struct XBeeStaticticsSummary *summary, struct timeval c
static void xbeeStatsSummarise(struct XBeeStaticticsSummary const *summary) {
pmsg_notice(" Minimum response time: %lu.%06lu\n",
summary->minimum.tv_sec, (unsigned long) summary->minimum.tv_usec);
(unsigned long) summary->minimum.tv_sec, (unsigned long) summary->minimum.tv_usec);
pmsg_notice(" Maximum response time: %lu.%06lu\n",
summary->maximum.tv_sec, (unsigned long) summary->maximum.tv_usec);
(unsigned long) summary->maximum.tv_sec, (unsigned long) summary->maximum.tv_usec);
struct timeval average;
@@ -247,7 +247,8 @@ static void xbeeStatsSummarise(struct XBeeStaticticsSummary const *summary) {
average.tv_sec += usecs/1000000;
average.tv_usec = usecs%1000000;
pmsg_notice(" Average response time: %lu.%06lu\n", average.tv_sec, (unsigned long) average.tv_usec);
pmsg_notice(" Average response time: %lu.%06lu\n", (unsigned long) average.tv_sec,
(unsigned long) average.tv_usec);
}
static void XBeeBootSessionInit(struct XBeeBootSession *xbs) {