Motonori Shindo <mshindo@xxxxxxxxxxx> writes:
> Hi,
>
> Today I looked at packet-x11-keysym.h and found that it embeds a raw
> 8-bit character in a string, which is not a good idea generally. It is
> less editable and, even worse, some compiler (notably Japanized
> version of MS Visual C++) fail to compile it because a character with
> MSB being set is recognized as the 1st byte of 2-byte character
> (Kanji) and subsequent byte (double-quote) is recognized as the second
> half of Kanji character, ending up with an open-ended string.
>
> To avoid this problem, a character with MSB=1 should be expressed
> using an octal notation in a string (i.e. \xxx). I enclosed a patch
> that does it. I confirmed that a new code generates exactly the same
> object file as before, and hence there's no change in the executable.
This seemed reasonable and an easy problem to fix so I did a quick
grep for lines with "a character with MSB=1". Attached are the two
trivial patches.
I ignored all comments with Michael T�xen's name in them.
I also stripped and diffed the object files to confirm that the
generated code is identical.
Index: packet-gtp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-gtp.c,v
retrieving revision 1.10
diff -u -r1.10 packet-gtp.c
--- packet-gtp.c 2001/09/27 10:01:07 1.10
+++ packet-gtp.c 2001/10/03 21:34:34
@@ -4050,7 +4050,8 @@
for(i=0 ; i<length ; i++) {
hdr = tvb_get_guint8(tvb, offset+2+i);
- proto_tree_add_text(ext_tree_hdr_list, tvb, offset+2+i, 1, "N�%u --> Extension Header Type value : %s (%u)", i+1, val_to_str(hdr, gtp_val, "Unknown Extension Header Type"), hdr);
+ /* \260 == � (degrees) */
+ proto_tree_add_text(ext_tree_hdr_list, tvb, offset+2+i, 1, "N\260%u --> Extension Header Type value : %s (%u)", i+1, val_to_str(hdr, gtp_val, "Unknown Extension Header Type"), hdr);
}
return 2 + length;
Index: packet-x11.c
===================================================================
RCS file: /cvsroot/ethereal/packet-x11.c,v
retrieving revision 1.22
diff -u -r1.22 packet-x11.c
--- packet-x11.c 2001/07/16 05:16:58 1.22
+++ packet-x11.c 2001/10/03 21:34:45
@@ -793,8 +793,9 @@
gint16 angle1 = VALUE16(tvb, cur_offset + 8);
gint16 angle2 = VALUE16(tvb, cur_offset + 10);
+ /* \260 == � (degrees) */
proto_tree *ttt = proto_tree_add_none_format(tt, hf_x11_arc, tvb, cur_offset, 12,
- "arc: %dx%d+%d+%d, angle %d -> %d (%f� -> %f�)",
+ "arc: %dx%d+%d+%d, angle %d -> %d (%f\260 -> %f\260)",
width, height, x, y, angle1, angle2,
angle1 / 64.0, angle2 / 64.0);
proto_tree_add_int(ttt, hf_x11_arc_x, tvb, cur_offset, 2, x); cur_offset += 2;
--
-Andrew Feren
Cetacean Networks, Inc.
Portsmouth, NH