[haiku-commits] r37586 - in haiku/trunk/src: kits/locale tools/locale

  • From: pulkomandy@xxxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 19 Jul 2010 13:21:11 +0200 (CEST)

Author: pulkomandy
Date: 2010-07-19 13:21:11 +0200 (Mon, 19 Jul 2010)
New Revision: 37586
Changeset: http://dev.haiku-os.org/changeset/37586

Modified:
   haiku/trunk/src/kits/locale/HashMapCatalog.cpp
   haiku/trunk/src/tools/locale/HashMapCatalog.cpp
Log:
 * Fix bug spotted by Rimas Kudelis : if an escaped sequence (such as \xA9) was 
immediately followed by other digits, 
collectcatkeys parsed all the digits instead of just the two associated to the 
\x, leading to wrong characters in thecatkeys 
file.


Modified: haiku/trunk/src/kits/locale/HashMapCatalog.cpp
===================================================================
--- haiku/trunk/src/kits/locale/HashMapCatalog.cpp      2010-07-19 11:18:25 UTC 
(rev 37585)
+++ haiku/trunk/src/kits/locale/HashMapCatalog.cpp      2010-07-19 11:21:11 UTC 
(rev 37586)
@@ -161,7 +161,11 @@
                                *out = '"';
                        else if (*in == 'x') {
                                // Parse the 2-digit hex integer that follows
-                               unsigned int hexchar = strtoul(in + 1, NULL, 
16);
+                               char tmp[3];
+                               tmp[0] = *(in+1);
+                               tmp[1] = *(in+2);
+                               tmp[3] = '\0';
+                               unsigned int hexchar = strtoul(tmp, NULL, 16);
                                *out = hexchar;
                                // skip the number
                                in += 2;

Modified: haiku/trunk/src/tools/locale/HashMapCatalog.cpp
===================================================================
--- haiku/trunk/src/tools/locale/HashMapCatalog.cpp     2010-07-19 11:18:25 UTC 
(rev 37585)
+++ haiku/trunk/src/tools/locale/HashMapCatalog.cpp     2010-07-19 11:21:11 UTC 
(rev 37586)
@@ -165,7 +165,11 @@
                                *out = '"';
                        else if (*in == 'x') {
                                // Parse the 2-digit hex integer that follows
-                               unsigned int hexchar = strtoul(in + 1, NULL, 
16);
+                               char tmp[3];
+                               tmp[0] = *(in+1);
+                               tmp[1] = *(in+2);
+                               tmp[3] = '\0';
+                               unsigned int hexchar = strtoul(tmp, NULL, 16);
                                *out = hexchar;
                                // skip the number
                                in += 2;


Other related posts: