X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d43803715268f5396741b3f0eb4b94d1408c9f9d..1fb424fa33ab42ecd9b400dc807bc89acaa4ca0a:/src/msw/filedlg.cpp diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index b788f8a7cf..d1bb415709 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); } @@ -494,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; @@ -596,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;