oleaut32: Removes extra string allocation for varformat:VarMonthName.
This commit is contained in:
parent
f5cc0f7d09
commit
0227b8cba2
|
@ -2471,7 +2471,6 @@ HRESULT WINAPI VarMonthName(INT iMonth, INT fAbbrev, ULONG dwFlags, BSTR *pbstrO
|
|||
{
|
||||
DWORD localeValue;
|
||||
INT size;
|
||||
WCHAR *str;
|
||||
|
||||
if ((iMonth < 1) || (iMonth > 12))
|
||||
return E_INVALIDARG;
|
||||
|
@ -2489,18 +2488,14 @@ HRESULT WINAPI VarMonthName(INT iMonth, INT fAbbrev, ULONG dwFlags, BSTR *pbstrO
|
|||
ERR("GetLocaleInfo 0x%lx failed.\n", localeValue);
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
str = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*size);
|
||||
if (!str)
|
||||
return E_OUTOFMEMORY;
|
||||
size = GetLocaleInfoW(LOCALE_USER_DEFAULT,localeValue, str, size);
|
||||
if (!size) {
|
||||
ERR("GetLocaleInfo of 0x%lx failed in 2nd stage?!\n", localeValue);
|
||||
HeapFree(GetProcessHeap(),0,str);
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
*pbstrOut = SysAllocString(str);
|
||||
HeapFree(GetProcessHeap(),0,str);
|
||||
*pbstrOut = SysAllocStringLen(NULL,size - 1);
|
||||
if (!*pbstrOut)
|
||||
return E_OUTOFMEMORY;
|
||||
size = GetLocaleInfoW(LOCALE_USER_DEFAULT,localeValue, *pbstrOut, size);
|
||||
if (!size) {
|
||||
ERR("GetLocaleInfo of 0x%lx failed in 2nd stage?!\n", localeValue);
|
||||
SysFreeString(*pbstrOut);
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue