aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2002-04-09 15:36:43 +0000
committerNick Clifton <nickc@redhat.com>2002-04-09 15:36:43 +0000
commit4c30641a0f5551dff885ff61a7b7368a81a77421 (patch)
treeeff43f00afa2ebf3beb9b0d4854cff57c355096c
parent2ed5f585e4f1b7f0c719d704807f994938613a4c (diff)
downloadgdb-4c30641a0f5551dff885ff61a7b7368a81a77421.zip
gdb-4c30641a0f5551dff885ff61a7b7368a81a77421.tar.gz
gdb-4c30641a0f5551dff885ff61a7b7368a81a77421.tar.bz2
Fix parsing hex constants in strings. Add test for the fix.
-rw-r--r--binutils/ChangeLog4
-rw-r--r--binutils/rclex.l10
-rw-r--r--binutils/testsuite/ChangeLog4
-rw-r--r--binutils/testsuite/binutils-all/windres/escapex.rc4
-rw-r--r--binutils/testsuite/binutils-all/windres/escapex.rsd8
5 files changed, 24 insertions, 6 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 18f1baa..f1fab3f 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -2,7 +2,9 @@
* rcparse.y: CLASS definitions in DIALOG resources
are quoted.
- Fix typo in BEDIT warning
+ Fix typo in BEDIT warning.
+
+ * rclex.l: "\xhex" encoding in strings corrected.
2002-04-09 Gunnar Degnbol <degnbol@danbbs.dk>
diff --git a/binutils/rclex.l b/binutils/rclex.l
index c9073e2..f20c82f 100644
--- a/binutils/rclex.l
+++ b/binutils/rclex.l
@@ -1,5 +1,5 @@
%{ /* rclex.l -- lexer for Windows rc files parser */
-/* Copyright 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
+/* Copyright 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
@@ -284,11 +284,11 @@ cpp_line (s)
if (!initial_fn)
{
initial_fn = xmalloc (strlen (fn) + 1);
- strcpy(initial_fn, fn);
+ strcpy (initial_fn, fn);
}
/* Allow the initial file, regardless of name. Suppress all other
- files if they end in ".h" (this allows included "*.rc") */
+ files if they end in ".h" (this allows included "*.rc"). */
if (strcmp (initial_fn, fn) == 0
|| strcmp (fn + strlen (fn) - 2, ".h") != 0)
suppress_cpp_data = 0;
@@ -394,9 +394,9 @@ handle_quotes (input, len)
if (*t >= '0' && *t <= '9')
ch = (ch << 4) | (*t - '0');
else if (*t >= 'a' && *t <= 'f')
- ch = (ch << 4) | (*t - 'a');
+ ch = (ch << 4) | (*t - 'a' + 10);
else if (*t >= 'A' && *t <= 'F')
- ch = (ch << 4) | (*t - 'A');
+ ch = (ch << 4) | (*t - 'A' + 10);
else
break;
++t;
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index e61a687..9c84fd7 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2002-04-09 Nick Clifton <nickc@cambridge.redhat.com>
+ * binutils-all/windres/escapex.rc: New test case for hex constants
+ in strings.
+ * binutils-all/windres/escapex.rsd: Expected output
+
* binutils-all/windres/quoteclass.rc: New test case for quoted
CLASS definitions in DIALOG resources.
diff --git a/binutils/testsuite/binutils-all/windres/escapex.rc b/binutils/testsuite/binutils-all/windres/escapex.rc
new file mode 100644
index 0000000..1a025f6
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/escapex.rc
@@ -0,0 +1,4 @@
+101 DIALOG DISCARDABLE 0, 0, 186, 95
+BEGIN
+ LTEXT "\xB0",-1,23,46,28,8
+END
diff --git a/binutils/testsuite/binutils-all/windres/escapex.rsd b/binutils/testsuite/binutils-all/windres/escapex.rsd
new file mode 100644
index 0000000..9165342
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/escapex.rsd
@@ -0,0 +1,8 @@
+ 0000 00000000 20000000 ffff0000 ffff0000 .... ...........
+ 0010 00000000 00000000 00000000 00000000 ................
+ 0020 34000000 20000000 ffff0500 ffff6500 4... .........e.
+ 0030 00000000 10100000 00000000 00000000 ................
+ 0040 00008880 00000000 01000000 0000ba00 ................
+ 0050 5f000000 00000000 00000250 00000000 _..........P....
+ 0060 17002e00 1c000800 ffffffff 8200b000 ................
+ 0070 00000000 ....