X-Git-Url: https://jxself.org/git/?p=carl9170fw.git;a=blobdiff_plain;f=config%2Fsymbol.c;h=020a0ac147e103ec65740fbd4b1d4ac20109fd2a;hp=387d554838828de87d82b829ae0dfd9b464feaa2;hb=4c9a4d5505c463aa2a35b6a199910fd92e387566;hpb=3c443264cbef7b1e1fe08cc51cb7ad6d5752e7ae diff --git a/config/symbol.c b/config/symbol.c index 387d554..020a0ac 100644 --- a/config/symbol.c +++ b/config/symbol.c @@ -136,7 +136,7 @@ static struct property *sym_get_range_prop(struct symbol *sym) return NULL; } -static int sym_get_range_val(struct symbol *sym, int base) +static long sym_get_range_val(struct symbol *sym, int base) { sym_calc_value(sym); switch (sym->type) { @@ -155,7 +155,7 @@ static int sym_get_range_val(struct symbol *sym, int base) static void sym_validate_range(struct symbol *sym) { struct property *prop; - int base, val, val2; + long base, val, val2; char str[64]; switch (sym->type) { @@ -179,9 +179,9 @@ static void sym_validate_range(struct symbol *sym) return; } if (sym->type == S_INT) - sprintf(str, "%d", val2); + sprintf(str, "%ld", val2); else - sprintf(str, "0x%x", val2); + sprintf(str, "0x%lx", val2); sym->curr.val = strdup(str); } @@ -594,7 +594,7 @@ bool sym_string_valid(struct symbol *sym, const char *str) bool sym_string_within_range(struct symbol *sym, const char *str) { struct property *prop; - int val; + long val; switch (sym->type) { case S_STRING: @@ -967,7 +967,7 @@ static int sym_rel_comp( const void *sym1, const void *sym2 ) { struct sym_match *s1 = *(struct sym_match **)sym1; struct sym_match *s2 = *(struct sym_match **)sym2; - int l1, l2; + int exact1, exact2; /* Exact match: * - if matched length on symbol s1 is the length of that symbol, @@ -978,11 +978,11 @@ static int sym_rel_comp( const void *sym1, const void *sym2 ) * exactly; if this is the case, we can't decide which comes first, * and we fallback to sorting alphabetically. */ - l1 = s1->eo - s1->so; - l2 = s2->eo - s2->so; - if (l1 == strlen(s1->sym->name) && l2 != strlen(s2->sym->name)) + exact1 = (s1->eo - s1->so) == strlen(s1->sym->name); + exact2 = (s2->eo - s2->so) == strlen(s2->sym->name); + if (exact1 && !exact2) return -1; - if (l1 != strlen(s1->sym->name) && l2 == strlen(s2->sym->name)) + if (!exact1 && exact2) return 1; /* As a fallback, sort symbols alphabetically */