Date: Sun, 28 Mar 2004 16:58:28 -0800 (PST) From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 49858 for review Message-ID: <200403290058.i2T0wSSa069055@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=49858 Change 49858 by marcel@marcel_nfs on 2004/03/28 16:57:53 Fix gdb_rx_varhex(): make sure the rx pointer is moved back correctly in all cases when we fetch a non-hex digit. Affected files ... .. //depot/projects/gdb/sys/gdb/gdb_packet.c#8 edit Differences ... ==== //depot/projects/gdb/sys/gdb/gdb_packet.c#8 (text+ko) ==== @@ -114,29 +114,29 @@ gdb_rx_varhex(uintmax_t *vp) { uintmax_t v; - int c, neg, valid; + int c, neg; c = gdb_rx_char(); - if (c == -1) - return (-1); neg = (c == '-') ? 1 : 0; if (neg == 1) c = gdb_rx_char(); + if (!isxdigit(c)) { + gdb_rxp -= ((c == -1) ? 0 : 1) + neg; + gdb_rxsz += ((c == -1) ? 0 : 1) + neg; + return (-1); + } v = 0; - valid = (isxdigit(c)) ? 1 : 0; - while (valid) { + do { v <<= 4; v += C2N(c); c = gdb_rx_char(); - if (!isxdigit(c)) - break; + } while (isxdigit(c)); + if (c != -1) { + gdb_rxp--; + gdb_rxsz++; } - if (!valid || c != -1) { - gdb_rxp -= 1 + neg - valid; - gdb_rxsz += 1 + neg - valid; - } *vp = (neg) ? -v : v; - return ((valid) ? 0 : -1); + return (0); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403290058.i2T0wSSa069055>