[PATCH] windowscodecs: Use wide-char string literals in metadataquery.c.

Michael Stefaniuc mstefani at winehq.org
Mon Nov 30 17:58:20 CST 2020


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/windowscodecs/metadataquery.c | 241 +++++++++--------------------
 1 file changed, 71 insertions(+), 170 deletions(-)

diff --git a/dlls/windowscodecs/metadataquery.c b/dlls/windowscodecs/metadataquery.c
index 189187fb2ab..2761a520083 100644
--- a/dlls/windowscodecs/metadataquery.c
+++ b/dlls/windowscodecs/metadataquery.c
@@ -103,7 +103,6 @@ static HRESULT WINAPI mqr_GetContainerFormat(IWICMetadataQueryReader *iface, GUI
 
 static HRESULT WINAPI mqr_GetLocation(IWICMetadataQueryReader *iface, UINT len, WCHAR *location, UINT *ret_len)
 {
-    static const WCHAR rootW[] = { '/',0 };
     QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
     const WCHAR *root;
     UINT actual_len;
@@ -112,7 +111,7 @@ static HRESULT WINAPI mqr_GetLocation(IWICMetadataQueryReader *iface, UINT len,
 
     if (!ret_len) return E_INVALIDARG;
 
-    root = This->root ? This->root : rootW;
+    root = This->root ? This->root : L"/";
     actual_len = lstrlenW(root) + 1;
 
     if (location)
@@ -636,101 +635,56 @@ HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, const W
     return S_OK;
 }
 
-static const WCHAR bmpW[] = { 'b','m','p',0 };
-static const WCHAR pngW[] = { 'p','n','g',0 };
-static const WCHAR icoW[] = { 'i','c','o',0 };
-static const WCHAR jpgW[] = { 'j','p','g',0 };
-static const WCHAR tiffW[] = { 't','i','f','f',0 };
-static const WCHAR gifW[] = { 'g','i','f',0 };
-static const WCHAR wmphotoW[] = { 'w','m','p','h','o','t','o',0 };
-static const WCHAR unknownW[] = { 'u','n','k','n','o','w','n',0 };
-static const WCHAR ifdW[] = { 'i','f','d',0 };
-static const WCHAR subW[] = { 's','u','b',0 };
-static const WCHAR exifW[] = { 'e','x','i','f',0 };
-static const WCHAR gpsW[] = { 'g','p','s',0 };
-static const WCHAR interopW[] = { 'i','n','t','e','r','o','p',0 };
-static const WCHAR app0W[] = { 'a','p','p','0',0 };
-static const WCHAR app1W[] = { 'a','p','p','1',0 };
-static const WCHAR app13W[] = { 'a','p','p','1','3',0 };
-static const WCHAR iptcW[] = { 'i','p','t','c',0 };
-static const WCHAR irbW[] = { 'i','r','b',0 };
-static const WCHAR _8bimiptcW[] = { '8','b','i','m','i','p','t','c',0 };
-static const WCHAR _8bimResInfoW[] = { '8','b','i','m','R','e','s','I','n','f','o',0 };
-static const WCHAR _8bimiptcdigestW[] = { '8','b','i','m','i','p','t','c','d','i','g','e','s','t',0 };
-static const WCHAR xmpW[] = { 'x','m','p',0 };
-static const WCHAR thumbW[] = { 't','h','u','m','b',0 };
-static const WCHAR tEXtW[] = { 't','E','X','t',0 };
-static const WCHAR xmpstructW[] = { 'x','m','p','s','t','r','u','c','t',0 };
-static const WCHAR xmpbagW[] = { 'x','m','p','b','a','g',0 };
-static const WCHAR xmpseqW[] = { 'x','m','p','s','e','q',0 };
-static const WCHAR xmpaltW[] = { 'x','m','p','a','l','t',0 };
-static const WCHAR logscrdescW[] = { 'l','o','g','s','c','r','d','e','s','c',0 };
-static const WCHAR imgdescW[] = { 'i','m','g','d','e','s','c',0 };
-static const WCHAR grctlextW[] = { 'g','r','c','t','l','e','x','t',0 };
-static const WCHAR appextW[] = { 'a','p','p','e','x','t',0 };
-static const WCHAR chrominanceW[] = { 'c','h','r','o','m','i','n','a','n','c','e',0 };
-static const WCHAR luminanceW[] = { 'l','u','m','i','n','a','n','c','e',0 };
-static const WCHAR comW[] = { 'c','o','m',0 };
-static const WCHAR commentextW[] = { 'c','o','m','m','e','n','t','e','x','t',0 };
-static const WCHAR gAMAW[] = { 'g','A','M','A',0 };
-static const WCHAR bKGDW[] = { 'b','K','G','D',0 };
-static const WCHAR iTXtW[] = { 'i','T','X','t',0 };
-static const WCHAR cHRMW[] = { 'c','H','R','M',0 };
-static const WCHAR hISTW[] = { 'h','I','S','T',0 };
-static const WCHAR iCCPW[] = { 'i','C','C','P',0 };
-static const WCHAR sRGBW[] = { 's','R','G','B',0 };
-static const WCHAR tIMEW[] = { 't','I','M','E',0 };
-
 static const struct
 {
     const GUID *guid;
     const WCHAR *name;
 } guid2name[] =
 {
-    { &GUID_ContainerFormatBmp, bmpW },
-    { &GUID_ContainerFormatPng, pngW },
-    { &GUID_ContainerFormatIco, icoW },
-    { &GUID_ContainerFormatJpeg, jpgW },
-    { &GUID_ContainerFormatTiff, tiffW },
-    { &GUID_ContainerFormatGif, gifW },
-    { &GUID_ContainerFormatWmp, wmphotoW },
-    { &GUID_MetadataFormatUnknown, unknownW },
-    { &GUID_MetadataFormatIfd, ifdW },
-    { &GUID_MetadataFormatSubIfd, subW },
-    { &GUID_MetadataFormatExif, exifW },
-    { &GUID_MetadataFormatGps, gpsW },
-    { &GUID_MetadataFormatInterop, interopW },
-    { &GUID_MetadataFormatApp0, app0W },
-    { &GUID_MetadataFormatApp1, app1W },
-    { &GUID_MetadataFormatApp13, app13W },
-    { &GUID_MetadataFormatIPTC, iptcW },
-    { &GUID_MetadataFormatIRB, irbW },
-    { &GUID_MetadataFormat8BIMIPTC, _8bimiptcW },
-    { &GUID_MetadataFormat8BIMResolutionInfo, _8bimResInfoW },
-    { &GUID_MetadataFormat8BIMIPTCDigest, _8bimiptcdigestW },
-    { &GUID_MetadataFormatXMP, xmpW },
-    { &GUID_MetadataFormatThumbnail, thumbW },
-    { &GUID_MetadataFormatChunktEXt, tEXtW },
-    { &GUID_MetadataFormatXMPStruct, xmpstructW },
-    { &GUID_MetadataFormatXMPBag, xmpbagW },
-    { &GUID_MetadataFormatXMPSeq, xmpseqW },
-    { &GUID_MetadataFormatXMPAlt, xmpaltW },
-    { &GUID_MetadataFormatLSD, logscrdescW },
-    { &GUID_MetadataFormatIMD, imgdescW },
-    { &GUID_MetadataFormatGCE, grctlextW },
-    { &GUID_MetadataFormatAPE, appextW },
-    { &GUID_MetadataFormatJpegChrominance, chrominanceW },
-    { &GUID_MetadataFormatJpegLuminance, luminanceW },
-    { &GUID_MetadataFormatJpegComment, comW },
-    { &GUID_MetadataFormatGifComment, commentextW },
-    { &GUID_MetadataFormatChunkgAMA, gAMAW },
-    { &GUID_MetadataFormatChunkbKGD, bKGDW },
-    { &GUID_MetadataFormatChunkiTXt, iTXtW },
-    { &GUID_MetadataFormatChunkcHRM, cHRMW },
-    { &GUID_MetadataFormatChunkhIST, hISTW },
-    { &GUID_MetadataFormatChunkiCCP, iCCPW },
-    { &GUID_MetadataFormatChunksRGB, sRGBW },
-    { &GUID_MetadataFormatChunktIME, tIMEW }
+    { &GUID_ContainerFormatBmp, L"bmp" },
+    { &GUID_ContainerFormatPng, L"png" },
+    { &GUID_ContainerFormatIco, L"ico" },
+    { &GUID_ContainerFormatJpeg, L"jpg" },
+    { &GUID_ContainerFormatTiff, L"tiff" },
+    { &GUID_ContainerFormatGif, L"gif" },
+    { &GUID_ContainerFormatWmp, L"wmphoto" },
+    { &GUID_MetadataFormatUnknown, L"unknown" },
+    { &GUID_MetadataFormatIfd, L"ifd" },
+    { &GUID_MetadataFormatSubIfd, L"sub" },
+    { &GUID_MetadataFormatExif, L"exif" },
+    { &GUID_MetadataFormatGps, L"gps" },
+    { &GUID_MetadataFormatInterop, L"interop" },
+    { &GUID_MetadataFormatApp0, L"app0" },
+    { &GUID_MetadataFormatApp1, L"app1" },
+    { &GUID_MetadataFormatApp13, L"app13" },
+    { &GUID_MetadataFormatIPTC, L"iptc" },
+    { &GUID_MetadataFormatIRB, L"irb" },
+    { &GUID_MetadataFormat8BIMIPTC, L"8bimiptc" },
+    { &GUID_MetadataFormat8BIMResolutionInfo, L"8bimResInfo" },
+    { &GUID_MetadataFormat8BIMIPTCDigest, L"8bimiptcdigest" },
+    { &GUID_MetadataFormatXMP, L"xmp" },
+    { &GUID_MetadataFormatThumbnail, L"thumb" },
+    { &GUID_MetadataFormatChunktEXt, L"tEXt" },
+    { &GUID_MetadataFormatXMPStruct, L"xmpstruct" },
+    { &GUID_MetadataFormatXMPBag, L"xmpbag" },
+    { &GUID_MetadataFormatXMPSeq, L"xmpseq" },
+    { &GUID_MetadataFormatXMPAlt, L"xmpalt" },
+    { &GUID_MetadataFormatLSD, L"logscrdesc" },
+    { &GUID_MetadataFormatIMD, L"imgdesc" },
+    { &GUID_MetadataFormatGCE, L"grctlext" },
+    { &GUID_MetadataFormatAPE, L"appext" },
+    { &GUID_MetadataFormatJpegChrominance, L"chrominance" },
+    { &GUID_MetadataFormatJpegLuminance, L"luminance" },
+    { &GUID_MetadataFormatJpegComment, L"com" },
+    { &GUID_MetadataFormatGifComment, L"commentext" },
+    { &GUID_MetadataFormatChunkgAMA, L"gAMA" },
+    { &GUID_MetadataFormatChunkbKGD, L"bKGD" },
+    { &GUID_MetadataFormatChunkiTXt, L"iTXt" },
+    { &GUID_MetadataFormatChunkcHRM, L"cHRM" },
+    { &GUID_MetadataFormatChunkhIST, L"hIST" },
+    { &GUID_MetadataFormatChunkiCCP, L"iCCP" },
+    { &GUID_MetadataFormatChunksRGB, L"sRGB" },
+    { &GUID_MetadataFormatChunktIME, L"tIME" }
 };
 
 HRESULT WINAPI WICMapGuidToShortName(REFGUID guid, UINT len, WCHAR *name, UINT *ret_len)
@@ -784,91 +738,38 @@ HRESULT WINAPI WICMapShortNameToGuid(PCWSTR name, GUID *guid)
     return WINCODEC_ERR_PROPERTYNOTFOUND;
 }
 
-static const WCHAR rdf[] = { 'r','d','f',0 };
-static const WCHAR rdf_scheme[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','3','.','o','r','g','/','1','9','9','9','/','0','2','/','2','2','-','r','d','f','-','s','y','n','t','a','x','-','n','s','#',0 };
-static const WCHAR dc[] = { 'd','c',0 };
-static const WCHAR dc_scheme[] = { 'h','t','t','p',':','/','/','p','u','r','l','.','o','r','g','/','d','c','/','e','l','e','m','e','n','t','s','/','1','.','1','/',0 };
-static const WCHAR xmp[] = { 'x','m','p',0 };
-static const WCHAR xmp_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/',0 };
-static const WCHAR xmpidq[] = { 'x','m','p','i','d','q',0 };
-static const WCHAR xmpidq_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','m','p','/','I','d','e','n','t','i','f','i','e','r','/','q','u','a','l','/','1','.','0','/',0 };
-static const WCHAR xmpRights[] = { 'x','m','p','R','i','g','h','t','s',0 };
-static const WCHAR xmpRights_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','r','i','g','h','t','s','/',0 };
-static const WCHAR xmpMM[] = { 'x','m','p','M','M',0 };
-static const WCHAR xmpMM_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','m','m','/',0 };
-static const WCHAR xmpBJ[] = { 'x','m','p','B','J',0 };
-static const WCHAR xmpBJ_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','b','j','/',0 };
-static const WCHAR xmpTPg[] = { 'x','m','p','T','P','g',0 };
-static const WCHAR xmpTPg_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','t','/','p','g','/',0 };
-static const WCHAR pdf[] = { 'p','d','f',0 };
-static const WCHAR pdf_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','p','d','f','/','1','.','3','/',0 };
-static const WCHAR photoshop[] = { 'p','h','o','t','o','s','h','o','p',0 };
-static const WCHAR photoshop_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','p','h','o','t','o','s','h','o','p','/','1','.','0','/',0 };
-static const WCHAR tiff[] = { 't','i','f','f',0 };
-static const WCHAR tiff_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','t','i','f','f','/','1','.','0','/',0 };
-static const WCHAR exif[] = { 'e','x','i','f',0 };
-static const WCHAR exif_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','e','x','i','f','/','1','.','0','/',0 };
-static const WCHAR stDim[] = { 's','t','D','i','m',0 };
-static const WCHAR stDim_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','D','i','m','e','n','s','i','o','n','s','#',0 };
-static const WCHAR xapGImg[] = { 'x','a','p','G','I','m','g',0 };
-static const WCHAR xapGImg_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','g','/','i','m','g','/',0 };
-static const WCHAR stEvt[] = { 's','t','E','v','t',0 };
-static const WCHAR stEvt_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','R','e','s','o','u','r','c','e','E','v','e','n','t','#',0 };
-static const WCHAR stRef[] = { 's','t','R','e','f',0 };
-static const WCHAR stRef_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','R','e','s','o','u','r','c','e','R','e','f','#',0 };
-static const WCHAR stVer[] = { 's','t','V','e','r',0 };
-static const WCHAR stVer_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','V','e','r','s','i','o','n','#',0 };
-static const WCHAR stJob[] = { 's','t','J','o','b',0 };
-static const WCHAR stJob_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','a','p','/','1','.','0','/','s','T','y','p','e','/','J','o','b','#',0 };
-static const WCHAR aux[] = { 'a','u','x',0 };
-static const WCHAR aux_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','e','x','i','f','/','1','.','0','/','a','u','x','/',0 };
-static const WCHAR crs[] = { 'c','r','s',0 };
-static const WCHAR crs_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','c','a','m','e','r','a','-','r','a','w','-','s','e','t','t','i','n','g','s','/','1','.','0','/',0 };
-static const WCHAR xmpDM[] = { 'x','m','p','D','M',0 };
-static const WCHAR xmpDM_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','a','d','o','b','e','.','c','o','m','/','x','m','p','/','1','.','0','/','D','y','n','a','m','i','c','M','e','d','i','a','/',0 };
-static const WCHAR Iptc4xmpCore[] = { 'I','p','t','c','4','x','m','p','C','o','r','e',0 };
-static const WCHAR Iptc4xmpCore_scheme[] = { 'h','t','t','p',':','/','/','i','p','t','c','.','o','r','g','/','s','t','d','/','I','p','t','c','4','x','m','p','C','o','r','e','/','1','.','0','/','x','m','l','n','s','/',0 };
-static const WCHAR MicrosoftPhoto[] = { 'M','i','c','r','o','s','o','f','t','P','h','o','t','o',0 };
-static const WCHAR MicrosoftPhoto_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','p','h','o','t','o','/','1','.','0','/',0 };
-static const WCHAR MP[] = { 'M','P',0 };
-static const WCHAR MP_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','p','h','o','t','o','/','1','.','2','/',0 };
-static const WCHAR MPRI[] = { 'M','P','R','I',0 };
-static const WCHAR MPRI_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','p','h','o','t','o','/','1','.','2','/','t','/','R','e','g','i','o','n','I','n','f','o','#',0 };
-static const WCHAR MPReg[] = { 'M','P','R','e','g',0 };
-static const WCHAR MPReg_scheme[] = { 'h','t','t','p',':','/','/','n','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','p','h','o','t','o','/','1','.','2','/','t','/','R','e','g','i','o','n','#',0 };
-
 static const struct
 {
     const WCHAR *name;
     const WCHAR *schema;
 } name2schema[] =
 {
-    { rdf, rdf_scheme },
-    { dc, dc_scheme },
-    { xmp, xmp_scheme },
-    { xmpidq, xmpidq_scheme },
-    { xmpRights, xmpRights_scheme },
-    { xmpMM, xmpMM_scheme },
-    { xmpBJ, xmpBJ_scheme },
-    { xmpTPg, xmpTPg_scheme },
-    { pdf, pdf_scheme },
-    { photoshop, photoshop_scheme },
-    { tiff, tiff_scheme },
-    { exif, exif_scheme },
-    { stDim, stDim_scheme },
-    { xapGImg, xapGImg_scheme },
-    { stEvt, stEvt_scheme },
-    { stRef, stRef_scheme },
-    { stVer, stVer_scheme },
-    { stJob, stJob_scheme },
-    { aux, aux_scheme },
-    { crs, crs_scheme },
-    { xmpDM, xmpDM_scheme },
-    { Iptc4xmpCore, Iptc4xmpCore_scheme },
-    { MicrosoftPhoto, MicrosoftPhoto_scheme },
-    { MP, MP_scheme },
-    { MPRI, MPRI_scheme },
-    { MPReg, MPReg_scheme }
+    { L"rdf", L"http://www.w3.org/1999/02/22-rdf-syntax-ns#" },
+    { L"dc", L"http://purl.org/dc/elements/1.1/" },
+    { L"xmp", L"http://ns.adobe.com/xap/1.0/" },
+    { L"xmpidq", L"http://ns.adobe.com/xmp/Identifier/qual/1.0/" },
+    { L"xmpRights", L"http://ns.adobe.com/xap/1.0/rights/" },
+    { L"xmpMM", L"http://ns.adobe.com/xap/1.0/mm/" },
+    { L"xmpBJ", L"http://ns.adobe.com/xap/1.0/bj/" },
+    { L"xmpTPg", L"http://ns.adobe.com/xap/1.0/t/pg/" },
+    { L"pdf", L"http://ns.adobe.com/pdf/1.3/" },
+    { L"photoshop", L"http://ns.adobe.com/photoshop/1.0/" },
+    { L"tiff", L"http://ns.adobe.com/tiff/1.0/" },
+    { L"exif", L"http://ns.adobe.com/exif/1.0/" },
+    { L"stDim", L"http://ns.adobe.com/xap/1.0/sType/Dimensions#" },
+    { L"xapGImg", L"http://ns.adobe.com/xap/1.0/g/img/" },
+    { L"stEvt", L"http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" },
+    { L"stRef", L"http://ns.adobe.com/xap/1.0/sType/ResourceRef#" },
+    { L"stVer", L"http://ns.adobe.com/xap/1.0/sType/Version#" },
+    { L"stJob", L"http://ns.adobe.com/xap/1.0/sType/Job#" },
+    { L"aux", L"http://ns.adobe.com/exif/1.0/aux/" },
+    { L"crs", L"http://ns.adobe.com/camera-raw-settings/1.0/" },
+    { L"xmpDM", L"http://ns.adobe.com/xmp/1.0/DynamicMedia/" },
+    { L"Iptc4xmpCore", L"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" },
+    { L"MicrosoftPhoto", L"http://ns.microsoft.com/photo/1.0/" },
+    { L"MP", L"http://ns.microsoft.com/photo/1.2/" },
+    { L"MPRI", L"http://ns.microsoft.com/photo/1.2/t/RegionInfo#" },
+    { L"MPReg", L"http://ns.microsoft.com/photo/1.2/t/Region#" }
 };
 
 static const WCHAR *map_shortname_to_schema(const GUID *format, const WCHAR *name)
-- 
2.26.2




More information about the wine-devel mailing list