Commit 9837b598 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Replaced some weird C constructs (char[]="" ) with more compatible ones.

Added another NULL ptr check in _OnOpen.
parent de078696
...@@ -1085,10 +1085,12 @@ static LRESULT FILEDLG95_InitUI(HWND hwnd) ...@@ -1085,10 +1085,12 @@ static LRESULT FILEDLG95_InitUI(HWND hwnd)
*/ */
BOOL FILEDLG95_OnOpen(HWND hwnd) BOOL FILEDLG95_OnOpen(HWND hwnd)
{ {
char lpstrSpecifiedByUser[MAX_PATH] = ""; char lpstrSpecifiedByUser[MAX_PATH];
FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
LPITEMIDLIST pidlSelection; LPITEMIDLIST pidlSelection;
lpstrSpecifiedByUser[0]='\0';
TRACE("\n"); TRACE("\n");
/* Check if there is a selected item in the listview */ /* Check if there is a selected item in the listview */
...@@ -1108,9 +1110,13 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) ...@@ -1108,9 +1110,13 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
LPITEMIDLIST browsePidl; LPITEMIDLIST browsePidl;
LPSTR lpstrFileSpec; LPSTR lpstrFileSpec;
LPSTR lpstrTemp; LPSTR lpstrTemp;
char lpstrPathSpec[MAX_PATH] = ""; char lpstrPathSpec[MAX_PATH];
char lpstrCurrentDir[MAX_PATH] = ""; char lpstrCurrentDir[MAX_PATH];
char lpstrPathAndFile[MAX_PATH] = ""; char lpstrPathAndFile[MAX_PATH];
lpstrPathSpec[0] = '\0';
lpstrCurrentDir[0] = '\0';
lpstrPathAndFile[0] = '\0';
/* Separate the file spec from the path spec /* Separate the file spec from the path spec
e.g.: e.g.:
...@@ -1148,8 +1154,9 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) ...@@ -1148,8 +1154,9 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
case '.': case '.':
{ {
INT iSize; INT iSize;
char lpstrTmp2[MAX_PATH] = ""; char lpstrTmp2[MAX_PATH];
LPSTR lpstrTmp = strrchr(lpstrCurrentDir,'\\'); LPSTR lpstrTmp = strrchr(lpstrCurrentDir,'\\');
iSize = lpstrTmp - lpstrCurrentDir; iSize = lpstrTmp - lpstrCurrentDir;
strncpy(lpstrTmp2,lpstrCurrentDir,iSize + 1); strncpy(lpstrTmp2,lpstrCurrentDir,iSize + 1);
if(strlen(lpstrSpecifiedByUser) <= 3) if(strlen(lpstrSpecifiedByUser) <= 3)
...@@ -1161,7 +1168,8 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) ...@@ -1161,7 +1168,8 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
break; break;
default: default:
{ {
char lpstrTmp[MAX_PATH] = ""; char lpstrTmp[MAX_PATH];
if(strcmp(&lpstrCurrentDir[strlen(lpstrCurrentDir)-1],"\\")) if(strcmp(&lpstrCurrentDir[strlen(lpstrCurrentDir)-1],"\\"))
strcat(lpstrCurrentDir,"\\"); strcat(lpstrCurrentDir,"\\");
strcpy(lpstrTmp,lpstrCurrentDir); strcpy(lpstrTmp,lpstrCurrentDir);
...@@ -1279,9 +1287,10 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) ...@@ -1279,9 +1287,10 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
{ {
if (strchr(lpBuf, '.')) if (strchr(lpBuf, '.'))
strcat(lpstrFileSpecTemp, (strchr(lpBuf, '.')) + 1); strcat(lpstrFileSpecTemp, (strchr(lpBuf, '.')) + 1);
} else {
if (strchr(lpBuf, '.'))
strcat(lpstrFileSpecTemp, strchr(lpBuf, '.'));
} }
else
strcat(lpstrFileSpecTemp, strchr(lpBuf, '.'));
browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder, browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder,
lpstrFileSpecTemp); lpstrFileSpecTemp);
MemFree((void *)lpBuf); MemFree((void *)lpBuf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment