FoldStringA/W

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

This patch uses the new libunicode functions to implement
FoldStringA/W.

Cheers,
Jon

License: X11

Changelog:

  Jon Griffiths <jon_p_griffiths@yahoo.com>
  +dlls/kernel/kernel32.spec dlls/kernel/locale.c
    Implement FoldStringA/W



__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
--- wine/dlls/kernel/kernel32.spec	2003-10-10 11:47:14.000000000 +0100
+++ wine-develop/dlls/kernel/kernel32.spec	2003-10-10 12:38:34.000000000 +0100
@@ -322,8 +322,8 @@
 @ stdcall FlushFileBuffers(long)
 @ stdcall FlushInstructionCache(long long long)
 @ stdcall FlushViewOfFile(ptr long)
-@ stub FoldStringA
-@ stub FoldStringW
+@ stdcall FoldStringA(long str long ptr long)
+@ stdcall FoldStringW(long wstr long ptr long)
 @ stdcall FormatMessageA(long ptr long long ptr long ptr)
 @ stdcall FormatMessageW(long ptr long long ptr long ptr)
 @ stdcall FreeConsole()
--- wine/dlls/kernel/locale.c	2003-10-02 15:10:48.000000000 +0100
+++ wine-develop/dlls/kernel/locale.c	2003-10-13 14:18:04.000000000 +0100
@@ -1005,7 +1005,7 @@
  *   not SUBLANG_NEUTRAL.
  *  GetSystemDefaultLCID(), if lcid == LOCALE_SYSTEM_DEFAULT.
  *  GetUserDefaultLCID(), if lcid == LOCALE_USER_DEFAULT or LOCALE_NEUTRAL.
- *  Otherwise, lcid with sublanguage cheanged to SUBLANG_DEFAULT.
+ *  Otherwise, lcid with sublanguage changed to SUBLANG_DEFAULT.
  */
 LCID WINAPI ConvertDefaultLocale( LCID lcid )
 {
@@ -1443,8 +1443,93 @@
     return ret;
 }
 
+/*************************************************************************
+ *           FoldStringA    (KERNEL32.@)
+ *
+ * Map characters in a string.
+ *
+ * PARAMS
+ *  dwFlags [I] Flags controlling chars to map (MAP_ constants from "winnls.h")
+ *  src     [I] String to map
+ *  srclen  [I] Length of src, or -1 if src is NUL terminated
+ *  dst     [O] Destination for mapped string
+ *  dstlen  [I] Length of dst, or 0 to find the required length for the mapped string
+ *
+ * RETURNS
+ *  Success: The length of the string written to dst, including the terminating NUL. If
+ *           dstlen is 0, the value returned is the same, but nothing is written to dst,
+ *           and dst may be NULL.
+ *  Failure: 0. Use GetLastError() to determine the cause.
+ */
+INT WINAPI FoldStringA(DWORD dwFlags, LPCSTR src, INT srclen,
+                       LPSTR dst, INT dstlen)
+{
+    int ret;
+
+    switch (dwFlags & (MAP_COMPOSITE|MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES))
+    {
+    case 0:
+        if (dwFlags)
+          break;
+        /* Fall through for dwFlags == 0 */
+    case MAP_PRECOMPOSED|MAP_COMPOSITE:
+    case MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES:
+    case MAP_COMPOSITE|MAP_EXPAND_LIGATURES:
+        SetLastError(ERROR_INVALID_FLAGS);
+        return 0;
+    }
+
+    if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return 0;
+    }
+
+    ret = wine_fold_stringA(dwFlags, src, srclen, dst, dstlen);
+    if (!ret)
+        SetLastError(ERROR_INSUFFICIENT_BUFFER);
+    return ret;
+}
+
+/*************************************************************************
+ *           FoldStringW    (KERNEL32.@)
+ *
+ * See FoldStringA.
+ */
+INT WINAPI FoldStringW(DWORD dwFlags, LPCWSTR src, INT srclen,
+                       LPWSTR dst, INT dstlen)
+{
+    int ret;
+
+    switch (dwFlags & (MAP_COMPOSITE|MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES))
+    {
+    case 0:
+        if (dwFlags)
+          break;
+        /* Fall through for dwFlags == 0 */
+    case MAP_PRECOMPOSED|MAP_COMPOSITE:
+    case MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES:
+    case MAP_COMPOSITE|MAP_EXPAND_LIGATURES:
+        SetLastError(ERROR_INVALID_FLAGS);
+        return 0;
+    }
+
+    if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return 0;
+    }
+
+    ret = wine_fold_stringW(dwFlags, src, srclen, dst, dstlen);
+    if (!ret)
+        SetLastError(ERROR_INSUFFICIENT_BUFFER);
+    return ret;
+}
+
 /******************************************************************************
  *           CompareStringW    (KERNEL32.@)
+ *
+ * See CompareStringA.
  */
 INT WINAPI CompareStringW(LCID lcid, DWORD style,
                           LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux