Alexandre Julliard : wrc: Only allow control key characters ^A to ^Z.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Feb 22 08:57:38 CST 2016


Module: wine
Branch: master
Commit: e8076eeced9b49b2e1211dd3f009105b39ed75bb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e8076eeced9b49b2e1211dd3f009105b39ed75bb

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sat Feb 20 13:29:45 2016 +0900

wrc: Only allow control key characters ^A to ^Z.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 tools/wrc/genres.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/wrc/genres.c b/tools/wrc/genres.c
index e23c789..336e64e 100644
--- a/tools/wrc/genres.c
+++ b/tools/wrc/genres.c
@@ -297,8 +297,11 @@ static int parse_accel_string( const string_t *key, int flags )
 	}
 	else if(key->str.cstr[0] == '^')
 	{
-            keycode = toupper((unsigned char)key->str.cstr[1]) - '@';
-            if(keycode >= ' ')
+            if (key->str.cstr[1] >= 'a' && key->str.cstr[1] <= 'z')
+                keycode = key->str.cstr[1] - 'a' + 1;
+            else if (key->str.cstr[1] >= 'A' && key->str.cstr[1] <= 'Z')
+                keycode = key->str.cstr[1] - 'A' + 1;
+            else
             {
                 print_location( &key->loc );
                 error("Control-code out of range\n");
@@ -324,8 +327,11 @@ static int parse_accel_string( const string_t *key, int flags )
 	}
 	else if(key->str.wstr[0] == '^')
 	{
-            keycode = toupperW(key->str.wstr[1]) - '@';
-            if(keycode >= ' ')
+            if (key->str.wstr[1] >= 'a' && key->str.wstr[1] <= 'z')
+                keycode = key->str.wstr[1] - 'a' + 1;
+            else if (key->str.wstr[1] >= 'A' && key->str.wstr[1] <= 'Z')
+                keycode = key->str.wstr[1] - 'A' + 1;
+            else
             {
                 print_location( &key->loc );
                 error("Control-code out of range\n");




More information about the wine-cvs mailing list