From e2cc7215e8f2473016718aad117908a148f980be Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 19 Jul 2010 11:21:11 +0000 Subject: [PATCH] * 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. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37586 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/locale/HashMapCatalog.cpp | 6 +++++- src/tools/locale/HashMapCatalog.cpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/kits/locale/HashMapCatalog.cpp b/src/kits/locale/HashMapCatalog.cpp index cd3bcfc6e1..71ab423837 100644 --- a/src/kits/locale/HashMapCatalog.cpp +++ b/src/kits/locale/HashMapCatalog.cpp @@ -161,7 +161,11 @@ parseQuotedChars(BString& stringToParse) *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; diff --git a/src/tools/locale/HashMapCatalog.cpp b/src/tools/locale/HashMapCatalog.cpp index 4ce14a1d3f..7ef31c327b 100644 --- a/src/tools/locale/HashMapCatalog.cpp +++ b/src/tools/locale/HashMapCatalog.cpp @@ -165,7 +165,11 @@ parseQuotedChars(BString& stringToParse) *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;