Sync to Wine-20040505:

Francois Gouget <fgouget@free.fr>
- Make Unicode strings 'static const'.
- Assorted spelling fixes.
- Make our ascii strings static const.
- Remove a couple string variables that were used only once and use the
  string literal directly.
- Use named constants instead of magic numbers.
- Remove wszRegSeparator from devenum_private.h since it's neither
  exported by createdevenum.c nor used by anyone else.
Kevin Koltzau <kevin@plop.org>
- Allow UrlCombine to calculate size of required buffer.

svn path=/trunk/; revision=9330
This commit is contained in:
Gé van Geldorp 2004-05-08 13:49:05 +00:00
parent 1b91a499fe
commit f19704b04f
7 changed files with 41 additions and 81 deletions

View file

@ -2437,7 +2437,7 @@ typedef struct tagPOLICYDATA
#define SHELL_NO_POLICY 0xffffffff
/* default shell policy registry key */
static WCHAR strRegistryPolicyW[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o',
static const WCHAR strRegistryPolicyW[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o',
's','o','f','t','\\','W','i','n','d','o','w','s','\\',
'C','u','r','r','e','n','t','V','e','r','s','i','o','n',
'\\','P','o','l','i','c','i','e','s',0};
@ -2461,7 +2461,7 @@ DWORD WINAPI SHGetRestriction(LPCWSTR lpSubKey, LPCWSTR lpSubName, LPCWSTR lpVal
HKEY hKey;
if (!lpSubKey)
lpSubKey = (LPCWSTR)strRegistryPolicyW;
lpSubKey = strRegistryPolicyW;
retval = RegOpenKeyW(HKEY_LOCAL_MACHINE, lpSubKey, &hKey);
if (retval != ERROR_SUCCESS)
@ -2641,7 +2641,7 @@ DWORD WINAPI WhichPlatform()
GET_FUNC(pDllGetVersion, shell32, "DllGetVersion", 1);
dwState = pDllGetVersion ? 2 : 1;
/* Set or delete the key accordinly */
/* Set or delete the key accordingly */
dwRet = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Internet Explorer", 0,
KEY_ALL_ACCESS, &hKey);
@ -3887,7 +3887,7 @@ HRESULT WINAPI SHCoCreateInstanceAC(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
*/
BOOL WINAPI SHSkipJunction(IBindCtx *pbc, const CLSID *pclsid)
{
static WCHAR szSkipBinding[] = { 'S','k','i','p',' ',
static const WCHAR szSkipBinding[] = { 'S','k','i','p',' ',
'B','i','n','d','i','n','g',' ','C','L','S','I','D','\0' };
BOOL bRet = FALSE;
@ -3895,7 +3895,7 @@ BOOL WINAPI SHSkipJunction(IBindCtx *pbc, const CLSID *pclsid)
{
IUnknown* lpUnk;
if (SUCCEEDED(IBindCtx_GetObjectParam(pbc, szSkipBinding, &lpUnk)))
if (SUCCEEDED(IBindCtx_GetObjectParam(pbc, (LPOLESTR)szSkipBinding, &lpUnk)))
{
CLSID clsid;

View file

@ -1141,8 +1141,8 @@ BOOL WINAPI PathFileExistsDefExtA(LPSTR lpszPath,DWORD dwWhich)
*/
static BOOL WINAPI SHLWAPI_PathFindInOtherDirs(LPWSTR lpszFile, DWORD dwWhich)
{
static WCHAR szSystem[] = { 'S','y','s','t','e','m','\0'};
static WCHAR szPath[] = { 'P','A','T','H','\0'};
static const WCHAR szSystem[] = { 'S','y','s','t','e','m','\0'};
static const WCHAR szPath[] = { 'P','A','T','H','\0'};
DWORD dwLenPATH;
LPCWSTR lpszCurr;
WCHAR *lpszPATH;

View file

@ -1047,7 +1047,7 @@ DWORD WINAPI SHSetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue,
{
DWORD dwRet = ERROR_SUCCESS, dwDummy;
HKEY hSubKey;
char szEmpty[] = "";
static const char szEmpty[] = { '\0' };
TRACE("(hkey=%p,%s,%s,%ld,%p,%ld)\n", hKey, debugstr_a(lpszSubKey),
debugstr_a(lpszValue), dwType, pvData, cbData);
@ -1076,7 +1076,7 @@ DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue,
{
DWORD dwRet = ERROR_SUCCESS, dwDummy;
HKEY hSubKey;
WCHAR szEmpty[] = { '\0' };
static const WCHAR szEmpty[] = { '\0' };
TRACE("(hkey=%p,%s,%s,%ld,%p,%ld)\n", hKey, debugstr_w(lpszSubKey),
debugstr_w(lpszValue), dwType, pvData, cbData);

View file

@ -2530,7 +2530,7 @@ DWORD WINAPI SHAnsiToUnicode(LPCSTR lpSrcStr, LPWSTR lpDstStr, int iLen)
INT WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
LPINT lpiLen)
{
WCHAR emptyW[] = { '\0' };
static const WCHAR emptyW[] = { '\0' };
int len , reqLen;
LPSTR mem;

View file

@ -310,7 +310,7 @@ BOOL WINAPI SHCreateThread(LPTHREAD_START_ROUTINE pfnThreadProc, VOID *pData,
if(hThread)
{
/* Wait for the thread to signal us to continue */
WaitForSingleObject(ti.hEvent, -1);
WaitForSingleObject(ti.hEvent, INFINITE);
CloseHandle(hThread);
bCalled = TRUE;
}

View file

@ -643,7 +643,7 @@ HRESULT WINAPI UrlCombineA(LPCSTR pszBase, LPCSTR pszRelative,
debugstr_a(pszBase),debugstr_a(pszRelative),
pcchCombined?*pcchCombined:0,dwFlags);
if(!pszBase || !pszRelative || !pszCombined || !pcchCombined)
if(!pszBase || !pszRelative || !pcchCombined)
return E_INVALIDARG;
base = (LPWSTR) HeapAlloc(GetProcessHeap(), 0,
@ -653,10 +653,11 @@ HRESULT WINAPI UrlCombineA(LPCSTR pszBase, LPCSTR pszRelative,
MultiByteToWideChar(0, 0, pszBase, -1, base, INTERNET_MAX_URL_LENGTH);
MultiByteToWideChar(0, 0, pszRelative, -1, relative, INTERNET_MAX_URL_LENGTH);
len = INTERNET_MAX_URL_LENGTH;
len = *pcchCombined;
ret = UrlCombineW(base, relative, combined, &len, dwFlags);
ret = UrlCombineW(base, relative, pszCombined?combined:NULL, &len, dwFlags);
if (ret != S_OK) {
*pcchCombined = len;
HeapFree(GetProcessHeap(), 0, base);
return ret;
}
@ -667,7 +668,7 @@ HRESULT WINAPI UrlCombineA(LPCSTR pszBase, LPCSTR pszRelative,
HeapFree(GetProcessHeap(), 0, base);
return E_POINTER;
}
WideCharToMultiByte(0, 0, combined, len+1, pszCombined, *pcchCombined,
WideCharToMultiByte(0, 0, combined, len+1, pszCombined, (*pcchCombined)+1,
0, 0);
*pcchCombined = len2;
HeapFree(GetProcessHeap(), 0, base);
@ -687,15 +688,15 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
DWORD myflags, sizeloc = 0;
DWORD len, res1, res2, process_case = 0;
LPWSTR work, preliminary, mbase, mrelative;
WCHAR myfilestr[] = {'f','i','l','e',':','/','/','/','\0'};
WCHAR single_slash[] = {'/','\0'};
static const WCHAR myfilestr[] = {'f','i','l','e',':','/','/','/','\0'};
static const WCHAR single_slash[] = {'/','\0'};
HRESULT ret;
TRACE("(base %s, Relative %s, Combine size %ld, flags %08lx)\n",
debugstr_w(pszBase),debugstr_w(pszRelative),
pcchCombined?*pcchCombined:0,dwFlags);
if(!pszBase || !pszRelative || !pszCombined || !pcchCombined)
if(!pszBase || !pszRelative || !pcchCombined)
return E_INVALIDARG;
base.size = 24;
@ -829,12 +830,6 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
* Return pszRelative appended to what ever is in pszCombined,
* (which may the string "file:///"
*/
len = strlenW(mrelative) + strlenW(preliminary);
if (len+1 > *pcchCombined) {
*pcchCombined = len;
ret = E_POINTER;
break;
}
strcatW(preliminary, mrelative);
break;
@ -842,12 +837,6 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
* Same as case 1, but if URL_PLUGGABLE_PROTOCOL was specified
* and pszRelative starts with "//", then append a "/"
*/
len = strlenW(mrelative) + 1;
if (len+1 > *pcchCombined) {
*pcchCombined = len;
ret = E_POINTER;
break;
}
strcpyW(preliminary, mrelative);
if (!(dwFlags & URL_PLUGGABLE_PROTOCOL) &&
URL_JustLocation(relative.ap2))
@ -855,15 +844,9 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
break;
case 3: /*
* Return the pszBase scheme with pszRelative. Basicly
* Return the pszBase scheme with pszRelative. Basically
* keeps the scheme and replaces the domain and following.
*/
len = base.sizep1 + 1 + relative.sizep2 + 1;
if (len+1 > *pcchCombined) {
*pcchCombined = len;
ret = E_POINTER;
break;
}
strncpyW(preliminary, base.ap1, base.sizep1 + 1);
work = preliminary + base.sizep1 + 1;
strcpyW(work, relative.ap2);
@ -877,12 +860,6 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
* after the location is pszRelative. (Replace document
* from root on.)
*/
len = base.sizep1 + 1 + sizeloc + relative.sizep2 + 1;
if (len+1 > *pcchCombined) {
*pcchCombined = len;
ret = E_POINTER;
break;
}
strncpyW(preliminary, base.ap1, base.sizep1+1+sizeloc);
work = preliminary + base.sizep1 + 1 + sizeloc;
if (dwFlags & URL_PLUGGABLE_PROTOCOL)
@ -894,12 +871,6 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
* Return the pszBase without its document (if any) and
* append pszRelative after its scheme.
*/
len = base.sizep1 + 1 + base.sizep2 + relative.sizep2;
if (len+1 > *pcchCombined) {
*pcchCombined = len;
ret = E_POINTER;
break;
}
strncpyW(preliminary, base.ap1, base.sizep1+1+base.sizep2);
work = preliminary + base.sizep1+1+base.sizep2 - 1;
if (*work++ != L'/')
@ -913,21 +884,10 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
}
if (ret == S_OK) {
/*
* Now that the combining is done, process the escape options if
* necessary, otherwise just copy the string.
*/
myflags = dwFlags & (URL_ESCAPE_PERCENT |
URL_ESCAPE_SPACES_ONLY |
URL_DONT_ESCAPE_EXTRA_INFO |
URL_ESCAPE_SEGMENT_ONLY);
if (myflags)
ret = UrlEscapeW(preliminary, pszCombined,
pcchCombined, myflags);
else {
len = (strlenW(preliminary) + 1) * sizeof(WCHAR);
memcpy(pszCombined, preliminary, len);
*pcchCombined = strlenW(preliminary);
/* Reuse mrelative as temp storage as its already allocated and not needed anymore */
ret = UrlCanonicalizeW(preliminary, mrelative, pcchCombined, dwFlags);
if(SUCCEEDED(ret) && pszCombined) {
lstrcpyW(pszCombined, mrelative);
}
TRACE("return-%ld len=%ld, %s\n",
process_case, *pcchCombined, debugstr_w(pszCombined));

View file

@ -1,10 +1,10 @@
Index: path.c
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/path.c,v
retrieving revision 1.41
diff -u -r1.41 path.c
--- path.c 23 Jan 2004 22:45:25 -0000 1.41
+++ path.c 11 Mar 2004 22:38:00 -0000
retrieving revision 1.42
diff -u -r1.42 path.c
--- path.c 20 Apr 2004 00:34:52 -0000 1.42
+++ path.c 8 May 2004 13:58:39 -0000
@@ -32,6 +32,7 @@
#include "wingdi.h"
#include "winuser.h"
@ -16,10 +16,10 @@ diff -u -r1.41 path.c
Index: shlwapi.spec
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/shlwapi.spec,v
retrieving revision 1.88
diff -u -r1.88 shlwapi.spec
--- shlwapi.spec 28 Feb 2004 01:46:56 -0000 1.88
+++ shlwapi.spec 11 Mar 2004 22:38:00 -0000
retrieving revision 1.90
diff -u -r1.90 shlwapi.spec
--- shlwapi.spec 27 Mar 2004 01:38:26 -0000 1.90
+++ shlwapi.spec 8 May 2004 13:58:39 -0000
@@ -368,9 +368,9 @@
368 stdcall @(wstr wstr ptr long wstr) kernel32.GetPrivateProfileStructW
369 stdcall @(wstr wstr ptr ptr long long ptr wstr ptr ptr) kernel32.CreateProcessW
@ -45,10 +45,10 @@ diff -u -r1.88 shlwapi.spec
Index: string.c
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/string.c,v
retrieving revision 1.44
diff -u -r1.44 string.c
--- string.c 20 Feb 2004 05:16:37 -0000 1.44
+++ string.c 11 Mar 2004 22:38:01 -0000
retrieving revision 1.46
diff -u -r1.46 string.c
--- string.c 20 Apr 2004 01:12:17 -0000 1.46
+++ string.c 8 May 2004 13:58:40 -0000
@@ -528,7 +528,7 @@
{
TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
@ -70,11 +70,11 @@ diff -u -r1.44 string.c
Index: url.c
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/url.c,v
retrieving revision 1.29
diff -u -r1.29 url.c
--- url.c 3 Mar 2004 20:11:46 -0000 1.29
+++ url.c 11 Mar 2004 22:38:02 -0000
@@ -1423,8 +1423,8 @@
retrieving revision 1.33
diff -u -r1.33 url.c
--- url.c 27 Apr 2004 23:29:02 -0000 1.33
+++ url.c 8 May 2004 13:58:41 -0000
@@ -1386,8 +1386,8 @@
* Success: TRUE. lpDest is filled with the computed hash value.
* Failure: FALSE, if any argument is invalid.
*/