diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index f0d6053abc..1804788b63 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -1193,7 +1193,7 @@ LsaQueryInformationPolicy( KEY_READ, &key)) == ERROR_SUCCESS) { DWORD size = 0; - WCHAR wg[] = { 'W','o','r','k','g','r','o','u','p',0 }; + static const WCHAR wg[] = { 'W','o','r','k','g','r','o','u','p',0 }; ret = RegQueryValueExW(key, wg, NULL, NULL, NULL, &size); if (ret == ERROR_MORE_DATA || ret == ERROR_SUCCESS) diff --git a/dlls/comctl32/comboex.c b/dlls/comctl32/comboex.c index 3b1a0b548a..7f55192c64 100644 --- a/dlls/comctl32/comboex.c +++ b/dlls/comctl32/comboex.c @@ -915,9 +915,9 @@ static INT COMBOEX_SetItemHeight (COMBOEX_INFO *infoPtr, INT index, UINT height) static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs) { - WCHAR COMBOBOX[] = { 'C', 'o', 'm', 'b', 'o', 'B', 'o', 'x', 0 }; - WCHAR EDIT[] = { 'E', 'D', 'I', 'T', 0 }; - WCHAR NIL[] = { 0 }; + static const WCHAR COMBOBOX[] = { 'C', 'o', 'm', 'b', 'o', 'B', 'o', 'x', 0 }; + static const WCHAR EDIT[] = { 'E', 'D', 'I', 'T', 0 }; + static const WCHAR NIL[] = { 0 }; COMBOEX_INFO *infoPtr; LOGFONTW mylogfont; RECT wnrc1, clrc1, cmbwrc; @@ -1281,7 +1281,7 @@ static BOOL COMBOEX_WM_DeleteItem (COMBOEX_INFO *infoPtr, DELETEITEMSTRUCT *dis) static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT *dis) { - WCHAR nil[] = { 0 }; + static const WCHAR nil[] = { 0 }; CBE_ITEMDATA *item = 0; SIZE txtsize; RECT rect; diff --git a/dlls/comctl32/comctl32undoc.c b/dlls/comctl32/comctl32undoc.c index fabc4d5903..8944c19725 100644 --- a/dlls/comctl32/comctl32undoc.c +++ b/dlls/comctl32/comctl32undoc.c @@ -523,7 +523,7 @@ VOID MRU_SaveChanged( LPWINEMRULIST mp ) HKEY newkey; WCHAR realname[2]; LPWINEMRUITEM witem; - WCHAR emptyW[] = {'\0'}; + static const WCHAR emptyW[] = {'\0'}; /* or should we do the following instead of RegOpenKeyEx: */ @@ -859,7 +859,7 @@ HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp) WCHAR realname[2]; LPWINEMRUITEM witem; DWORD type; - WCHAR emptyW[] = {'\0'}; + static const WCHAR emptyW[] = {'\0'}; /* get space to save indices that will turn into names * but in order of most to least recently used diff --git a/dlls/comctl32/ipaddress.c b/dlls/comctl32/ipaddress.c index 61b463dd8a..d1d52ce064 100644 --- a/dlls/comctl32/ipaddress.c +++ b/dlls/comctl32/ipaddress.c @@ -155,7 +155,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd, LPCREATESTRUCTA lpCreate) IPADDRESS_INFO *infoPtr; RECT rcClient, edit; int i, fieldsize; - WCHAR EDIT[] = { 'E', 'd', 'i', 't', 0 }; + static const WCHAR EDIT[] = { 'E', 'd', 'i', 't', 0 }; TRACE("\n"); @@ -291,7 +291,8 @@ static void IPADDRESS_ClearAddress (IPADDRESS_INFO *infoPtr) static LRESULT IPADDRESS_SetAddress (IPADDRESS_INFO *infoPtr, DWORD ip_address) { - WCHAR buf[20], fmt[] = { '%', 'd', 0 }; + WCHAR buf[20]; + static const WCHAR fmt[] = { '%', 'd', 0 }; int i; TRACE("\n"); @@ -328,7 +329,8 @@ static void IPADDRESS_SetFocusToField (IPADDRESS_INFO *infoPtr, INT index) static BOOL IPADDRESS_ConstrainField (IPADDRESS_INFO *infoPtr, int currentfield) { IPPART_INFO *part = &infoPtr->Part[currentfield]; - WCHAR field[10], fmt[] = { '%', 'd', 0 }; + WCHAR field[10]; + static const WCHAR fmt[] = { '%', 'd', 0 }; int curValue, newValue; TRACE("(currentfield=%d)\n", currentfield); diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index e40b3dc7e3..6a0d29d01f 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -3552,7 +3552,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS { UINT uFormat, uView = infoPtr->dwStyle & LVS_TYPEMASK; WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' }; - WCHAR szCallback[] = { '(', 'c', 'a', 'l', 'l', 'b', 'a', 'c', 'k', ')', 0 }; + static const WCHAR szCallback[] = { '(', 'c', 'a', 'l', 'l', 'b', 'a', 'c', 'k', ')', 0 }; DWORD cdsubitemmode = CDRF_DODEFAULT; RECT* lprcFocus, rcSelect, rcBox, rcState, rcIcon, rcLabel; NMLVCUSTOMDRAW nmlvcd; @@ -3575,7 +3575,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS if (!LISTVIEW_GetItemW(infoPtr, &lvItem)) return FALSE; if (nSubItem > 0 && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)) lvItem.state = LISTVIEW_GetItemState(infoPtr, nItem, LVIS_SELECTED); - if (lvItem.pszText == LPSTR_TEXTCALLBACKW) lvItem.pszText = szCallback; + if (lvItem.pszText == LPSTR_TEXTCALLBACKW) lvItem.pszText = (LPWSTR)szCallback; TRACE(" lvItem=%s\n", debuglvitem_t(&lvItem, TRUE)); /* now check if we need to update the focus rectangle */ diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c index 79c5c3709e..01924648d1 100644 --- a/dlls/comctl32/trackbar.c +++ b/dlls/comctl32/trackbar.c @@ -728,7 +728,8 @@ static void TRACKBAR_UpdateToolTip (TRACKBAR_INFO *infoPtr) { DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE); - WCHAR buf[80], fmt[] = { '%', 'l', 'd', 0 }; + WCHAR buf[80]; + static const WCHAR fmt[] = { '%', 'l', 'd', 0 }; TTTOOLINFOW ti; POINT pt; RECT rcClient; diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index 9d6880da55..00d0c54cd0 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -3467,7 +3467,7 @@ TREEVIEW_EditLabel(TREEVIEW_INFO *infoPtr, HTREEITEM hItem) HDC hdc; HFONT hOldFont=0; TEXTMETRICW textMetric; - WCHAR EditW[] = {'E','d','i','t',0}; + static const WCHAR EditW[] = {'E','d','i','t',0}; TRACE("%x %p\n", (unsigned)hwnd, hItem); if (!TREEVIEW_ValidItem(infoPtr, editItem)) diff --git a/dlls/commdlg/filedlg.c b/dlls/commdlg/filedlg.c index f4de90318a..cc8350daaa 100644 --- a/dlls/commdlg/filedlg.c +++ b/dlls/commdlg/filedlg.c @@ -1016,8 +1016,8 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) int win98plus = 0; int handledPath = FALSE; OSVERSIONINFOA osVi; - const WCHAR szwSlash[] = { '\\', 0 }; - const WCHAR szwStar[] = { '*',0 }; + static const WCHAR szwSlash[] = { '\\', 0 }; + static const WCHAR szwStar[] = { '*',0 }; TBBUTTON tbb[] = { @@ -1539,7 +1539,7 @@ BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCo WCHAR lpstrNotFound[100]; WCHAR lpstrMsg[100]; WCHAR tmp[400]; - WCHAR nl[] = {'\n',0}; + static const WCHAR nl[] = {'\n',0}; LoadStringW(COMDLG32_hInstance, IDS_FILENOTFOUND, lpstrNotFound, 100); LoadStringW(COMDLG32_hInstance, IDS_VERIFYFILE, lpstrMsg, 100); @@ -1717,7 +1717,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) { LPWSTR lpszTemp, lpszTemp1; LPITEMIDLIST pidl = NULL; - WCHAR szwInvalid[] = { '/',':','<','>','|', 0}; + static const WCHAR szwInvalid[] = { '/',':','<','>','|', 0}; /* check for invalid chars */ if((strpbrkW(lpstrPathAndFile+3, szwInvalid) != NULL) && !(fodInfos->ofnInfos->Flags & OFN_NOVALIDATE)) @@ -1747,7 +1747,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) if(*lpszTemp==0) { - WCHAR wszWild[] = { '*', '?', 0 }; + static const WCHAR wszWild[] = { '*', '?', 0 }; /* if the last element is a wildcard do a search */ if(strpbrkW(lpszTemp1, wszWild) != NULL) { @@ -1886,7 +1886,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) /* only add "." in case a default extension does exist */ if (*fodInfos->defext != '\0') { - const WCHAR szwDot[] = {'.',0}; + static const WCHAR szwDot[] = {'.',0}; int PathLength = strlenW(lpstrPathAndFile); strcatW(lpstrPathAndFile, szwDot); @@ -3188,7 +3188,7 @@ static BOOL BrowseSelectedFolder(HWND hwnd) if ( FAILED( IShellBrowser_BrowseObject( fodInfos->Shell.FOIShellBrowser, pidlSelection, SBSP_RELATIVE ) ) ) { - WCHAR notexist[] = {'P','a','t','h',' ','d','o','e','s', + static const WCHAR notexist[] = {'P','a','t','h',' ','d','o','e','s', ' ','n','o','t',' ','e','x','i','s','t',0}; MessageBoxW( hwnd, notexist, fodInfos->title, MB_OK | MB_ICONEXCLAMATION ); } diff --git a/dlls/dxerr8/dxerr8.c b/dlls/dxerr8/dxerr8.c index d97d611689..a5ededcba4 100644 --- a/dlls/dxerr8/dxerr8.c +++ b/dlls/dxerr8/dxerr8.c @@ -133,22 +133,22 @@ HRESULT WINAPI DXTraceW(const char* strFile, DWORD dwLine, HRESULT hr, const WCH TRACE("(%p,%ld,0x%08lx,%p,%d)\n", strFile, dwLine, hr, strMsg, bPopMsgBox); if (bPopMsgBox) { - WCHAR format[] = { 'F','i','l','e',':',' ','%','s','\\','n','L','i','n', + static const WCHAR format[] = { 'F','i','l','e',':',' ','%','s','\\','n','L','i','n', 'e',':',' ','%','l','d','\\','n','E','r','r','o','r',' ','C','o', 'd','e',':',' ','%','s',' ','(','0','x','%','0','8','l','x',')', '\\','n','C','a','l','l','i','n','g',':',' ','%','s',0 }; - WCHAR caption[] = { 'U','n','e','x','p','e','c','t','e','d',' ','e','r', - 'r','o','r',' ','e','n','c','o','u','n','t','e','r','e','d',0 }; + static const WCHAR caption[] = { 'U','n','e','x','p','e','c','t','e','d',' ','e','r', + 'r','o','r',' ','e','n','c','o','u','n','t','e','r','e','d',0 }; /* FIXME: should use wsnprintf */ - wsprintfW(msg, format, strFile, dwLine, + wsprintfW(msg, format, strFile, dwLine, DXGetErrorString8W(hr), hr, strMsg); MessageBoxW(0, msg, caption, MB_OK|MB_ICONERROR); } else { - WCHAR format[] = { '%','s','(','%','l','d',')',':',' ','%','s',' ','(', + static const WCHAR format[] = { '%','s','(','%','l','d',')',':',' ','%','s',' ','(', 'h','r','=','%','s',' ','(','0','x','%','0','8','l','x',')',')',' ', 0 }; /* FIXME: should use wsnprintf */ - wsprintfW(msg, format, strFile, dwLine, strMsg, + wsprintfW(msg, format, strFile, dwLine, strMsg, DXGetErrorString8W(hr), hr); OutputDebugStringW(msg); } diff --git a/dlls/dxerr9/dxerr9.c b/dlls/dxerr9/dxerr9.c index 6bfee44dc1..08c2a3f447 100644 --- a/dlls/dxerr9/dxerr9.c +++ b/dlls/dxerr9/dxerr9.c @@ -133,22 +133,22 @@ HRESULT WINAPI DXTraceW(const char* strFile, DWORD dwLine, HRESULT hr, const WCH TRACE("(%p,%ld,0x%08lx,%p,%d)\n", strFile, dwLine, hr, strMsg, bPopMsgBox); if (bPopMsgBox) { - WCHAR format[] = { 'F','i','l','e',':',' ','%','s','\\','n','L','i','n', + static const WCHAR format[] = { 'F','i','l','e',':',' ','%','s','\\','n','L','i','n', 'e',':',' ','%','l','d','\\','n','E','r','r','o','r',' ','C','o', 'd','e',':',' ','%','s',' ','(','0','x','%','0','8','l','x',')', '\\','n','C','a','l','l','i','n','g',':',' ','%','s',0 }; - WCHAR caption[] = { 'U','n','e','x','p','e','c','t','e','d',' ','e','r', - 'r','o','r',' ','e','n','c','o','u','n','t','e','r','e','d',0 }; + static const WCHAR caption[] = { 'U','n','e','x','p','e','c','t','e','d',' ','e','r', + 'r','o','r',' ','e','n','c','o','u','n','t','e','r','e','d',0 }; /* FIXME: should use wsnprintf */ - wsprintfW(msg, format, strFile, dwLine, + wsprintfW(msg, format, strFile, dwLine, DXGetErrorString9W(hr), hr, strMsg); MessageBoxW(0, msg, caption, MB_OK|MB_ICONERROR); } else { - WCHAR format[] = { '%','s','(','%','l','d',')',':',' ','%','s',' ','(', + static const WCHAR format[] = { '%','s','(','%','l','d',')',':',' ','%','s',' ','(', 'h','r','=','%','s',' ','(','0','x','%','0','8','l','x',')',')',' ', 0 }; /* FIXME: should use wsnprintf */ - wsprintfW(msg, format, strFile, dwLine, strMsg, + wsprintfW(msg, format, strFile, dwLine, strMsg, DXGetErrorString9W(hr), hr); OutputDebugStringW(msg); } diff --git a/dlls/gdi/freetype.c b/dlls/gdi/freetype.c index 79e3633eea..b51a95a1ce 100644 --- a/dlls/gdi/freetype.c +++ b/dlls/gdi/freetype.c @@ -2270,7 +2270,7 @@ UINT WineEngGetOutlineTextMetrics(GdiFont font, UINT cbSize, TT_Postscript *pPost; FT_Fixed x_scale, y_scale; WCHAR *family_nameW, *style_nameW; - WCHAR spaceW[] = {' ', '\0'}; + static const WCHAR spaceW[] = {' ', '\0'}; char *cp; INT ascent, descent; diff --git a/dlls/kernel/tests/file.c b/dlls/kernel/tests/file.c index 7ec229c307..c933ad68cb 100644 --- a/dlls/kernel/tests/file.c +++ b/dlls/kernel/tests/file.c @@ -596,7 +596,7 @@ static void test_CreateFileW(void) HANDLE hFile; WCHAR temp_path[MAX_PATH]; WCHAR filename[MAX_PATH]; - WCHAR emptyW[]={'\0'}; + static const WCHAR emptyW[]={'\0'}; static const WCHAR prefix[] = {'p','f','x',0}; DWORD ret; @@ -668,7 +668,7 @@ static void test_DeleteFileA( void ) static void test_DeleteFileW( void ) { BOOL ret; - WCHAR emptyW[]={'\0'}; + static const WCHAR emptyW[]={'\0'}; ret = DeleteFileW(NULL); if (ret==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) diff --git a/dlls/kernel/tests/format_msg.c b/dlls/kernel/tests/format_msg.c index d19e3f4a03..e6f317c7db 100644 --- a/dlls/kernel/tests/format_msg.c +++ b/dlls/kernel/tests/format_msg.c @@ -42,7 +42,7 @@ void test_message_from_string(void) { CHAR out[0x100] = {0}; DWORD r; - WCHAR szwTest[] = { 't','e','s','t',0}; + static const WCHAR szwTest[] = { 't','e','s','t',0}; /* the basics */ r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING, "test", 0, diff --git a/dlls/ntdll/tests/rtlstr.c b/dlls/ntdll/tests/rtlstr.c index 41a12c8a6c..eab3c722d1 100644 --- a/dlls/ntdll/tests/rtlstr.c +++ b/dlls/ntdll/tests/rtlstr.c @@ -191,7 +191,7 @@ static void test_RtlInitUnicodeString(void) static void test_RtlInitUnicodeStringEx(void) { - WCHAR teststring[] = {'S','o','m','e',' ','W','i','l','d',' ','S','t','r','i','n','g',0}; + static const WCHAR teststring[] = {'S','o','m','e',' ','W','i','l','d',' ','S','t','r','i','n','g',0}; WCHAR *teststring2; UNICODE_STRING uni; NTSTATUS result; diff --git a/dlls/ole32/antimoniker.c b/dlls/ole32/antimoniker.c index fd039dd98f..f323ef49aa 100644 --- a/dlls/ole32/antimoniker.c +++ b/dlls/ole32/antimoniker.c @@ -539,7 +539,7 @@ HRESULT WINAPI AntiMonikerImpl_GetDisplayName(IMoniker* iface, IMoniker* pmkToLeft, LPOLESTR *ppszDisplayName) { - WCHAR back[]={'\\','.','.',0}; + static const WCHAR back[]={'\\','.','.',0}; TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName); diff --git a/dlls/ole32/filemoniker.c b/dlls/ole32/filemoniker.c index 986ce9bb98..0beaca2660 100644 --- a/dlls/ole32/filemoniker.c +++ b/dlls/ole32/filemoniker.c @@ -473,8 +473,8 @@ HRESULT WINAPI FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPa int nb=0,i; int sizeStr=lstrlenW(lpszPathName); LPOLESTR *tabStr=0; - WCHAR twoPoint[]={'.','.',0}; - WCHAR bkSlash[]={'\\',0}; + static const WCHAR twoPoint[]={'.','.',0}; + static const WCHAR bkSlash[]={'\\',0}; BYTE addBkSlash; TRACE("(%p,%p)\n",This,lpszPathName); @@ -751,8 +751,8 @@ HRESULT WINAPI FileMonikerImpl_ComposeWith(IMoniker* iface, { HRESULT res; LPOLESTR str1=0,str2=0,*strDec1=0,*strDec2=0,newStr=0; - WCHAR twoPoint[]={'.','.',0}; - WCHAR bkSlash[]={'\\',0}; + static const WCHAR twoPoint[]={'.','.',0}; + static const WCHAR bkSlash[]={'\\',0}; IBindCtx *bind=0; int i=0,j=0,lastIdx1=0,lastIdx2=0; DWORD mkSys; @@ -1098,7 +1098,7 @@ HRESULT WINAPI FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOth ******************************************************************************/ int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable) { - WCHAR bSlash[] = {'\\',0}; + static const WCHAR bSlash[] = {'\\',0}; WCHAR word[MAX_PATH]; int i=0,j,tabIndex=0; LPOLESTR *strgtable ; @@ -1157,7 +1157,7 @@ HRESULT WINAPI FileMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, HRESULT res; LPOLESTR str1=0,str2=0,*tabStr1=0,*tabStr2=0,relPath=0; DWORD len1=0,len2=0,sameIdx=0,j=0; - WCHAR back[] ={'.','.','\\',0}; + static const WCHAR back[] ={'.','.','\\',0}; TRACE("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath); diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 4347e9632c..4348a4d31c 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -5445,7 +5445,7 @@ HRESULT WINAPI StgCreateDocfile( if (pwcsName == 0) { WCHAR tempPath[MAX_PATH]; - WCHAR prefix[] = { 'S', 'T', 'O', 0 }; + static const WCHAR prefix[] = { 'S', 'T', 'O', 0 }; if (!(grfMode & STGM_SHARE_EXCLUSIVE)) return STG_E_INVALIDFLAG; @@ -6424,7 +6424,7 @@ void OLECONVERT_GetOLE20FromOLE10(LPSTORAGE pDestStorage, BYTE *pBuffer, DWORD n IStorage *pTempStorage; DWORD dwNumOfBytesWritten; WCHAR wstrTempDir[MAX_PATH], wstrTempFile[MAX_PATH]; - WCHAR wstrPrefix[] = {'s', 'i', 's', 0}; + static const WCHAR wstrPrefix[] = {'s', 'i', 's', 0}; /* Create a temp File */ GetTempPathW(MAX_PATH, wstrTempDir); @@ -6474,7 +6474,7 @@ DWORD OLECONVERT_WriteOLE20ToBuffer(LPSTORAGE pStorage, BYTE **pData) DWORD nDataLength = 0; IStorage *pTempStorage; WCHAR wstrTempDir[MAX_PATH], wstrTempFile[MAX_PATH]; - WCHAR wstrPrefix[] = {'s', 'i', 's', 0}; + static const WCHAR wstrPrefix[] = {'s', 'i', 's', 0}; *pData = NULL; @@ -6527,7 +6527,7 @@ void OLECONVERT_CreateOleStream(LPSTORAGE pStorage) { HRESULT hRes; IStream *pStream; - WCHAR wstrStreamName[] = {1,'O', 'l', 'e', 0}; + static const WCHAR wstrStreamName[] = {1,'O', 'l', 'e', 0}; BYTE pOleStreamHeader [] = { 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, @@ -6616,7 +6616,7 @@ static HRESULT STORAGE_WriteCompObj( LPSTORAGE pstg, CLSID *clsid, { IStream *pstm; HRESULT r = S_OK; - WCHAR szwStreamName[] = {1, 'C', 'o', 'm', 'p', 'O', 'b', 'j', 0}; + static const WCHAR szwStreamName[] = {1, 'C', 'o', 'm', 'p', 'O', 'b', 'j', 0}; static const BYTE unknown1[12] = { 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00, @@ -6855,7 +6855,7 @@ HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName IStream *pStream; HRESULT hStorageRes, hRes = S_OK; OLECONVERT_ISTORAGE_COMPOBJ IStorageCompObj; - WCHAR wstrStreamName[] = {1,'C', 'o', 'm', 'p', 'O', 'b', 'j', 0}; + static const WCHAR wstrStreamName[] = {1,'C', 'o', 'm', 'p', 'O', 'b', 'j', 0}; WCHAR bufferW[OLESTREAM_MAX_STR_LEN]; BYTE pCompObjUnknown1[] = {0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF}; @@ -6956,7 +6956,7 @@ void OLECONVERT_CreateOlePresStream(LPSTORAGE pStorage, DWORD dwExtentX, DWORD d { HRESULT hRes; IStream *pStream; - WCHAR wstrStreamName[] = {2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0}; + static const WCHAR wstrStreamName[] = {2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0}; BYTE pOlePresStreamHeader [] = { 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, @@ -7040,7 +7040,7 @@ void OLECONVERT_CreateOle10NativeStream(LPSTORAGE pStorage, BYTE *pData, DWORD d { HRESULT hRes; IStream *pStream; - WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0}; + static const WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0}; /* Create the Ole10Native Stream */ hRes = IStorage_CreateStream(pStorage, wstrStreamName, @@ -7081,7 +7081,7 @@ HRESULT OLECONVERT_GetOLE10ProgID(LPSTORAGE pStorage, char *strProgID, DWORD *dw IStream *pStream; LARGE_INTEGER iSeekPos; OLECONVERT_ISTORAGE_COMPOBJ CompObj; - WCHAR wstrStreamName[] = {1,'C', 'o', 'm', 'p', 'O', 'b', 'j', 0}; + static const WCHAR wstrStreamName[] = {1,'C', 'o', 'm', 'p', 'O', 'b', 'j', 0}; /* Open the CompObj Stream */ hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, @@ -7150,7 +7150,7 @@ void OLECONVERT_GetOle10PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA * HRESULT hRes; IStream *pStream; - WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0}; + static const WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0}; /* Initialize Default data for OLESTREAM */ pOleStreamData[0].dwOleID = OLESTREAM_ID; @@ -7203,7 +7203,7 @@ void OLECONVERT_GetOle20PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA * HRESULT hRes; IStream *pStream; OLECONVERT_ISTORAGE_OLEPRES olePress; - WCHAR wstrStreamName[] = {2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0}; + static const WCHAR wstrStreamName[] = {2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0}; /* Initialize Default data for OLESTREAM */ pOleStreamData[0].dwOleID = OLESTREAM_ID; @@ -7384,7 +7384,7 @@ HRESULT WINAPI OleConvertIStorageToOLESTREAM ( HRESULT hRes = S_OK; IStream *pStream; OLECONVERT_OLESTREAM_DATA pOleStreamData[2]; - WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0}; + static const WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0}; memset(pOleStreamData, 0, sizeof(pOleStreamData)); diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c index 5a933cd8da..a377dad7f7 100644 --- a/dlls/oleaut32/olefont.c +++ b/dlls/oleaut32/olefont.c @@ -1214,7 +1214,7 @@ static HRESULT WINAPI OLEFontImpl_GetTypeInfo( LCID lcid, ITypeInfo** ppTInfo) { - WCHAR stdole32tlb[] = {'s','t','d','o','l','e','3','2','.','t','l','b',0}; + static const WCHAR stdole32tlb[] = {'s','t','d','o','l','e','3','2','.','t','l','b',0}; ITypeLib *tl; HRESULT hres; diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 62852cb9a9..2d831cfef5 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -308,7 +308,7 @@ HRESULT WINAPI LoadTypeLibEx( return TYPE_E_CANTLOADLIBRARY; } else { WCHAR tstpath[260]; - WCHAR stdole32tlb[] = { 's','t','d','o','l','e','3','2','.','t','l','b',0 }; + static const WCHAR stdole32tlb[] = { 's','t','d','o','l','e','3','2','.','t','l','b',0 }; int i; lstrcpyW(tstpath,szFile); diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index d3fe65b0f5..58dcb6baaf 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -193,7 +193,7 @@ static HRESULT GetClassMediaFile(IAsyncReader * pReader, LPCOLESTR pszFileName, HKEY hkeyMediaType = NULL; HRESULT hr = S_OK; BOOL bFound = FALSE; - WCHAR wszMediaType[] = {'M','e','d','i','a',' ','T','y','p','e',0}; + static const WCHAR wszMediaType[] = {'M','e','d','i','a',' ','T','y','p','e',0}; CopyMemory(majorType, &GUID_NULL, sizeof(*majorType)); CopyMemory(minorType, &GUID_NULL, sizeof(*minorType)); diff --git a/dlls/setupapi/diskspace.c b/dlls/setupapi/diskspace.c index 965df5c844..f47137b526 100644 --- a/dlls/setupapi/diskspace.c +++ b/dlls/setupapi/diskspace.c @@ -120,7 +120,7 @@ BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace, int i; LPDISKSPACELIST list = (LPDISKSPACELIST)DiskSpace; BOOL rc = FALSE; - WCHAR bkslsh[]= {'\\',0}; + static const WCHAR bkslsh[]= {'\\',0}; MultiByteToWideChar(CP_ACP,0,DriveSpec,-1,driveW,20); diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index 4bf9c72ecd..fb332fa60f 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -356,8 +356,8 @@ DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, /* get the type name */ if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME)) { - WCHAR szFile[] = { 'F','i','l','e',0 }; - WCHAR szDashFile[] = { '-','f','i','l','e',0 }; + static const WCHAR szFile[] = { 'F','i','l','e',0 }; + static const WCHAR szDashFile[] = { '-','f','i','l','e',0 }; if (!(flags & SHGFI_USEFILEATTRIBUTES)) { char ftype[80]; @@ -428,7 +428,7 @@ DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, psfi->iIcon = 2; else { - WCHAR p1W[] = {'%','1',0}; + static const WCHAR p1W[] = {'%','1',0}; psfi->iIcon = 0; szExt = (LPWSTR) PathFindExtensionW(sTemp); if ( szExt && HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c index 2195666937..6cebf0034a 100644 --- a/dlls/shell32/shlfileop.c +++ b/dlls/shell32/shlfileop.c @@ -53,9 +53,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); #define FO_MASK 0xF CHAR aWildcardFile[] = {'*','.','*',0}; -WCHAR wWildcardFile[] = {'*','.','*',0}; -WCHAR wWildcardChars[] = {'*','?',0}; -WCHAR wBackslash[] = {'\\',0}; +static const WCHAR wWildcardFile[] = {'*','.','*',0}; +static const WCHAR wWildcardChars[] = {'*','?',0}; +static const WCHAR wBackslash[] = {'\\',0}; static DWORD SHNotifyCreateDirectoryA(LPCSTR path, LPSECURITY_ATTRIBUTES sec); static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec); diff --git a/dlls/shlwapi/reg.c b/dlls/shlwapi/reg.c index f18409bba7..9760ead931 100644 --- a/dlls/shlwapi/reg.c +++ b/dlls/shlwapi/reg.c @@ -1076,7 +1076,7 @@ DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, { DWORD dwRet = ERROR_SUCCESS, dwDummy; HKEY hSubKey; - WCHAR szEmpty[] = { '\0' }; + static const WCHAR szEmpty[] = { '\0' }; TRACE("(hkey=%p,%s,%s,%ld,%p,%ld)\n", hKey, debugstr_w(lpszSubKey), debugstr_w(lpszValue), dwType, pvData, cbData); diff --git a/dlls/shlwapi/string.c b/dlls/shlwapi/string.c index c970a47824..37f67152f5 100644 --- a/dlls/shlwapi/string.c +++ b/dlls/shlwapi/string.c @@ -2530,7 +2530,7 @@ DWORD WINAPI SHAnsiToUnicode(LPCSTR lpSrcStr, LPWSTR lpDstStr, int iLen) INT WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr, LPINT lpiLen) { - WCHAR emptyW[] = { '\0' }; + static const WCHAR emptyW[] = { '\0' }; int len , reqLen; LPSTR mem; diff --git a/dlls/shlwapi/url.c b/dlls/shlwapi/url.c index 35e04e556e..a86c56b644 100644 --- a/dlls/shlwapi/url.c +++ b/dlls/shlwapi/url.c @@ -687,8 +687,8 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative, DWORD myflags, sizeloc = 0; DWORD len, res1, res2, process_case = 0; LPWSTR work, preliminary, mbase, mrelative; - WCHAR myfilestr[] = {'f','i','l','e',':','/','/','/','\0'}; - WCHAR single_slash[] = {'/','\0'}; + static const WCHAR myfilestr[] = {'f','i','l','e',':','/','/','/','\0'}; + static const WCHAR single_slash[] = {'/','\0'}; HRESULT ret; TRACE("(base %s, Relative %s, Combine size %ld, flags %08lx)\n", diff --git a/dlls/user/tests/class.c b/dlls/user/tests/class.c index 156a12c7fa..2516b7c4eb 100644 --- a/dlls/user/tests/class.c +++ b/dlls/user/tests/class.c @@ -45,8 +45,8 @@ static LRESULT WINAPI ClassTest_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPA static void ClassTest(HINSTANCE hInstance, BOOL global) { WNDCLASSW cls, wc; - WCHAR className[] = {'T','e','s','t','C','l','a','s','s',0}; - WCHAR winName[] = {'W','i','n','C','l','a','s','s','T','e','s','t',0}; + static const WCHAR className[] = {'T','e','s','t','C','l','a','s','s',0}; + static const WCHAR winName[] = {'W','i','n','C','l','a','s','s','T','e','s','t',0}; ATOM test_atom; HWND hTestWnd; DWORD i; diff --git a/dlls/uxtheme/msstyles.c b/dlls/uxtheme/msstyles.c index ccf2a8ac72..531380365e 100644 --- a/dlls/uxtheme/msstyles.c +++ b/dlls/uxtheme/msstyles.c @@ -78,13 +78,13 @@ HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWST HMODULE hTheme; HRSRC hrsc; HRESULT hr = S_OK; - WCHAR szPackThemVersionResource[] = { + static const WCHAR szPackThemVersionResource[] = { 'P','A','C','K','T','H','E','M','_','V','E','R','S','I','O','N', '\0' }; - WCHAR szColorNamesResource[] = { + static const WCHAR szColorNamesResource[] = { 'C','O','L','O','R','N','A','M','E','S','\0' }; - WCHAR szSizeNamesResource[] = { + static const WCHAR szSizeNamesResource[] = { 'S','I','Z','E','N','A','M','E','S','\0' }; @@ -250,7 +250,7 @@ PUXINI_FILE MSSTYLES_GetThemeIni(PTHEME_FILE tf) */ PUXINI_FILE MSSTYLES_GetActiveThemeIni(PTHEME_FILE tf) { - WCHAR szFileResNamesResource[] = { + static const WCHAR szFileResNamesResource[] = { 'F','I','L','E','R','E','S','N','A','M','E','S','\0' }; DWORD dwColorCount = 0; @@ -661,8 +661,8 @@ PTHEME_PROPERTY MSSTYLES_AddMetric(PTHEME_FILE tf, int iPropertyPrimitive, int i */ void MSSTYLES_ParseThemeIni(PTHEME_FILE tf) { - WCHAR szSysMetrics[] = {'S','y','s','M','e','t','r','i','c','s','\0'}; - WCHAR szGlobals[] = {'g','l','o','b','a','l','s','\0'}; + static const WCHAR szSysMetrics[] = {'S','y','s','M','e','t','r','i','c','s','\0'}; + static const WCHAR szGlobals[] = {'g','l','o','b','a','l','s','\0'}; PTHEME_CLASS cls; PTHEME_CLASS globals; PTHEME_PARTSTATE ps; diff --git a/dlls/uxtheme/system.c b/dlls/uxtheme/system.c index a68d0be366..ee7511e8ab 100644 --- a/dlls/uxtheme/system.c +++ b/dlls/uxtheme/system.c @@ -602,10 +602,10 @@ HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback, { WCHAR szDir[MAX_PATH]; WCHAR szPath[MAX_PATH]; - WCHAR szStar[] = {'*','.','*','\0'}; - WCHAR szFormat[] = {'%','s','%','s','\\','%','s','.','m','s','s','t','y','l','e','s','\0'}; - WCHAR szDisplayName[] = {'d','i','s','p','l','a','y','n','a','m','e','\0'}; - WCHAR szTooltip[] = {'t','o','o','l','t','i','p','\0'}; + static const WCHAR szStar[] = {'*','.','*','\0'}; + static const WCHAR szFormat[] = {'%','s','%','s','\\','%','s','.','m','s','s','t','y','l','e','s','\0'}; + static const WCHAR szDisplayName[] = {'d','i','s','p','l','a','y','n','a','m','e','\0'}; + static const WCHAR szTooltip[] = {'t','o','o','l','t','i','p','\0'}; WCHAR szName[60]; WCHAR szTip[60]; HANDLE hFind;