[shlwapi] Get rid of dependencies to libunicode

Thomas Weidenmueller w3seek at reactos.com
Tue Feb 15 16:38:22 CST 2005


The attached patch removes dependencies to libunicode and forwards some 
functions (as documented) to user32
-------------- next part --------------
Index: dlls/shlwapi/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/Makefile.in,v
retrieving revision 1.31
diff -u -r1.31 Makefile.in
--- dlls/shlwapi/Makefile.in	1 Jun 2004 19:45:34 -0000	1.31
+++ dlls/shlwapi/Makefile.in	15 Feb 2005 22:35:05 -0000
@@ -6,7 +6,7 @@
 MODULE    = shlwapi.dll
 IMPORTS   = ole32 user32 gdi32 advapi32 kernel32 ntdll
 DELAYIMPORTS = oleaut32
-EXTRALIBS = -luuid $(LIBUNICODE)
+EXTRALIBS = -luuid
 
 C_SRCS = \
 	assoc.c \
Index: dlls/shlwapi/ordinal.c
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/ordinal.c,v
retrieving revision 1.104
diff -u -r1.104 ordinal.c
--- dlls/shlwapi/ordinal.c	15 Feb 2005 21:51:07 -0000	1.104
+++ dlls/shlwapi/ordinal.c	15 Feb 2005 22:34:41 -0000
@@ -44,7 +44,6 @@
 #include "shlobj.h"
 #include "shellapi.h"
 #include "commdlg.h"
-#include "wine/unicode.h"
 #include "winreg.h"
 #include "wine/debug.h"
 #include "shlwapi.h"
@@ -571,10 +570,10 @@
         /* handle returned string */
         FIXME("missing code\n");
     }
-    memcpy( langbuf, mystr, min(*buflen,strlenW(mystr)+1)*sizeof(WCHAR) );
+    memcpy( langbuf, mystr, min(*buflen,wcslen(mystr)+1)*sizeof(WCHAR) );
 
-    if(*buflen > strlenW(mystr)) {
-	*buflen = strlenW(mystr);
+    if(*buflen > wcslen(mystr)) {
+	*buflen = wcslen(mystr);
 	retval = S_OK;
     } else {
 	*buflen = 0;
@@ -668,11 +667,11 @@
 
   TRACE("(%s,%p,%d)\n", debugstr_guid(guid), lpszDest, cchMax);
 
-  sprintfW(xguid, wszFormat, guid->Data1, guid->Data2, guid->Data3,
-          guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
-          guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
+  wsprintfW(xguid, wszFormat, guid->Data1, guid->Data2, guid->Data3,
+            guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
+            guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
 
-  iLen = strlenW(xguid) + 1;
+  iLen = wcslen(xguid) + 1;
 
   if (iLen > cchMax)
     return 0;
@@ -681,74 +680,6 @@
 }
 
 /*************************************************************************
- *      @	[SHLWAPI.25]
- *
- * Determine if a Unicode character is alphabetic.
- *
- * PARAMS
- *  wc [I] Character to check.
- *
- * RETURNS
- *  TRUE, if wc is alphabetic,
- *  FALSE otherwise.
- */
-BOOL WINAPI IsCharAlphaWrapW(WCHAR wc)
-{
-    return (get_char_typeW(wc) & C1_ALPHA) != 0;
-}
-
-/*************************************************************************
- *      @	[SHLWAPI.26]
- *
- * Determine if a Unicode character is upper-case.
- *
- * PARAMS
- *  wc [I] Character to check.
- *
- * RETURNS
- *  TRUE, if wc is upper-case,
- *  FALSE otherwise.
- */
-BOOL WINAPI IsCharUpperWrapW(WCHAR wc)
-{
-    return (get_char_typeW(wc) & C1_UPPER) != 0;
-}
-
-/*************************************************************************
- *      @	[SHLWAPI.27]
- *
- * Determine if a Unicode character is lower-case.
- *
- * PARAMS
- *  wc [I] Character to check.
- *
- * RETURNS
- *  TRUE, if wc is lower-case,
- *  FALSE otherwise.
- */
-BOOL WINAPI IsCharLowerWrapW(WCHAR wc)
-{
-    return (get_char_typeW(wc) & C1_LOWER) != 0;
-}
-
-/*************************************************************************
- *      @	[SHLWAPI.28]
- *
- * Determine if a Unicode character is alphabetic or a digit.
- *
- * PARAMS
- *  wc [I] Character to check.
- *
- * RETURNS
- *  TRUE, if wc is alphabetic or a digit,
- *  FALSE otherwise.
- */
-BOOL WINAPI IsCharAlphaNumericWrapW(WCHAR wc)
-{
-    return (get_char_typeW(wc) & (C1_ALPHA|C1_DIGIT)) != 0;
-}
-
-/*************************************************************************
  *      @	[SHLWAPI.29]
  *
  * Determine if a Unicode character is a space.
@@ -762,7 +693,12 @@
  */
 BOOL WINAPI IsCharSpaceW(WCHAR wc)
 {
-    return (get_char_typeW(wc) & C1_SPACE) != 0;
+    WORD CharType;
+    
+    if(GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && CharType == C1_SPACE)
+       return TRUE;
+    else
+       return FALSE;
 }
 
 /*************************************************************************
@@ -780,7 +716,12 @@
  */
 BOOL WINAPI IsCharBlankW(WCHAR wc)
 {
-    return (get_char_typeW(wc) & C1_BLANK) != 0;
+    WORD CharType;
+
+    if(GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && CharType == C1_BLANK)
+       return TRUE;
+    else
+       return FALSE;
 }
 
 /*************************************************************************
@@ -797,7 +738,12 @@
  */
 BOOL WINAPI IsCharPunctW(WCHAR wc)
 {
-    return (get_char_typeW(wc) & C1_PUNCT) != 0;
+    WORD CharType;
+
+    if(GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && CharType == C1_PUNCT)
+       return TRUE;
+    else
+       return FALSE;
 }
 
 /*************************************************************************
@@ -814,7 +760,12 @@
  */
 BOOL WINAPI IsCharCntrlW(WCHAR wc)
 {
-    return (get_char_typeW(wc) & C1_CNTRL) != 0;
+    WORD CharType;
+
+    if(GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && CharType == C1_CNTRL)
+       return TRUE;
+    else
+       return FALSE;
 }
 
 /*************************************************************************
@@ -831,7 +782,12 @@
  */
 BOOL WINAPI IsCharDigitW(WCHAR wc)
 {
-    return (get_char_typeW(wc) & C1_DIGIT) != 0;
+    WORD CharType;
+
+    if(GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && CharType == C1_DIGIT)
+       return TRUE;
+    else
+       return FALSE;
 }
 
 /*************************************************************************
@@ -848,7 +804,12 @@
  */
 BOOL WINAPI IsCharXDigitW(WCHAR wc)
 {
-    return (get_char_typeW(wc) & C1_XDIGIT) != 0;
+    WORD CharType;
+
+    if(GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && CharType == C1_XDIGIT)
+       return TRUE;
+    else
+       return FALSE;
 }
 
 /*************************************************************************
@@ -956,7 +917,7 @@
  */
 DWORD WINAPI StrCmpNCW(LPCWSTR lpszSrc, LPCWSTR lpszCmp, INT len)
 {
-    return strncmpW(lpszSrc, lpszCmp, len);
+    return wcsncmp(lpszSrc, lpszCmp, len);
 }
 
 /*************************************************************************
@@ -985,7 +946,7 @@
  */
 DWORD WINAPI StrCmpNICW(LPCWSTR lpszSrc, LPCWSTR lpszCmp, DWORD len)
 {
-    return strncmpiW(lpszSrc, lpszCmp, len);
+    return wcsnicmp(lpszSrc, lpszCmp, len);
 }
 
 /*************************************************************************
@@ -1013,7 +974,7 @@
  */
 DWORD WINAPI StrCmpCW(LPCWSTR lpszSrc, LPCWSTR lpszCmp)
 {
-    return strcmpW(lpszSrc, lpszCmp);
+    return wcscmp(lpszSrc, lpszCmp);
 }
 
 /*************************************************************************
@@ -1041,7 +1002,7 @@
  */
 DWORD WINAPI StrCmpICW(LPCWSTR lpszSrc, LPCWSTR lpszCmp)
 {
-    return strcmpiW(lpszSrc, lpszCmp);
+    return wcsicmp(lpszSrc, lpszCmp);
 }
 
 /*************************************************************************
@@ -1124,7 +1085,7 @@
   dwLen = 30;
   if (!SHGetValueW(HKEY_LOCAL_MACHINE, szIEKey, szVersion, &dwType, buff, &dwLen))
   {
-    DWORD dwStrLen = strlenW(buff);
+    DWORD dwStrLen = wcslen(buff);
     dwLen = 30 - dwStrLen;
     SHGetValueW(HKEY_LOCAL_MACHINE, szIEKey,
                 szCustomized, &dwType, buff+dwStrLen, &dwLen);
@@ -3315,9 +3276,9 @@
     len = GetModuleFileNameW(inst_hwnd, mod_path, sizeof(mod_path) / sizeof(WCHAR));
     if (!len || len >= sizeof(mod_path) / sizeof(WCHAR)) return NULL;
 
-    ptr = strrchrW(mod_path, '\\');
+    ptr = wcsrchr(mod_path, '\\');
     if (ptr) {
-	strcpyW(ptr+1, new_mod);
+	wcscpy(ptr+1, new_mod);
 	TRACE("loading %s\n", debugstr_w(mod_path));
 	return LoadLibraryW(mod_path);
     }
@@ -3603,7 +3564,7 @@
 	}
 	else {  /* validate the CLSID string */
 
-	  if (strlenW(s) != 38)
+	  if (wcslen(s) != 38)
 	    return E_INVALIDARG;
 
 	  if ((s[0]!=L'{') || (s[9]!=L'-') || (s[14]!=L'-') || (s[19]!=L'-') || (s[24]!=L'-') || (s[37]!=L'}'))
Index: dlls/shlwapi/shlwapi.spec
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/shlwapi.spec,v
retrieving revision 1.98
diff -u -r1.98 shlwapi.spec
--- dlls/shlwapi/shlwapi.spec	3 Feb 2005 13:34:05 -0000	1.98
+++ dlls/shlwapi/shlwapi.spec	15 Feb 2005 22:34:41 -0000
@@ -22,10 +22,10 @@
 22  stdcall -noname SHFindDataBlock(ptr long)
 23  stdcall -noname SHStringFromGUIDA(ptr ptr long)
 24  stdcall -noname SHStringFromGUIDW(ptr ptr long)
-25  stdcall -noname IsCharAlphaWrapW(long)
-26  stdcall -noname IsCharUpperWrapW(long)
-27  stdcall -noname IsCharLowerWrapW(long)
-28  stdcall -noname IsCharAlphaNumericWrapW(long)
+25  stdcall -noname IsCharAlphaWrapW(long) user32.IsCharAlphaW
+26  stdcall -noname IsCharUpperWrapW(long) user32.IsCharUpperW
+27  stdcall -noname IsCharLowerWrapW(long) user32.IsCharLowerW
+28  stdcall -noname IsCharAlphaNumericWrapW(long) user32.IsCharAlphaNumericW
 29  stdcall -noname IsCharSpaceW(long)
 30  stdcall -noname IsCharBlankW(long)
 31  stdcall -noname IsCharPunctW(long)


More information about the wine-patches mailing list