From c79f3e5887dde9f43ff7ac27fbe460eea0611105 Mon Sep 17 00:00:00 2001
From: tatyana <tatyana@etersoft.ru>
Date: Tue, 15 Jan 2013 14:32:19 +0400
Subject: [eter-2.0.0 2/2] kernel32: MBTWC calling with StaticUnicodeBuffer
 only if size of strings <=130(eterbug #8821)

---
 dlls/kernel32/locale.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index 3b2cbc0..4c3b0b8 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -2872,9 +2872,12 @@ INT WINAPI CompareStringA(LCID lcid, DWORD style,
     
     if (!(style & LOCALE_USE_CP_ACP)) locale_cp = get_lcid_codepage( lcid );
 
-    len1W = MultiByteToWideChar(locale_cp, 0, str1, len1, buf1W, 130);
-    if (len1W)
-        str1W = buf1W;
+    if (len1 <= 130)
+    {
+        len1W = MultiByteToWideChar(locale_cp, 0, str1, len1, buf1W, 130);
+        if (len1W)
+            str1W = buf1W;
+    }
     else
     {
         len1W = MultiByteToWideChar(locale_cp, 0, str1, len1, NULL, 0);
@@ -2886,9 +2889,12 @@ INT WINAPI CompareStringA(LCID lcid, DWORD style,
         }
         MultiByteToWideChar(locale_cp, 0, str1, len1, str1W, len1W);
     }
-    len2W = MultiByteToWideChar(locale_cp, 0, str2, len2, buf2W, 130);
-    if (len2W)
-        str2W = buf2W;
+    if (len2 <= 130)
+    {
+        len2W = MultiByteToWideChar(locale_cp, 0, str2, len2, buf2W, 130);
+        if (len2W)
+            str2W = buf2W;
+    }
     else
     {
         len2W = MultiByteToWideChar(locale_cp, 0, str2, len2, NULL, 0);
-- 
1.8.0.3
