Akihiro Sagawa : kernel32: Short circuit required length calculation.

Alexandre Julliard julliard at winehq.org
Fri Sep 23 10:25:16 CDT 2016


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

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Fri Sep 23 00:06:15 2016 +0900

kernel32: Short circuit required length calculation.

Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/locale.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index 24911e8..422d63f 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -3207,17 +3207,22 @@ INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, LPCWSTR src, INT srclen, LPW
     {
         INT len;
 
-        for (len = 0; srclen; src++, srclen--)
+        if (flags & NORM_IGNORESYMBOLS)
         {
-            WCHAR wch = *src;
-            /* tests show that win2k just ignores NORM_IGNORENONSPACE,
-             * and skips white space and punctuation characters for
-             * NORM_IGNORESYMBOLS.
-             */
-            if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
-                continue;
-            len++;
+            for (len = 0; srclen; src++, srclen--)
+            {
+                WCHAR wch = *src;
+                /* tests show that win2k just ignores NORM_IGNORENONSPACE,
+                 * and skips white space and punctuation characters for
+                 * NORM_IGNORESYMBOLS.
+                 */
+                if (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE))
+                    continue;
+                len++;
+            }
         }
+        else
+            len = srclen;
         return len;
     }
 




More information about the wine-cvs mailing list