Michael Stefaniuc : avifil32: Use wide-char string literals.

Alexandre Julliard julliard at winehq.org
Thu Oct 8 15:20:04 CDT 2020


Module: wine
Branch: master
Commit: 4ffc5ed5caef8867e14c8ec7b635aada6fc8e125
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4ffc5ed5caef8867e14c8ec7b635aada6fc8e125

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Wed Oct  7 23:34:27 2020 +0200

avifil32: Use wide-char string literals.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/avifil32/api.c     | 19 ++++++-------------
 dlls/avifil32/avifile.c |  7 ++-----
 2 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/dlls/avifil32/api.c b/dlls/avifil32/api.c
index a7f84ba3bc..5a9985424e 100644
--- a/dlls/avifil32/api.c
+++ b/dlls/avifil32/api.c
@@ -994,11 +994,7 @@ HRESULT WINAPI AVIBuildFilterA(LPSTR szFilter, LONG cbFilter, BOOL fSaving)
  */
 HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
 {
-  static const WCHAR all_files[] = { '*','.','*',0,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};
+  static const WCHAR all_files[] = L"*.*\0";
 
   AVIFilter *lp;
   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
    * 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);
     return AVIERR_ERROR;
   }
@@ -1065,7 +1061,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
     }
 
     /* append extension to the filter */
-    wsprintfW(szValue, szExtensionFmt, szFileExt);
+    wsprintfW(szValue, L";*.%s", szFileExt);
     if (lp[i].szExtensions[0] == 0)
       lstrcatW(lp[i].szExtensions, szValue + 1);
     else
@@ -1080,7 +1076,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
   RegCloseKey(hKey);
 
   /* 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);
     return AVIERR_ERROR;
   }
@@ -1254,9 +1250,6 @@ static BOOL AVISaveOptionsFmtChoose(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];
   AVISTREAMINFOW sInfo;
   LPVOID         lpFormat;
@@ -1283,7 +1276,7 @@ static void AVISaveOptionsUpdate(HWND hWnd)
 	  LPBITMAPINFOHEADER lpbi = lpFormat;
 	  ICINFO icinfo;
 
-	  wsprintfW(szFormat, szVideoFmt, lpbi->biWidth,
+          wsprintfW(szFormat, L"%ldx%ldx%d", lpbi->biWidth,
 		    lpbi->biHeight, lpbi->biBitCount);
 
 	  if (lpbi->biCompression != BI_RGB) {
@@ -1320,7 +1313,7 @@ static void AVISaveOptionsUpdate(HWND hWnd)
 	  if (acmFormatTagDetailsW(NULL, &aftd,
 				   ACM_FORMATTAGDETAILSF_FORMATTAG) == 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);
 	  }
 	}
       }
diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c
index f3cf484d91..b1654daa69 100644
--- a/dlls/avifil32/avifile.c
+++ b/dlls/avifil32/avifile.c
@@ -1714,9 +1714,6 @@ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This)
 	  break;
 	case ckidSTREAMHEADER:
 	  {
-	    static const WCHAR streamTypeFmt[] = {'%','4','.','4','h','s',0};
-	    static const WCHAR streamNameFmt[] = {'%','s',' ','%','s',' ','#','%','d',0};
-
 	    AVIStreamHeader streamHdr;
 	    WCHAR           szType[25];
 	    UINT            count;
@@ -1754,7 +1751,7 @@ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This)
 	    else if (streamHdr.fccType == streamtypeAUDIO)
 	      LoadStringW(AVIFILE_hModule, IDS_AUDIO, szType, ARRAY_SIZE(szType));
 	    else
-	      wsprintfW(szType, streamTypeFmt, (char*)&streamHdr.fccType);
+              wsprintfW(szType, L"%4.4hs", (char*)&streamHdr.fccType);
 
 	    /* get count of this streamtype up to this stream */
 	    count = 0;
@@ -1766,7 +1763,7 @@ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This)
 	    memset(pStream->sInfo.szName, 0, sizeof(pStream->sInfo.szName));
 
 	    /* 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);
 	  }
 	  break;




More information about the wine-cvs mailing list