comcat: Declare some variables static, constifying if appropriate

Andrew Talbot Andrew.Talbot at talbotville.com
Fri Mar 16 17:11:54 CDT 2007


Changelog:
    comcat: Declare some variables static, constifying if appropriate.

diff -urN a/dlls/comcat/information.c b/dlls/comcat/information.c
--- a/dlls/comcat/information.c	2006-10-04 20:34:12.000000000 +0100
+++ b/dlls/comcat/information.c	2007-03-16 21:43:23.000000000 +0000
@@ -114,9 +114,9 @@
     PWCHAR *ppszDesc)
 {
 /*     ICOM_THIS_MULTI(ComCatMgrImpl, infVtbl, iface); */
-    WCHAR keyname[60] = { 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n',
-			  't', ' ', 'C', 'a', 't', 'e', 'g', 'o',
-			  'r', 'i', 'e', 's', '\\', 0 };
+    static WCHAR keyname[60] = { 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n',
+				 't', ' ', 'C', 'a', 't', 'e', 'g', 'o',
+				 'r', 'i', 'e', 's', '\\', 0 };
     HKEY key;
     HRESULT res;
 
@@ -196,7 +196,7 @@
     CATID *rgcatidReq)
 {
 /*     ICOM_THIS_MULTI(ComCatMgrImpl, infVtbl, iface); */
-    WCHAR keyname[45] = { 'C', 'L', 'S', 'I', 'D', '\\', 0 };
+    static WCHAR keyname[45] = { 'C', 'L', 'S', 'I', 'D', '\\', 0 };
     HRESULT res;
     struct class_categories *categories;
     HKEY key;
@@ -433,9 +433,9 @@
     IEnumCATEGORYINFO **ppenum)
 {
     IEnumCATEGORYINFOImpl *This = (IEnumCATEGORYINFOImpl *)iface;
-    WCHAR keyname[21] = { 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n',
-			  't', ' ', 'C', 'a', 't', 'e', 'g', 'o',
-			  'r', 'i', 'e', 's', 0 };
+    static WCHAR const keyname[21] = { 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n',
+				       't', ' ', 'C', 'a', 't', 'e', 'g', 'o',
+				       'r', 'i', 'e', 's', 0 };
     IEnumCATEGORYINFOImpl *new_this;
 
     TRACE("\n");
@@ -473,9 +473,9 @@
 
     This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl));
     if (This) {
-	WCHAR keyname[21] = { 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n',
-			      't', ' ', 'C', 'a', 't', 'e', 'g', 'o',
-			      'r', 'i', 'e', 's', 0 };
+	static WCHAR const keyname[21] = { 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n',
+					   't', ' ', 'C', 'a', 't', 'e', 'g', 'o',
+					   'r', 'i', 'e', 's', 0 };
 
 	This->lpVtbl = &COMCAT_IEnumCATEGORYINFO_Vtbl;
 	This->lcid = lcid;
@@ -490,7 +490,7 @@
 static HRESULT COMCAT_GetCategoryDesc(HKEY key, LCID lcid, PWCHAR pszDesc,
 				      ULONG buf_wchars)
 {
-    WCHAR fmt[4] = { '%', 'l', 'X', 0 };
+    static WCHAR const fmt[4] = { '%', 'l', 'X', 0 };
     WCHAR valname[5];
     HRESULT res;
     DWORD type, size = (buf_wchars - 1) * sizeof(WCHAR);
@@ -549,12 +549,12 @@
     HKEY key,
     struct class_categories const* categories)
 {
-    WCHAR impl_keyname[23] = { 'I', 'm', 'p', 'l', 'e', 'm', 'e', 'n',
-			       't', 'e', 'd', ' ', 'C', 'a', 't', 'e',
-			       'g', 'o', 'r', 'i', 'e', 's', 0 };
-    WCHAR req_keyname[20] = { 'R', 'e', 'q', 'u', 'i', 'r', 'e', 'd',
-			      ' ', 'C', 'a', 't', 'e', 'g', 'o', 'r',
-			      'i', 'e', 's', 0 };
+    static WCHAR const impl_keyname[23] = { 'I', 'm', 'p', 'l', 'e', 'm', 'e', 'n',
+					    't', 'e', 'd', ' ', 'C', 'a', 't', 'e',
+					    'g', 'o', 'r', 'i', 'e', 's', 0 };
+    static WCHAR const req_keyname[20]  = { 'R', 'e', 'q', 'u', 'i', 'r', 'e', 'd',
+	    				    ' ', 'C', 'a', 't', 'e', 'g', 'o', 'r',
+					    'i', 'e', 's', 0 };
     HKEY subkey;
     HRESULT res;
     DWORD index;
@@ -735,7 +735,7 @@
     IEnumGUID **ppenum)
 {
     CLSID_IEnumGUIDImpl *This = (CLSID_IEnumGUIDImpl *)iface;
-    WCHAR keyname[6] = { 'C', 'L', 'S', 'I', 'D', 0 };
+    static WCHAR const keyname[6] = { 'C', 'L', 'S', 'I', 'D', 0 };
     CLSID_IEnumGUIDImpl *new_this;
     DWORD size;
 
diff -urN a/dlls/comcat/register.c b/dlls/comcat/register.c
--- a/dlls/comcat/register.c	2006-05-23 13:47:36.000000000 +0100
+++ b/dlls/comcat/register.c	2007-03-16 21:36:51.000000000 +0000
@@ -111,7 +111,7 @@
     if (res != ERROR_SUCCESS) return E_FAIL;
 
     for (; cCategories; --cCategories, ++rgci) {
-	WCHAR fmt[4] = { '%', 'l', 'X', 0 };
+	static WCHAR const fmt[4] = { '%', 'l', 'X', 0 };
 	WCHAR keyname[39];
 	WCHAR valname[9];
 	HKEY cat_key;



More information about the wine-patches mailing list