avifil32: Use wide-char string literals.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2020-10-07 23:34:27 +02:00 committed by Alexandre Julliard
parent 9c517a3d44
commit 4ffc5ed5ca
2 changed files with 8 additions and 18 deletions

View file

@ -994,11 +994,7 @@ HRESULT WINAPI AVIBuildFilterA(LPSTR szFilter, LONG cbFilter, BOOL fSaving)
*/ */
HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving) HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
{ {
static const WCHAR all_files[] = { '*','.','*',0,0 }; static const WCHAR all_files[] = L"*.*\0";
static const WCHAR szClsid[] = {'C','L','S','I','D',0};
static const WCHAR szExtensionFmt[] = {';','*','.','%','s',0};
static const WCHAR szAVIFileExtensions[] =
{'A','V','I','F','i','l','e','\\','E','x','t','e','n','s','i','o','n','s',0};
AVIFilter *lp; AVIFilter *lp;
WCHAR szAllFiles[40]; WCHAR szAllFiles[40];
@ -1030,7 +1026,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
* First filter is named "All multimedia files" and its filter is a * First filter is named "All multimedia files" and its filter is a
* collection of all possible extensions except "*.*". * collection of all possible extensions except "*.*".
*/ */
if (RegOpenKeyW(HKEY_CLASSES_ROOT, szAVIFileExtensions, &hKey) != ERROR_SUCCESS) { if (RegOpenKeyW(HKEY_CLASSES_ROOT, L"AVIFile\\Extensions", &hKey) != ERROR_SUCCESS) {
HeapFree(GetProcessHeap(), 0, lp); HeapFree(GetProcessHeap(), 0, lp);
return AVIERR_ERROR; return AVIERR_ERROR;
} }
@ -1065,7 +1061,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
} }
/* append extension to the filter */ /* append extension to the filter */
wsprintfW(szValue, szExtensionFmt, szFileExt); wsprintfW(szValue, L";*.%s", szFileExt);
if (lp[i].szExtensions[0] == 0) if (lp[i].szExtensions[0] == 0)
lstrcatW(lp[i].szExtensions, szValue + 1); lstrcatW(lp[i].szExtensions, szValue + 1);
else else
@ -1080,7 +1076,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
RegCloseKey(hKey); RegCloseKey(hKey);
/* 2. get descriptions for the CLSIDs and fill out szFilter */ /* 2. get descriptions for the CLSIDs and fill out szFilter */
if (RegOpenKeyW(HKEY_CLASSES_ROOT, szClsid, &hKey) != ERROR_SUCCESS) { if (RegOpenKeyW(HKEY_CLASSES_ROOT, L"CLSID", &hKey) != ERROR_SUCCESS) {
HeapFree(GetProcessHeap(), 0, lp); HeapFree(GetProcessHeap(), 0, lp);
return AVIERR_ERROR; return AVIERR_ERROR;
} }
@ -1254,9 +1250,6 @@ static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
static void AVISaveOptionsUpdate(HWND hWnd) static void AVISaveOptionsUpdate(HWND hWnd)
{ {
static const WCHAR szVideoFmt[]={'%','l','d','x','%','l','d','x','%','d',0};
static const WCHAR szAudioFmt[]={'%','s',' ','%','s',0};
WCHAR szFormat[128]; WCHAR szFormat[128];
AVISTREAMINFOW sInfo; AVISTREAMINFOW sInfo;
LPVOID lpFormat; LPVOID lpFormat;
@ -1283,7 +1276,7 @@ static void AVISaveOptionsUpdate(HWND hWnd)
LPBITMAPINFOHEADER lpbi = lpFormat; LPBITMAPINFOHEADER lpbi = lpFormat;
ICINFO icinfo; ICINFO icinfo;
wsprintfW(szFormat, szVideoFmt, lpbi->biWidth, wsprintfW(szFormat, L"%ldx%ldx%d", lpbi->biWidth,
lpbi->biHeight, lpbi->biBitCount); lpbi->biHeight, lpbi->biBitCount);
if (lpbi->biCompression != BI_RGB) { if (lpbi->biCompression != BI_RGB) {
@ -1320,7 +1313,7 @@ static void AVISaveOptionsUpdate(HWND hWnd)
if (acmFormatTagDetailsW(NULL, &aftd, if (acmFormatTagDetailsW(NULL, &aftd,
ACM_FORMATTAGDETAILSF_FORMATTAG) == S_OK) { ACM_FORMATTAGDETAILSF_FORMATTAG) == S_OK) {
if (acmFormatDetailsW(NULL,&afd,ACM_FORMATDETAILSF_FORMAT) == S_OK) if (acmFormatDetailsW(NULL,&afd,ACM_FORMATDETAILSF_FORMAT) == S_OK)
wsprintfW(szFormat, szAudioFmt, afd.szFormat, aftd.szFormatTag); wsprintfW(szFormat, L"%s %s", afd.szFormat, aftd.szFormatTag);
} }
} }
} }

View file

@ -1714,9 +1714,6 @@ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This)
break; break;
case ckidSTREAMHEADER: case ckidSTREAMHEADER:
{ {
static const WCHAR streamTypeFmt[] = {'%','4','.','4','h','s',0};
static const WCHAR streamNameFmt[] = {'%','s',' ','%','s',' ','#','%','d',0};
AVIStreamHeader streamHdr; AVIStreamHeader streamHdr;
WCHAR szType[25]; WCHAR szType[25];
UINT count; UINT count;
@ -1754,7 +1751,7 @@ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This)
else if (streamHdr.fccType == streamtypeAUDIO) else if (streamHdr.fccType == streamtypeAUDIO)
LoadStringW(AVIFILE_hModule, IDS_AUDIO, szType, ARRAY_SIZE(szType)); LoadStringW(AVIFILE_hModule, IDS_AUDIO, szType, ARRAY_SIZE(szType));
else else
wsprintfW(szType, streamTypeFmt, (char*)&streamHdr.fccType); wsprintfW(szType, L"%4.4hs", (char*)&streamHdr.fccType);
/* get count of this streamtype up to this stream */ /* get count of this streamtype up to this stream */
count = 0; count = 0;
@ -1766,7 +1763,7 @@ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This)
memset(pStream->sInfo.szName, 0, sizeof(pStream->sInfo.szName)); memset(pStream->sInfo.szName, 0, sizeof(pStream->sInfo.szName));
/* FIXME: avoid overflow -- better use wsnprintfW, which doesn't exists ! */ /* FIXME: avoid overflow -- better use wsnprintfW, which doesn't exists ! */
wsprintfW(pStream->sInfo.szName, streamNameFmt, wsprintfW(pStream->sInfo.szName, L"%s %s #%d",
AVIFILE_BasenameW(This->szFileName), szType, count); AVIFILE_BasenameW(This->szFileName), szType, count);
} }
break; break;