X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fe048d7736f6a50a3b71c6eae8a560f268b2e4f1..23fb33aa4e15110d41b5a16fff438e44e0cb3ea9:/src/msw/filedlg.cpp diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index b42c276494..0cc25b19d6 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -88,10 +88,10 @@ wxFileDialogHookFunction(HWND hDlg, { case WM_NOTIFY: { - OFNOTIFY *pNotifyCode = wx_reinterpret_cast(OFNOTIFY *, lParam); + OFNOTIFY *pNotifyCode = reinterpret_cast(lParam); if ( pNotifyCode->hdr.code == CDN_INITDONE ) { - wx_reinterpret_cast(wxFileDialog *, + reinterpret_cast( pNotifyCode->lpOFN->lCustData) ->MSWOnInitDone((WXHWND)hDlg); } @@ -167,7 +167,7 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const void wxFileDialog::SetPath(const wxString& path) { wxString ext; - wxSplitPath(path, &m_dir, &m_fileName, &ext); + wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext); if ( !ext.empty() ) m_fileName << _T('.') << ext; } @@ -331,7 +331,13 @@ static bool ShowCommFileDialog(OPENFILENAME *of, long style) } #endif // wxTRY_SMALLER_OPENFILENAME - if ( !success && errCode == FNERR_INVALIDFILENAME && of->lpstrFile[0] ) + if ( !success && + // FNERR_INVALIDFILENAME is not defined under CE (besides we don't + // use CommDlgExtendedError() there anyhow) +#ifndef __WXWINCE__ + errCode == FNERR_INVALIDFILENAME && +#endif // !__WXWINCE__ + of->lpstrFile[0] ) { // this can happen if the default file name is invalid, try without it // now @@ -488,8 +494,7 @@ int wxFileDialog::ShowModal() //=== Setting defaultFileName >>========================================= - wxStrncpy(fileNameBuffer, m_fileName, wxMAXPATH-1); - fileNameBuffer[ wxMAXPATH-1 ] = wxT('\0'); + wxStrlcpy(fileNameBuffer, m_fileName.c_str(), WXSIZEOF(fileNameBuffer)); of.lpstrFile = fileNameBuffer; // holds returned filename of.nMaxFile = wxMAXPATH; @@ -590,8 +595,7 @@ int wxFileDialog::ShowModal() extension = extension + wxStrlen( extension ) + 1; m_fileName = AppendExtension(fileNameBuffer, extension); - wxStrncpy(fileNameBuffer, m_fileName.c_str(), wxMin(m_fileName.length(), wxMAXPATH-1)); - fileNameBuffer[wxMin(m_fileName.length(), wxMAXPATH-1)] = wxT('\0'); + wxStrlcpy(fileNameBuffer, m_fileName.c_str(), WXSIZEOF(fileNameBuffer)); } m_path = fileNameBuffer;