Author: dquintana Date: Thu Oct 9 12:54:29 2014 New Revision: 64646
URL: http://svn.reactos.org/svn/reactos?rev=64646&view=rev Log: [SHELL32] * Fix another comment. * Fix a cch/cb bug. * Make use of the DSA_DestroyCallback function instead of messing around with the internals of the DSA. CORE-8564
Modified: branches/shell-experiments/dll/win32/shell32/shlfileop.cpp
Modified: branches/shell-experiments/dll/win32/shell32/shlfileop.cpp URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/shel... ============================================================================== --- branches/shell-experiments/dll/win32/shell32/shlfileop.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/shlfileop.cpp [iso-8859-1] Thu Oct 9 12:54:29 2014 @@ -970,12 +970,12 @@ sizeA = lstrlenA(strSrc) + 1; }
- // Measure the + // Measure the needed allocation size. int sizeW = MultiByteToWideChar(CP_ACP, 0, strSrc, sizeA, NULL, 0); if (!sizeW) return GetLastError();
- PWSTR strDest = (PWSTR) HeapAlloc(GetProcessHeap(), 0, sizeW); + PWSTR strDest = (PWSTR) HeapAlloc(GetProcessHeap(), 0, sizeW * sizeof(WCHAR)); if (!strDest) return ERROR_OUTOFMEMORY;
@@ -1739,7 +1739,16 @@ return ret; }
-#define SHDSA_GetItemCount(hdsa) (*(int*)(hdsa)) +// Used by SHFreeNameMappings +static int CALLBACK _DestroyCallback(void *p, void *pData) +{ + LPSHNAMEMAPPINGW lp = (SHNAMEMAPPINGW *)p; + + SHFree(lp->pszOldPath); + SHFree(lp->pszNewPath); + + return TRUE; +}
/************************************************************************* * SHFreeNameMappings [shell32.246] @@ -1757,16 +1766,7 @@ { if (hNameMapping) { - int i = SHDSA_GetItemCount((HDSA)hNameMapping) - 1; - - for (; i>= 0; i--) - { - LPSHNAMEMAPPINGW lp = (SHNAMEMAPPINGW *)DSA_GetItemPtr((HDSA)hNameMapping, i); - - SHFree(lp->pszOldPath); - SHFree(lp->pszNewPath); - } - DSA_Destroy((HDSA)hNameMapping); + DSA_DestroyCallback((HDSA) hNameMapping, _DestroyCallback, NULL); } }