Index: scripts/jenkins/run-cppcheck.bat =================================================================== diff -u -r8e11c119f53f909e52216964824262de772e80fe -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- scripts/jenkins/run-cppcheck.bat (.../run-cppcheck.bat) (revision 8e11c119f53f909e52216964824262de772e80fe) +++ scripts/jenkins/run-cppcheck.bat (.../run-cppcheck.bat) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -5,4 +5,4 @@ mkdir "%WORKSPACE%\CPPCheck" -cppcheck --enable=warning,style,performance,portability,information,unusedFunction --library=microsoft_sal.cfg --library=windows.cfg --std=c++11 --xml-version=2 --xml --platform=win32W --force src 2>"%WORKSPACE%\CPPCheck\cppcheck.xml" +cppcheck --enable=warning,style,performance,portability,information,unusedFunction --suppress=cstyleCast --library=microsoft_sal.cfg --library=windows.cfg --std=c++11 --xml-version=2 --xml --platform=win32W --force src 2>"%WORKSPACE%\CPPCheck\cppcheck.xml" Index: src/ch/AppHelper.cpp =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/ch/AppHelper.cpp (.../AppHelper.cpp) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/ch/AppHelper.cpp (.../AppHelper.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -136,86 +136,83 @@ } // expands given path -PTSTR CAppHelper::ExpandPath(PTSTR pszString) +CString CAppHelper::ExpandPath(CString strPath) { // check if there is need to perform all these checkings - if (pszString[0] != _T('<')) - return pszString; + if (strPath[0] != _T('<')) + return strPath; - TCHAR szStr[_MAX_PATH]; - szStr[0]=_T('\0'); + TCHAR szStr[ _MAX_PATH ]; + szStr[ 0 ] = _T('\0'); // search for string to replace // _T(""), _T(""), _T(""), _T(""), _T(""), // _T(""), _T("") - if (_tcsnicmp(pszString, _T(""), 9) == 0) + if (_tcsnicmp(strPath, _T(""), 9) == 0) { // get windows path _tcsncpy(szStr, m_pszProgramPath ? m_pszProgramPath : _t(""), _MAX_PATH); szStr[_MAX_PATH - 1] = _T('\0'); - _tcsncat(szStr, pszString+9, _MAX_PATH - _tcslen(szStr)); + _tcsncat(szStr, strPath.Mid(9), _MAX_PATH - _tcslen(szStr)); szStr[_MAX_PATH - 1] = _T('\0'); } - else if (_tcsnicmp(pszString, _T(""), 9) == 0) + else if (_tcsnicmp(strPath, _T(""), 9) == 0) { // get windows path UINT uiSize=GetWindowsDirectory(szStr, _MAX_PATH); if (szStr[uiSize-1] == _T('\\')) szStr[uiSize-1]=_T('\0'); - _tcsncat(szStr, pszString+9, _MAX_PATH - uiSize); + _tcsncat(szStr, strPath.Mid(9), _MAX_PATH - uiSize); szStr[_MAX_PATH - 1] = _T('\0'); } - else if (_tcsnicmp(pszString, _T(""), 6) == 0) // temp dir + else if (_tcsnicmp(strPath, _T(""), 6) == 0) // temp dir { // get windows path UINT uiSize=GetTempPath(_MAX_PATH, szStr); if (szStr[uiSize-1] == _T('\\')) szStr[uiSize-1]=_T('\0'); - _tcsncat(szStr, pszString+6, _MAX_PATH - uiSize); + _tcsncat(szStr, strPath.Mid(6), _MAX_PATH - uiSize); szStr[_MAX_PATH - 1] = _T('\0'); } - else if (_tcsnicmp(pszString, _T(""), 8) == 0) // system + else if (_tcsnicmp(strPath, _T(""), 8) == 0) // system { // get windows path UINT uiSize=GetSystemDirectory(szStr, _MAX_PATH); if (szStr[uiSize-1] == _T('\\')) szStr[uiSize-1]=_T('\0'); - _tcsncat(szStr, pszString+8, _MAX_PATH - uiSize); + _tcsncat(szStr, strPath.Mid(8), _MAX_PATH - uiSize); szStr[_MAX_PATH - 1] = _T('\0'); } - else if (_tcsnicmp(pszString, _T(""), 9) == 0) // app data + else if (_tcsnicmp(strPath, _T(""), 9) == 0) // app data { // get windows path UINT uiSize=GetFolderLocation(CSIDL_LOCAL_APPDATA, szStr); if (szStr[uiSize-1] == _T('\\')) szStr[uiSize-1]=_T('\0'); - _tcsncat(szStr, pszString+9, _MAX_PATH - uiSize); + _tcsncat(szStr, strPath.Mid(9), _MAX_PATH - uiSize); szStr[_MAX_PATH - 1] = _T('\0'); } - else if (_tcsnicmp(pszString, _T(""), 9) == 0) // desktop + else if (_tcsnicmp(strPath, _T(""), 9) == 0) // desktop { // get windows path UINT uiSize=GetFolderLocation(CSIDL_DESKTOPDIRECTORY, szStr); if (szStr[uiSize-1] == _T('\\')) szStr[uiSize-1]=_T('\0'); - _tcsncat(szStr, pszString+9, _MAX_PATH - uiSize); + _tcsncat(szStr, strPath.Mid(9), _MAX_PATH - uiSize); szStr[_MAX_PATH - 1] = _T('\0'); } - else if (_tcsnicmp(pszString, _T(""), 10) == 0) // personal... + else if (_tcsnicmp(strPath, _T(""), 10) == 0) // personal... { // get windows path UINT uiSize=GetFolderLocation(CSIDL_PERSONAL, szStr); if (szStr[uiSize-1] == _T('\\')) szStr[uiSize-1]=_T('\0'); - _tcsncat(szStr, pszString+10, _MAX_PATH - uiSize); + _tcsncat(szStr, strPath.Mid(10), _MAX_PATH - uiSize); szStr[_MAX_PATH - 1] = _T('\0'); } // copy to src string - if (szStr[0] != _T('\0')) - _tcscpy(pszString, szStr); - - return pszString; + return szStr; } bool CAppHelper::GetProgramDataPath(CString& rStrPath) Index: src/ch/AppHelper.h =================================================================== diff -u -rf2eab440135dd8052881aa3e9af83ec85e9bf1bf -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/ch/AppHelper.h (.../AppHelper.h) (revision f2eab440135dd8052881aa3e9af83ec85e9bf1bf) +++ src/ch/AppHelper.h (.../AppHelper.h) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -28,7 +28,7 @@ virtual ~CAppHelper(); bool SetAutorun(bool bState); // changes state of "run with system" option - PTSTR ExpandPath(PTSTR pszString); // expands path string - ie. into c:\windows + CString ExpandPath(CString strPath); // expands path string - ie. into c:\windows bool IsFirstInstance() const { return m_bFirstInstance; }; Index: src/ch/AsyncHttpFile.cpp =================================================================== diff -u -r1f27a2022090cf7aaf827a3f1ad90d6fe0038518 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/ch/AsyncHttpFile.cpp (.../AsyncHttpFile.cpp) (revision 1f27a2022090cf7aaf827a3f1ad90d6fe0038518) +++ src/ch/AsyncHttpFile.cpp (.../AsyncHttpFile.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -349,8 +349,8 @@ return; CString strMsg; - strMsg.Format(_T("[CAsyncHttpFile::InternetStatusCallback] hInternet: %p, dwContext: %lu (operation: %lu), dwInternetStatus: %lu, lpvStatusInformation: %p, dwStatusInformationLength: %lu\n"), - hInternet, dwContext, pRequest ? pRequest->eOperationType : CONTEXT_REQUEST::eNone, dwInternetStatus, lpvStatusInformation, dwStatusInformationLength); + strMsg.Format(_T("[CAsyncHttpFile::InternetStatusCallback] hInternet: %p, dwContext: %Iu (operation: %lu), dwInternetStatus: %lu, lpvStatusInformation: %p, dwStatusInformationLength: %lu\n"), + hInternet, (size_t)dwContext, pRequest ? pRequest->eOperationType : CONTEXT_REQUEST::eNone, dwInternetStatus, lpvStatusInformation, dwStatusInformationLength); LOG_DEBUG(strMsg); switch(dwInternetStatus) Index: src/ch/BufferSizeDlg.cpp =================================================================== diff -u -rcdc76e1a95383dff63a5254aeb8d37035028512c -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/ch/BufferSizeDlg.cpp (.../BufferSizeDlg.cpp) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) +++ src/ch/BufferSizeDlg.cpp (.../BufferSizeDlg.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -32,12 +32,6 @@ CBufferSizeDlg::CBufferSizeDlg(chcore::TBufferSizes* pInitialBufferSizes, chcore::TBufferSizes::EBufferType eSelectedBuffer) : ictranslate::CLanguageDialog(IDD_BUFFERSIZE_DIALOG), - m_uiDefaultSize(0), - m_uiLANSize(0), - m_uiCDROMSize(0), - m_uiOneDiskSize(0), - m_uiTwoDisksSize(0), - m_bOnlyDefaultCheck(FALSE), m_eSelectedBuffer(eSelectedBuffer) { if (pInitialBufferSizes) Index: src/ch/BufferSizeDlg.h =================================================================== diff -u -rcdc76e1a95383dff63a5254aeb8d37035028512c -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/ch/BufferSizeDlg.h (.../BufferSizeDlg.h) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) +++ src/ch/BufferSizeDlg.h (.../BufferSizeDlg.h) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -57,13 +57,13 @@ CComboBox m_ctlCDROMMulti; CSpinButtonCtrl m_ctlBufferCountSpin; - UINT m_uiDefaultSize; - UINT m_uiLANSize; - UINT m_uiCDROMSize; - UINT m_uiOneDiskSize; - UINT m_uiTwoDisksSize; - UINT m_uiBufferCount; - BOOL m_bOnlyDefaultCheck; + UINT m_uiDefaultSize = 0; + UINT m_uiLANSize = 0; + UINT m_uiCDROMSize = 0; + UINT m_uiOneDiskSize = 0; + UINT m_uiTwoDisksSize = 0; + UINT m_uiBufferCount = 0; + BOOL m_bOnlyDefaultCheck = TRUE; chcore::TBufferSizes::EBufferType m_eSelectedBuffer; chcore::TBufferSizes m_bsSizes; Index: src/ch/FeedbackHandler.cpp =================================================================== diff -u -r8592d6dcef30c8e4967ca4dcee37c1ca52afbf16 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/ch/FeedbackHandler.cpp (.../FeedbackHandler.cpp) (revision 8592d6dcef30c8e4967ca4dcee37c1ca52afbf16) +++ src/ch/FeedbackHandler.cpp (.../FeedbackHandler.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -86,10 +86,7 @@ if (GetPropValue(GetConfig())) { CString strPath = GetPropValue(GetConfig()); - GetApp().ExpandPath(strPath.GetBufferSetLength(_MAX_PATH)); - strPath.ReleaseBuffer(); - - PlaySound(strPath, NULL, SND_FILENAME | SND_ASYNC); + PlaySound(GetApp().ExpandPath(strPath), NULL, SND_FILENAME | SND_ASYNC); } return TFeedbackResult(eResult_Unknown, true); @@ -100,10 +97,7 @@ if (GetPropValue(GetConfig())) { CString strPath = GetPropValue(GetConfig()); - GetApp().ExpandPath(strPath.GetBufferSetLength(_MAX_PATH)); - strPath.ReleaseBuffer(); - - PlaySound(strPath, NULL, SND_FILENAME | SND_ASYNC); + PlaySound(GetApp().ExpandPath(strPath), NULL, SND_FILENAME | SND_ASYNC); } return TFeedbackResult(eResult_Unknown, true); Index: src/ch/FolderDialog.cpp =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/ch/FolderDialog.cpp (.../FolderDialog.cpp) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/ch/FolderDialog.cpp (.../FolderDialog.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -150,8 +150,6 @@ CFolderDialog::CFolderDialog(CWnd* /*pParent*/ /*=NULL*/) :ictranslate::CLanguageDialog() { - //{{AFX_DATA_INIT(CFolderDialog) - //}}AFX_DATA_INIT m_hImages=NULL; m_hLargeImages=NULL; m_bIgnoreUpdate=false; @@ -625,12 +623,14 @@ || shdi.dwDescriptionId == SHDID_COMPUTER_DRIVE525 ) ) bSkipFreeSpace=true; + const size_t BufferSize = 2048; + std::unique_ptr upBuffer(new wchar_t[ BufferSize ]); // some about network bool bNet; CString strData; - NETRESOURCE* pnet=(NETRESOURCE*)m_szBuffer; - if ( (bNet=m_ctlTree.GetItemShellData(pit->hItem, SHGDFIL_NETRESOURCE, pnet, 2048)) == true) + NETRESOURCE* pnet=(NETRESOURCE*)upBuffer.get(); + if ( (bNet=m_ctlTree.GetItemShellData(pit->hItem, SHGDFIL_NETRESOURCE, pnet, BufferSize)) == true) { if (pnet->lpRemoteName && _tcscmp(pnet->lpRemoteName, _T("")) != 0) m_strTip+=GetResManager().LoadString(IDS_BDREMOTENAME_STRING)+CString(pnet->lpRemoteName)+_T("\n"); @@ -699,8 +699,8 @@ ull_t ullFree, ullTotal; if (GetDynamicFreeSpace(sc.m_strPath, &ullFree, &ullTotal)) { - m_strTip+=CString(_T("\r\n"))+GetResManager().LoadString(IDS_BDFREESPACE_STRING)+CString(GetSizeString(ullFree, m_szBuffer, 2048, false))+_T("\n"); - m_strTip+=GetResManager().LoadString(IDS_BDCAPACITY_STRING)+CString(GetSizeString(ullTotal, m_szBuffer, 2048, false)); + m_strTip+=CString(_T("\r\n"))+GetResManager().LoadString(IDS_BDFREESPACE_STRING) + GetSizeString(ullFree, false) + _T("\n"); + m_strTip+=GetResManager().LoadString(IDS_BDCAPACITY_STRING) + GetSizeString(ullTotal, false); } pit->pszText=(LPTSTR)(LPCTSTR)m_strTip; @@ -730,11 +730,14 @@ if (m_bIgnoreTreeRefresh) return; + const size_t BufferSize = 32768; + std::unique_ptr upBuffer(new wchar_t[ BufferSize ]); + COMBOBOXEXITEM cbi; - cbi.mask=CBEIF_TEXT; - cbi.iItem=-1; - cbi.pszText=m_szBuffer; - cbi.cchTextMax=_MAX_PATH; + cbi.mask = CBEIF_TEXT; + cbi.iItem = -1; + cbi.pszText = upBuffer.get(); + cbi.cchTextMax = BufferSize; if (!m_ctlPath.GetItem(&cbi)) return; @@ -763,27 +766,29 @@ COMBOBOXEXITEM cbi; - cbi.mask=CBEIF_TEXT | CBEIF_IMAGE; - cbi.iItem=-1; - _tcscpy(m_szBuffer, lpszPath); - cbi.pszText=m_szBuffer; - SHGetFileInfo(cbi.pszText, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), SHGFI_SMALLICON | SHGFI_SYSICONINDEX); - cbi.iImage=sfi.iIcon; - m_bIgnoreTreeRefresh=true; + cbi.mask = CBEIF_TEXT | CBEIF_IMAGE; + cbi.iItem = -1; + cbi.pszText = (LPTSTR)lpszPath; + SHGetFileInfo(lpszPath, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), SHGFI_SMALLICON | SHGFI_SYSICONINDEX); + cbi.iImage = sfi.iIcon; + m_bIgnoreTreeRefresh = true; m_ctlPath.SetItem(&cbi); - m_bIgnoreTreeRefresh=false; + m_bIgnoreTreeRefresh = false; } ////////////////////////////////////////////////////////////////////////// // updates icon in comboex void CFolderDialog::UpdateComboIcon() { + const size_t BufferSize = 32768; + std::unique_ptr upBuffer(new wchar_t[ BufferSize ]); + // get text from combo COMBOBOXEXITEM cbi; - cbi.mask=CBEIF_TEXT; - cbi.iItem=m_ctlPath.GetCurSel()/*-1*/; - cbi.pszText=m_szBuffer; - cbi.cchTextMax=_MAX_PATH; + cbi.mask = CBEIF_TEXT; + cbi.iItem = m_ctlPath.GetCurSel()/*-1*/; + cbi.pszText = upBuffer.get(); + cbi.cchTextMax = BufferSize; if (!m_ctlPath.GetItem(&cbi)) return; @@ -800,9 +805,9 @@ cbi.mask |= CBEIF_IMAGE; cbi.iItem=-1; - CString str=(LPCTSTR)m_szBuffer; - if (str.Left(2) != _T("\\\\") || str.Find(_T('\\'), 2) != -1) - SHGetFileInfo(cbi.pszText, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), SHGFI_SMALLICON | SHGFI_SYSICONINDEX); + CString str = cbi.pszText; + if(str.Left(2) != _T("\\\\") || str.Find(_T('\\'), 2) != -1) + SHGetFileInfo(str, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(sfi), SHGFI_SMALLICON | SHGFI_SYSICONINDEX); cbi.iImage=sfi.iIcon; @@ -839,12 +844,15 @@ // adding shortcut void CFolderDialog::OnAddShortcut() { + const size_t BufferSize = 32768; + std::unique_ptr upBuffer(new wchar_t[ BufferSize ]); + // get current text COMBOBOXEXITEM cbi; - cbi.mask=CBEIF_TEXT; - cbi.iItem=m_ctlPath.GetCurSel()/*-1*/; - cbi.pszText=m_szBuffer; - cbi.cchTextMax=_MAX_PATH; + cbi.mask = CBEIF_TEXT; + cbi.iItem = m_ctlPath.GetCurSel()/*-1*/; + cbi.pszText = upBuffer.get(); + cbi.cchTextMax = _MAX_PATH; if (!m_ctlPath.GetItem(&cbi)) { Index: src/ch/FolderDialog.h =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/ch/FolderDialog.h (.../FolderDialog.h) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/ch/FolderDialog.h (.../FolderDialog.h) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -47,18 +47,11 @@ explicit CFolderDialog(CWnd* pParent = NULL); // standard constructor virtual ~CFolderDialog(); -// Dialog Data - //{{AFX_DATA(CFolderDialog) - //}}AFX_DATA - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CFolderDialog) - public: +public: virtual INT_PTR DoModal(); - protected: + +protected: virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); - //}}AFX_VIRTUAL public: virtual BOOL OnTooltipText(UINT uiID, TOOLTIPTEXT* pTip); @@ -72,7 +65,8 @@ std::vector cvRecent; std::vector cvShortcuts; - int cx = 0, cy = 0; // pixels + int cx = 0; + int cy = 0; // pixels int iView = 2; // type of view (large icons, small icons, ...) bool bExtended = false; // with the shortcuts or not bool bIgnoreDialogs = true; // if tree ctrl should show shell dialogs in style 'insert floppy' @@ -96,7 +90,6 @@ void ResizeControls(int cx, int cy); CString m_strTip; // for tooltip storage - TCHAR m_szBuffer[2048]; // shell functions buffer CString m_strPath; // for path after dialog exits bool m_bIgnoreUpdate; // ignores nearest edit update (with path) Index: src/ch/OptionsDlg.cpp =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/ch/OptionsDlg.cpp (.../OptionsDlg.cpp) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/ch/OptionsDlg.cpp (.../OptionsDlg.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -48,7 +48,7 @@ DDX_Control(pDX, IDC_PROPERTIES_LIST, m_ctlProperties); } -BEGIN_MESSAGE_MAP(COptionsDlg,ictranslate::CLanguageDialog) +BEGIN_MESSAGE_MAP(COptionsDlg, ictranslate::CLanguageDialog) ON_BN_CLICKED(IDC_APPLY_BUTTON, OnApplyButton) END_MESSAGE_MAP() @@ -63,7 +63,13 @@ m_ctlProperties.AddString(text, ID_PROPERTY_COMBO_LIST, IDS_BOOLTEXT_STRING, (value)) #define PROP_UINT(text, value)\ - m_ctlProperties.AddString(text, ID_PROPERTY_TEXT, _itot(boost::numeric_cast((value)), m_szBuffer, 10), 0) + do\ + {\ + const size_t stBufferSize = 16;\ + wchar_t szBuffer[stBufferSize];\ + m_ctlProperties.AddString(text, ID_PROPERTY_TEXT, _itot(boost::numeric_cast((value)), szBuffer, stBufferSize), 0);\ + }\ + while(false) #define PROP_COMBO(text, prop_text, value)\ m_ctlProperties.AddString(text, ID_PROPERTY_COMBO_LIST, prop_text, boost::numeric_cast((value))) @@ -75,7 +81,13 @@ m_ctlProperties.AddString(text, ID_PROPERTY_PATH, (value)+CString(GetResManager().LoadString(prop_text)), 0) #define PROP_CUSTOM_UINT(text, value, callback, param)\ - m_ctlProperties.AddString(text, ID_PROPERTY_CUSTOM, CString(_itot(boost::numeric_cast((value)), m_szBuffer, 10)), callback, this, param, 0) + do\ + {\ + const size_t stBufferSize = 16;\ + wchar_t szBuffer[stBufferSize];\ + m_ctlProperties.AddString(text, ID_PROPERTY_CUSTOM, CString(_itot(boost::numeric_cast((value)), szBuffer, stBufferSize)), callback, this, param, 0);\ + }\ + while(false) #define SKIP_SEPARATOR(pos)\ pos++ @@ -103,11 +115,8 @@ m_cvShortcuts.clear(); GetPropValue(rConfig, m_cvShortcuts); - _tcscpy(m_szLangPath, _T("\\Langs\\")); - GetApp().ExpandPath(m_szLangPath); + GetResManager().Scan(GetApp().ExpandPath(_T("\\Langs\\")), &m_vld); - GetResManager().Scan(m_szLangPath, &m_vld); - // some attributes m_ctlProperties.SetBkColor(RGB(255, 255, 255)); m_ctlProperties.SetTextColor(RGB(80, 80, 80)); @@ -451,38 +460,43 @@ assert(lpszSeparator); if(!lpszSeparator) return _T(""); - _tcscpy(m_szBuffer, GetResManager().LoadString(uiBase+0)); - for (int i=1;i m_cvRecent; - std::vector m_cvShortcuts; - - // for languages - vector m_vld; - TCHAR m_szLangPath[ _MAX_PATH ]; // the full path to a folder with langs (@read) - - CPropertyListCtrl m_ctlProperties; - protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support @@ -76,12 +64,15 @@ DECLARE_MESSAGE_MAP() private: - TCHAR m_szBuffer[ _MAX_PATH ]; // for macro use - CString m_strTemp; - int m_iSel = 0; -}; + static bool m_bLock; // locker -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + std::vector m_cvRecent; + std::vector m_cvShortcuts; + // for languages + vector m_vld; + + CPropertyListCtrl m_ctlProperties; +}; + #endif Index: src/ch/ShutdownDlg.cpp =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/ch/ShutdownDlg.cpp (.../ShutdownDlg.cpp) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/ch/ShutdownDlg.cpp (.../ShutdownDlg.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -90,7 +90,7 @@ void CShutdownDlg::FormatTimeString(int iTime, CString *pstrData) { - pstrData->Format(_T("%lu s."), iTime/1000); + pstrData->Format(_T("%d s."), iTime/1000); } void CShutdownDlg::SetOverallTime(int iTotalSeconds) Index: src/ch/StatusDlg.cpp =================================================================== diff -u -rcadc78491ac98e5f21d395aa25578cdd740ce819 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision cadc78491ac98e5f21d395aa25578cdd740ce819) +++ src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -601,18 +601,10 @@ } } -LPTSTR CStatusDlg::FormatTime(unsigned long long timeSeconds, LPTSTR lpszBuffer, size_t stMaxBufferSize) +CString CStatusDlg::FormatTime(unsigned long long timeSeconds) { if(timeSeconds > 30*24*3600) // more than 30 days - { - // we need those pragmas to disable lv4 warning "warning C4428: universal-character-name encountered in source" - // which incorrectly warns about the infinity char embedded in a string. -#pragma warning(push) -#pragma warning(disable: 4428) - _tcscpy_s(lpszBuffer, stMaxBufferSize, L"\u221E"); -#pragma warning(pop) - return lpszBuffer; - } + return L"\u221E"; // infinity character long lDays = boost::numeric_cast(timeSeconds/86400); timeSeconds %= 86400; @@ -621,23 +613,24 @@ long lMinutes = boost::numeric_cast(timeSeconds/60); timeSeconds %= 60; + CString strResult; if(lDays != 0) - _sntprintf(lpszBuffer, stMaxBufferSize, _T("%02ld:%02ld:%02ld:%02I64u"), lDays, lHours, lMinutes, timeSeconds); + strResult.Format(_T("%02ld:%02ld:%02ld:%02I64u"), lDays, lHours, lMinutes, timeSeconds); else { if (lHours != 0) - _sntprintf(lpszBuffer, stMaxBufferSize, _T("%02ld:%02ld:%02I64u"), lHours, lMinutes, timeSeconds); + strResult.Format(_T("%02ld:%02ld:%02I64u"), lHours, lMinutes, timeSeconds); else - _sntprintf(lpszBuffer, stMaxBufferSize, _T("%02ld:%02I64u"), lMinutes, timeSeconds); + strResult.Format(_T("%02ld:%02I64u"), lMinutes, timeSeconds); } - return lpszBuffer; + return strResult; } -LPTSTR CStatusDlg::FormatTimeMiliseconds(unsigned long long timeMiliSeconds, LPTSTR lpszBuffer, size_t stMaxBufferSize) +CString CStatusDlg::FormatTimeMiliseconds(unsigned long long timeMiliSeconds) { unsigned long long timeSeconds = timeMiliSeconds / 1000; - return FormatTime(timeSeconds, lpszBuffer, stMaxBufferSize); + return FormatTime(timeSeconds); } void CStatusDlg::RefreshStatus() @@ -672,8 +665,8 @@ // progress - count of processed data/count of data CString strTemp; - strTemp=GetSizeString(m_spTaskMgrStats->GetProcessedSize(), m_szData, _MAX_PATH)+CString(_T("/")); - strTemp+=GetSizeString(m_spTaskMgrStats->GetTotalSize(), m_szData, _MAX_PATH); + strTemp = GetSizeString(m_spTaskMgrStats->GetProcessedSize()) + CString(_T("/")); + strTemp += GetSizeString(m_spTaskMgrStats->GetTotalSize()); GetDlgItem(IDC_GLOBALPROCESSED_STATIC)->SetWindowText(strTemp); // transfer @@ -736,32 +729,31 @@ void CStatusDlg::SetBufferSizesString(unsigned long long ullValue, int iIndex) { - TCHAR szData[1024]; + CString strResult; switch(iIndex) { case chcore::TBufferSizes::eBuffer_Default: - GetResManager().LoadStringCopy(IDS_BSDEFAULT_STRING, szData, 256); + strResult = GetResManager().LoadString(IDS_BSDEFAULT_STRING); break; case chcore::TBufferSizes::eBuffer_OneDisk: - GetResManager().LoadStringCopy(IDS_BSONEDISK_STRING, szData, 256); + strResult = GetResManager().LoadString(IDS_BSONEDISK_STRING); break; case chcore::TBufferSizes::eBuffer_TwoDisks: - GetResManager().LoadStringCopy(IDS_BSTWODISKS_STRING, szData, 256); + strResult = GetResManager().LoadString(IDS_BSTWODISKS_STRING); break; case chcore::TBufferSizes::eBuffer_CD: - GetResManager().LoadStringCopy(IDS_BSCD_STRING, szData, 256); + strResult = GetResManager().LoadString(IDS_BSCD_STRING); break; case chcore::TBufferSizes::eBuffer_LAN: - GetResManager().LoadStringCopy(IDS_BSLAN_STRING, szData, 256); + strResult = GetResManager().LoadString(IDS_BSLAN_STRING); break; default: _ASSERTE(false); - szData[0] = _T('\0'); } - _tcscat(szData, GetSizeString(ullValue, m_szData, _MAX_PATH)); + strResult += GetSizeString(ullValue); - GetDlgItem(IDC_BUFFERSIZE_STATIC)->SetWindowText(szData); + GetDlgItem(IDC_BUFFERSIZE_STATIC)->SetWindowText(strResult); } void CStatusDlg::PostCloseMessage() @@ -1086,12 +1078,13 @@ CString CStatusDlg::GetProcessedText(unsigned long long ullProcessedCount, unsigned long long ullTotalCount, unsigned long long ullProcessedSize, unsigned long long ullTotalSize) { - CString strTemp; - _sntprintf(m_szData, _MAX_PATH, _T("%I64u/%I64u ("), ullProcessedCount, ullTotalCount); - strTemp = CString(m_szData); - strTemp += GetSizeString(ullProcessedSize, m_szData, _MAX_PATH) + CString(_T("/")); - strTemp += GetSizeString(ullTotalSize, m_szData, _MAX_PATH) + CString(_T(")")); - return strTemp; + CString strProcessedText; + strProcessedText.Format(_T("%I64u/%I64u ("), ullProcessedCount, ullTotalCount); + + strProcessedText += GetSizeString(ullProcessedSize) + _T("/"); + strProcessedText += GetSizeString(ullTotalSize) + _T(")"); + + return strProcessedText; } CString CStatusDlg::GetSpeedString(double dSizeSpeed, double dAvgSizeSpeed, double dCountSpeed, double dAvgCountSpeed) const @@ -1133,12 +1126,13 @@ timeElapsed = spSubTaskStats->GetTimeElapsed(); timeRemaining = timeTotalEstimated - timeElapsed; - FormatTimeMiliseconds(timeElapsed, m_szTimeBuffer1, 40); - FormatTimeMiliseconds(timeTotalEstimated, m_szTimeBuffer2, 40); - FormatTimeMiliseconds(timeRemaining, m_szTimeBuffer3, 40); + CString strTime1 = FormatTimeMiliseconds(timeElapsed); + CString strTime2 = FormatTimeMiliseconds(timeTotalEstimated); + CString strTime3 = FormatTimeMiliseconds(timeRemaining); - _sntprintf(m_szData, _MAX_PATH, _T("%s / %s (%s)"), m_szTimeBuffer1, m_szTimeBuffer2, m_szTimeBuffer3); - GetDlgItem(IDC_SUBTASKTIME_STATIC)->SetWindowText(m_szData); + CString strTime; + strTime.Format(_T("%s / %s (%s)"), (PCTSTR)strTime1, (PCTSTR)strTime2, (PCTSTR)strTime3); + GetDlgItem(IDC_SUBTASKTIME_STATIC)->SetWindowText(strTime); // speed information CString strSpeed = GetSpeedString(spSubTaskStats->GetSizeSpeed(), spSubTaskStats->GetAvgSizeSpeed(), spSubTaskStats->GetCountSpeed(), spSubTaskStats->GetAvgCountSpeed()); @@ -1191,12 +1185,13 @@ timeElapsed = spTaskStats->GetTimeElapsed(); timeRemaining = timeTotalEstimated - timeElapsed; - FormatTimeMiliseconds(timeElapsed, m_szTimeBuffer1, 40); - FormatTimeMiliseconds(timeTotalEstimated, m_szTimeBuffer2, 40); - FormatTimeMiliseconds(timeRemaining, m_szTimeBuffer3, 40); + CString strTime1 = FormatTimeMiliseconds(timeElapsed); + CString strTime2 = FormatTimeMiliseconds(timeTotalEstimated); + CString strTime3 = FormatTimeMiliseconds(timeRemaining); - _sntprintf(m_szData, _MAX_PATH, _T("%s / %s (%s)"), m_szTimeBuffer1, m_szTimeBuffer2, m_szTimeBuffer3); - GetDlgItem(IDC_TASKTIME_STATIC)->SetWindowText(m_szData); + CString strTime; + strTime.Format(_T("%s / %s (%s)"), strTime1, strTime2, strTime3); + GetDlgItem(IDC_TASKTIME_STATIC)->SetWindowText(strTime); // set progress m_ctlTaskCountProgress.SetProgress(spTaskStats->GetProcessedCount(), spTaskStats->GetTotalCount()); Index: src/ch/StatusDlg.h =================================================================== diff -u -r8592d6dcef30c8e4967ca4dcee37c1ca52afbf16 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/ch/StatusDlg.h (.../StatusDlg.h) (revision 8592d6dcef30c8e4967ca4dcee37c1ca52afbf16) +++ src/ch/StatusDlg.h (.../StatusDlg.h) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -67,8 +67,8 @@ void StickDialogToScreenEdge(); - LPTSTR FormatTime(unsigned long long timeSeconds, LPTSTR lpszBuffer, size_t stMaxBufferSize); - LPTSTR FormatTimeMiliseconds(unsigned long long timeMiliSeconds, LPTSTR lpszBuffer, size_t stMaxBufferSize); + CString FormatTime(unsigned long long timeSeconds); + CString FormatTimeMiliseconds(unsigned long long timeMiliSeconds); CString GetProcessedText(unsigned long long ullProcessedCount, unsigned long long ullTotalCount, unsigned long long ullProcessedSize, unsigned long long ullTotalSize); void UpdateTaskStatsDetails(const chcore::TTaskStatsSnapshotPtr& spTaskStats); @@ -110,15 +110,9 @@ protected: chcore::TTaskManager* m_pTasks; - TCHAR m_szData[_MAX_PATH]; - TCHAR m_szTimeBuffer1[40]; - TCHAR m_szTimeBuffer2[40]; - TCHAR m_szTimeBuffer3[40]; - CImageList m_images; CFFListCtrl m_ctlStatusList; -private: TProgressCtrlEx m_ctlTaskCountProgress; TProgressCtrlEx m_ctlTaskSizeProgress; TProgressCtrlEx m_ctlCurrentObjectProgress; Index: src/ch/StringHelpers.cpp =================================================================== diff -u -r387751793d274e49253e796ca7cec4f3d0cf07a9 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/ch/StringHelpers.cpp (.../StringHelpers.cpp) (revision 387751793d274e49253e796ca7cec4f3d0cf07a9) +++ src/ch/StringHelpers.cpp (.../StringHelpers.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -58,3 +58,39 @@ return pszBuffer; } + +CString GetSizeString(double dData) +{ + if(dData < 0.0) + dData = 0.0; + + CString strResult; + if(dData < 1200.0) + strResult.Format(_T("%.2f %s"), dData, GetResManager().LoadString(IDS_BYTE_STRING)); + else if(dData < 1228800.0) + strResult.Format(_T("%.2f %s"), static_cast(dData) / 1024.0, GetResManager().LoadString(IDS_KBYTE_STRING)); + else if(dData < 1258291200.0) + strResult.Format(_T("%.2f %s"), static_cast(dData) / 1048576.0, GetResManager().LoadString(IDS_MBYTE_STRING)); + else + strResult.Format(_T("%.2f %s"), static_cast(dData) / 1073741824.0, GetResManager().LoadString(IDS_GBYTE_STRING)); + + return strResult; +} + +CString GetSizeString(ull_t ullData, bool bStrict) +{ + if(ullData < 0) + ullData = 0; + + CString strResult; + if(ullData >= 1258291200 && (!bStrict || (ullData % 1073741824) == 0)) + strResult.Format(_T("%.2f %s"), (double)(ullData / 1073741824.0), GetResManager().LoadString(IDS_GBYTE_STRING)); + else if(ullData >= 1228800 && (!bStrict || (ullData % 1048576) == 0)) + strResult.Format(_T("%.2f %s"), (double)(ullData / 1048576.0), GetResManager().LoadString(IDS_MBYTE_STRING)); + else if(ullData >= 1200 && (!bStrict || (ullData % 1024) == 0)) + strResult.Format(_T("%.2f %s"), (double)(ullData / 1024.0), GetResManager().LoadString(IDS_KBYTE_STRING)); + else + strResult.Format(_T("%I64u %s"), ullData, GetResManager().LoadString(IDS_BYTE_STRING)); + + return strResult; +} Index: src/ch/StringHelpers.h =================================================================== diff -u -r387751793d274e49253e796ca7cec4f3d0cf07a9 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/ch/StringHelpers.h (.../StringHelpers.h) (revision 387751793d274e49253e796ca7cec4f3d0cf07a9) +++ src/ch/StringHelpers.h (.../StringHelpers.h) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -22,4 +22,7 @@ LPCTSTR GetSizeString(double dData, LPTSTR pszBuffer, size_t stMaxBufferSize); LPCTSTR GetSizeString(ull_t ullData, LPTSTR pszBuffer, size_t stMaxBufferSize, bool bStrict = false); +CString GetSizeString(double dData); +CString GetSizeString(ull_t ullData, bool bStrict = false); + #endif Index: src/ch/ch.cpp =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/ch/ch.cpp (.../ch.cpp) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/ch/ch.cpp (.../ch.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -138,14 +138,12 @@ bool bChanged=false; // flag that'll be returned - if the paths has changed // generate the current filename - uses language from config - TCHAR szBuffer[_MAX_PATH]; - _tcscpy(szBuffer, _T("\\Help\\")); - ExpandPath(szBuffer); - _tcscat(szBuffer, GetResManager().m_ld.GetHelpName()); - if(_tcscmp(szBuffer, m_pszHelpFilePath) != 0) + CString strHelpPath = ExpandPath(_T("\\Help\\")); + strHelpPath += GetResManager().m_ld.GetHelpName(); + if(strHelpPath != m_pszHelpFilePath) { free((void*)m_pszHelpFilePath); - m_pszHelpFilePath = _tcsdup(szBuffer); + m_pszHelpFilePath = _tcsdup(strHelpPath); bChanged=true; } @@ -349,7 +347,7 @@ rResManager.SetCallback(ResManCallback); GetPropValue(rCfg, strPath); TRACE(_T("Help path=%s\n"), strPath); - if(!rResManager.SetLanguage(ExpandPath(strPath.GetBufferSetLength(_MAX_PATH)))) + if(!rResManager.SetLanguage(ExpandPath(strPath))) { TCHAR szData[2048]; _sntprintf(szData, 2048, _T("Couldn't find the language file specified in configuration file:\n%s\nPlease correct this path to point the language file to use.\nProgram will now exit."), (PCTSTR)strPath); @@ -531,7 +529,7 @@ else if(hResult == S_FALSE) { CString strMsg; - strMsg.Format(_T("Shell extension has different version (0x%lx) than Copy Handler (0x%lx)."), lExtensionVersion, PRODUCT_VERSION1 << 24 | PRODUCT_VERSION2 << 16 | PRODUCT_VERSION3 << 8 | PRODUCT_VERSION4); + strMsg.Format(_T("Shell extension has different version (0x%lx) than Copy Handler (0x%lx)."), (unsigned long)lExtensionVersion, (unsigned long)(PRODUCT_VERSION1 << 24 | PRODUCT_VERSION2 << 16 | PRODUCT_VERSION3 << 8 | PRODUCT_VERSION4)); LOG_WARNING(strMsg); switch(iDoNotShowAgain_VersionMismatch) @@ -594,7 +592,7 @@ { // registered ok, but incompatible versions - probably restart required CString strMsg; - strMsg.Format(_T("Registration succeeded, but still the shell extension has different version (0x%lx) than Copy Handler (0x%lx)."), lExtensionVersion, PRODUCT_VERSION1 << 24 | PRODUCT_VERSION2 << 16 | PRODUCT_VERSION3 << 8 | PRODUCT_VERSION4); + strMsg.Format(_T("Registration succeeded, but still the shell extension has different version (0x%lx) than Copy Handler (0x%lx)."), (unsigned long)lExtensionVersion, (unsigned long)(PRODUCT_VERSION1 << 24 | PRODUCT_VERSION2 << 16 | PRODUCT_VERSION3 << 8 | PRODUCT_VERSION4)); LOG_WARNING(strMsg); MsgBox(IDS_SHELL_EXTENSION_REGISTERED_MISMATCH_STRING, MB_ICONWARNING | MB_OK); @@ -640,8 +638,7 @@ // update language in resource manager CString strPath; GetPropValue(GetConfig(), strPath); - GetResManager().SetLanguage(ExpandPath(strPath.GetBufferSetLength(_MAX_PATH))); - strPath.ReleaseBuffer(); + GetResManager().SetLanguage(ExpandPath(strPath)); } if(setPropNames.HasValue(PropData::GetPropertyName())) Index: src/chext/TContextMenuHandler.cpp =================================================================== diff -u -r488f785a5369dfe98e89d21915b82766b101a5c2 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/chext/TContextMenuHandler.cpp (.../TContextMenuHandler.cpp) (revision 488f785a5369dfe98e89d21915b82766b101a5c2) +++ src/chext/TContextMenuHandler.cpp (.../TContextMenuHandler.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -28,6 +28,7 @@ TContextMenuHandler::TContextMenuHandler() : m_uiNextMenuID(0), + m_uiFirstMenuID(0), m_bEnableOwnerDrawnPaths(false) { } Index: src/libchcore/ConfigNodeContainer.cpp =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/libchcore/ConfigNodeContainer.cpp (.../ConfigNodeContainer.cpp) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/libchcore/ConfigNodeContainer.cpp (.../ConfigNodeContainer.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -588,7 +588,7 @@ int iValueModified2 = iter->m_setModifications[ConfigNode::eMod_Value]; bool bAdded = iter->m_setModifications[ConfigNode::eMod_Added]; - _sntprintf_s(szBuffer, stBufferSize, _TRUNCATE, _T("Node (oid %I64u): %s(%ld/%ld).%ld(%ld/%ld) = %s(%ld/%ld)%s\n"), ullID, + _sntprintf_s(szBuffer, stBufferSize, _TRUNCATE, _T("Node (oid %I64u): %s(%d/%d).%d(%d/%d) = %s(%d/%d)%s\n"), ullID, iter->m_strNodeName.Get().c_str(), iNodeNameModified, iNodeNameModified2, iter->m_iOrder.Get(), iOrderModified, iOrderModified2, iter->m_strValue.Get().c_str(), iValueModified, iValueModified2, Index: src/libictranslate/LanguageDialog.h =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/libictranslate/LanguageDialog.h (.../LanguageDialog.h) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/libictranslate/LanguageDialog.h (.../LanguageDialog.h) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -179,6 +179,9 @@ explicit CLanguageDialog(bool* pLock=NULL); CLanguageDialog(PCTSTR lpszTemplateName, CWnd* pParent = NULL, bool* pLock=NULL); // standard constructor CLanguageDialog(UINT uiIDTemplate, CWnd* pParent = NULL, bool* pLock=NULL); // standard constructor + CLanguageDialog(const CLanguageDialog&) = delete; + + CLanguageDialog& operator=(const CLanguageDialog&) = delete; ~CLanguageDialog(); Index: src/libictranslate/ResourceManager.cpp =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/libictranslate/ResourceManager.cpp (.../ResourceManager.cpp) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/libictranslate/ResourceManager.cpp (.../ResourceManager.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -498,7 +498,7 @@ { TRACE(_T("Warning! Old-style translation string %s.\n"), pszName); - int iCount = _stscanf(pszName, UIFMT, &uiID); + int iCount = _stscanf(pszName, L"%u", &uiID); if(iCount != 1) { TRACE(_T("Warning! Problem retrieving id from string '%s'\n"), pszName); Index: src/rc2lng/rc.cpp =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d --- src/rc2lng/rc.cpp (.../rc.cpp) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/rc2lng/rc.cpp (.../rc.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) @@ -73,7 +73,7 @@ if(str.Find(_T("x")) != -1) { // hex2dec - if(_stscanf(str, _T("%lx"), &iID) != 1) + if(_stscanf(str, _T("%x"), &iID) != 1) THROW(icpf::exception::format(TSTRFMT _T("(%ld) : Error: Cannot parse hex number in line:\n") TSTRFMT, pszFile, lLineNo, m_pszBuffer), 0, 0, 0); } else @@ -275,7 +275,7 @@ // put the found ID as output text CString out; - out.Format(_T("\"%lu\""), uiID); + out.Format(_T("\"%u\""), uiID); str=str.Left(iPos)+out; } else Index: tools/libicpf32u.dll =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d Binary files differ Index: tools/rc2lng.exe =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d Binary files differ