annotate uptools/libcoding/hexdecode2.c @ 1011:6d9b10633f10

etmsync Pirelli IMEI retrieval: fix poor use of printf() Bug reported by Vadim Yanitskiy <fixeria@osmocom.org>: the construct where a static-allocated string was passed to printf() without any format arguments causes newer compilers to report a security problem. Given that formatted output is not needed here, just fixed string output, change printf() to fputs(), and direct the error message to stderr while at it.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 23 May 2024 17:29:57 +0000
parents ec7e23d5151f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
966
ec7e23d5151f fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
ec7e23d5151f fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module is a subset of hexdigits.c from fc-sim-tools/libutil.
ec7e23d5151f fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
ec7e23d5151f fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
ec7e23d5151f fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 decode_hex_digit(c)
ec7e23d5151f fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 {
ec7e23d5151f fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 if (c >= '0' && c <= '9')
ec7e23d5151f fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 return(c - '0');
ec7e23d5151f fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 if (c >= 'A' && c <= 'F')
ec7e23d5151f fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 return(c - 'A' + 10);
ec7e23d5151f fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 if (c >= 'a' && c <= 'f')
ec7e23d5151f fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 return(c - 'a' + 10);
ec7e23d5151f fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 return(-1);
ec7e23d5151f fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 }