From 529183cda7180b1bd249bb098cf3453ce830a9da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Fri, 6 Mar 2015 20:32:38 +0000 Subject: [PATCH] [SHIMGVW] - Few whitespace fixes. - Fix a regression where an exception was thrown when opening a file from cdrom. Patch by Ricardo Hanke. CORE-9250 #resolve #comment Patch v2 committed! Thanks! svn path=/trunk/; revision=66592 --- reactos/dll/win32/shimgvw/comsup.c | 6 +++--- reactos/dll/win32/shimgvw/shimgvw.c | 31 +++++++++++++---------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/reactos/dll/win32/shimgvw/comsup.c b/reactos/dll/win32/shimgvw/comsup.c index 473d634cb15..74fdeae1cd1 100644 --- a/reactos/dll/win32/shimgvw/comsup.c +++ b/reactos/dll/win32/shimgvw/comsup.c @@ -34,12 +34,12 @@ DllUnregisterServer(VOID) STDAPI DllCanUnloadNow(VOID) { - if ((ObjectCount != 0) || (LockCount != 0)) + if ((ObjectCount != 0) || (LockCount != 0)) { return S_FALSE; } else - { + { return S_OK; } } @@ -53,6 +53,6 @@ DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) /* There are no classes to export, so always return CLASS_E_CLASSNOTAVAILABLE*/ *ppv = NULL; hr = CLASS_E_CLASSNOTAVAILABLE; - + return hr; } diff --git a/reactos/dll/win32/shimgvw/shimgvw.c b/reactos/dll/win32/shimgvw/shimgvw.c index 557c925fb30..00e9dd9b815 100644 --- a/reactos/dll/win32/shimgvw/shimgvw.c +++ b/reactos/dll/win32/shimgvw/shimgvw.c @@ -1,5 +1,4 @@ /* - * * PROJECT: ReactOS Picture and Fax Viewer * FILE: dll/win32/shimgvw/shimgvw.c * PURPOSE: shimgvw.dll @@ -175,9 +174,9 @@ pLoadImageFromNode(SHIMGVW_FILENODE *node, HWND hwnd) { c++; } - - LoadStringW(hInstance, IDS_APPTITLE, szResStr, 512); - StringCbPrintfExW(szTitleBuf, 800, NULL, NULL, 0, L"%ls%ls%ls", szResStr, L" - ", c); + + LoadStringW(hInstance, IDS_APPTITLE, szResStr, ARRAYSIZE(szResStr)); + StringCbPrintfW(szTitleBuf, sizeof(szTitleBuf), L"%ls%ls%ls", szResStr, L" - ", c); SetWindowTextW(hwnd, szTitleBuf); if (image) @@ -200,16 +199,15 @@ pBuildFileList(LPWSTR szFirstFile) WCHAR szSearchMask[MAX_PATH]; WCHAR szFileTypes[MAX_PATH]; WIN32_FIND_DATAW findData; - SHIMGVW_FILENODE *currentNode; - SHIMGVW_FILENODE *root; - SHIMGVW_FILENODE *conductor; + SHIMGVW_FILENODE *currentNode = NULL; + SHIMGVW_FILENODE *root = NULL; + SHIMGVW_FILENODE *conductor = NULL; ImageCodecInfo *codecInfo; UINT num; UINT size; UINT j; - - wcscpy(szSearchPath, szFirstFile); + StringCbCopyW(szSearchPath, sizeof(szSearchPath), szFirstFile); PathRemoveFileSpecW(szSearchPath); GdipGetImageDecodersSize(&num, &size); @@ -234,19 +232,19 @@ pBuildFileList(LPWSTR szFirstFile) for (j = 0; j < num; ++j) { - StringCbPrintfExW(szFileTypes, MAX_PATH, NULL, NULL, 0, L"%ls", codecInfo[j].FilenameExtension); - + StringCbCopyW(szFileTypes, sizeof(szFileTypes), codecInfo[j].FilenameExtension); + extension = wcstok(szFileTypes, L";"); while (extension != NULL) { - StringCbPrintfExW(szSearchMask, MAX_PATH, NULL, NULL, 0, L"%ls%ls%ls", szSearchPath, L"\\", extension); + PathCombineW(szSearchMask, szSearchPath, extension); hFindHandle = FindFirstFileW(szSearchMask, &findData); if (hFindHandle != INVALID_HANDLE_VALUE) { do { - StringCbPrintfExW(conductor->FileName, MAX_PATH, NULL, NULL, 0, L"%ls%ls%ls", szSearchPath, L"\\", findData.cFileName); + PathCombineW(conductor->FileName, szSearchPath, findData.cFileName); // compare the name of the requested file with the one currently found. // if the name matches, the current node is returned by the function. @@ -261,7 +259,7 @@ pBuildFileList(LPWSTR szFirstFile) if (!conductor->Next) { DPRINT1("malloc() failed in pLoadFileList()\n"); - + conductor->Next = root; root->Prev = conductor; @@ -286,7 +284,7 @@ pBuildFileList(LPWSTR szFirstFile) // we use this node to store the name of it, otherwise we free it. if (currentNode == NULL) { - StringCbPrintfExW(conductor->FileName, MAX_PATH, NULL, NULL, 0, L"%ls", szFirstFile); + StringCchCopyW(conductor->FileName, MAX_PATH, szFirstFile); currentNode = conductor; } else @@ -503,7 +501,7 @@ ImageView_DispWndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) ImageView_DrawImage(hwnd); return 0L; } - } + } return CallWindowProc(PrevProc, hwnd, Message, wParam, lParam); } @@ -793,4 +791,3 @@ DllMain(IN HINSTANCE hinstDLL, return TRUE; } -