From 9837b598bc8cee90aa54146d06ed89c89d0ef88b Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sun, 23 Jan 2000 22:30:22 +0000 Subject: [PATCH] Replaced some weird C constructs (char[]="" ) with more compatible ones. Added another NULL ptr check in _OnOpen. --- dlls/commdlg/filedlg95.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/dlls/commdlg/filedlg95.c b/dlls/commdlg/filedlg95.c index 6719484ac81..ff8745b0650 100644 --- a/dlls/commdlg/filedlg95.c +++ b/dlls/commdlg/filedlg95.c @@ -1085,10 +1085,12 @@ static LRESULT FILEDLG95_InitUI(HWND hwnd) */ BOOL FILEDLG95_OnOpen(HWND hwnd) { - char lpstrSpecifiedByUser[MAX_PATH] = ""; + char lpstrSpecifiedByUser[MAX_PATH]; FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); LPITEMIDLIST pidlSelection; + lpstrSpecifiedByUser[0]='\0'; + TRACE("\n"); /* Check if there is a selected item in the listview */ @@ -1108,9 +1110,13 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) LPITEMIDLIST browsePidl; LPSTR lpstrFileSpec; LPSTR lpstrTemp; - char lpstrPathSpec[MAX_PATH] = ""; - char lpstrCurrentDir[MAX_PATH] = ""; - char lpstrPathAndFile[MAX_PATH] = ""; + char lpstrPathSpec[MAX_PATH]; + char lpstrCurrentDir[MAX_PATH]; + char lpstrPathAndFile[MAX_PATH]; + + lpstrPathSpec[0] = '\0'; + lpstrCurrentDir[0] = '\0'; + lpstrPathAndFile[0] = '\0'; /* Separate the file spec from the path spec e.g.: @@ -1148,8 +1154,9 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) case '.': { INT iSize; - char lpstrTmp2[MAX_PATH] = ""; + char lpstrTmp2[MAX_PATH]; LPSTR lpstrTmp = strrchr(lpstrCurrentDir,'\\'); + iSize = lpstrTmp - lpstrCurrentDir; strncpy(lpstrTmp2,lpstrCurrentDir,iSize + 1); if(strlen(lpstrSpecifiedByUser) <= 3) @@ -1161,7 +1168,8 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) break; default: { - char lpstrTmp[MAX_PATH] = ""; + char lpstrTmp[MAX_PATH]; + if(strcmp(&lpstrCurrentDir[strlen(lpstrCurrentDir)-1],"\\")) strcat(lpstrCurrentDir,"\\"); strcpy(lpstrTmp,lpstrCurrentDir); @@ -1279,9 +1287,10 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) { if (strchr(lpBuf, '.')) strcat(lpstrFileSpecTemp, (strchr(lpBuf, '.')) + 1); + } else { + if (strchr(lpBuf, '.')) + strcat(lpstrFileSpecTemp, strchr(lpBuf, '.')); } - else - strcat(lpstrFileSpecTemp, strchr(lpBuf, '.')); browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder, lpstrFileSpecTemp); MemFree((void *)lpBuf);