Index: src/ch/CustomCopyDlg.cpp =================================================================== diff -u -N -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -ra13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0 --- src/ch/CustomCopyDlg.cpp (.../CustomCopyDlg.cpp) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/ch/CustomCopyDlg.cpp (.../CustomCopyDlg.cpp) (revision a13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0) @@ -476,31 +476,30 @@ m_ctlBufferSizes.ResetContent(); // fill the list - TCHAR szSize[64]; ictranslate::CFormat fmt; chcore::TBufferSizes bsSizes = chcore::GetTaskPropBufferSizes(m_tTaskDefinition.GetConfiguration()); fmt.SetFormat(GetResManager().LoadString(IDS_BSEDEFAULT_STRING)); - fmt.SetParam(_t("%size"), GetSizeString(bsSizes.GetDefaultSize(), szSize, 64, true)); + fmt.SetParam(_t("%size"), GetSizeString(bsSizes.GetDefaultSize(), true)); m_ctlBufferSizes.AddString(fmt); if (!bsSizes.IsOnlyDefault()) { fmt.SetFormat(GetResManager().LoadString(IDS_BSEONEDISK_STRING)); - fmt.SetParam(_t("%size"), GetSizeString(bsSizes.GetOneDiskSize(), szSize, 64, true)); + fmt.SetParam(_t("%size"), GetSizeString(bsSizes.GetOneDiskSize(), true)); m_ctlBufferSizes.AddString(fmt); fmt.SetFormat(GetResManager().LoadString(IDS_BSETWODISKS_STRING)); - fmt.SetParam(_t("%size"), GetSizeString(bsSizes.GetTwoDisksSize(), szSize, 64, true)); + fmt.SetParam(_t("%size"), GetSizeString(bsSizes.GetTwoDisksSize(), true)); m_ctlBufferSizes.AddString(fmt); fmt.SetFormat(GetResManager().LoadString(IDS_BSECD_STRING)); - fmt.SetParam(_t("%size"), GetSizeString(bsSizes.GetCDSize(), szSize, 64, true)); + fmt.SetParam(_t("%size"), GetSizeString(bsSizes.GetCDSize(), true)); m_ctlBufferSizes.AddString(fmt); fmt.SetFormat(GetResManager().LoadString(IDS_BSELAN_STRING)); - fmt.SetParam(_t("%size"), GetSizeString(bsSizes.GetLANSize(), szSize, 64, true)); + fmt.SetParam(_t("%size"), GetSizeString(bsSizes.GetLANSize(), true)); m_ctlBufferSizes.AddString(fmt); } } @@ -572,7 +571,6 @@ { LVITEM lvi; TCHAR szLoaded[1024]; - TCHAR szData[64]; lvi.mask=LVIF_TEXT; lvi.iItem=(iPos == -1) ? m_ctlFilters.GetItemCount() : iPos; @@ -612,13 +610,13 @@ if (rFilter.GetUseSize1()) { - _sntprintf(szLoaded, 1024, _T("%s %s"), GetResManager().LoadString(IDS_LT_STRING+rFilter.GetSizeType1()), GetSizeString(rFilter.GetSize1(), szData, 64, true)); + _sntprintf(szLoaded, 1024, _T("%s %s"), GetResManager().LoadString(IDS_LT_STRING+rFilter.GetSizeType1()), GetSizeString(rFilter.GetSize1(), true)); szLoaded[1023] = _T('\0'); if (rFilter.GetUseSize2()) { _tcscat(szLoaded, GetResManager().LoadString(IDS_AND_STRING)); CString strLoaded2; - strLoaded2.Format(_T("%s %s"), GetResManager().LoadString(IDS_LT_STRING+rFilter.GetSizeType2()), GetSizeString(rFilter.GetSize2(), szData, 64, true)); + strLoaded2.Format(_T("%s %s"), GetResManager().LoadString(IDS_LT_STRING+rFilter.GetSizeType2()), GetSizeString(rFilter.GetSize2(), true)); _tcscat(szLoaded, strLoaded2); } } Index: src/ch/FeedbackNotEnoughSpaceDlg.cpp =================================================================== diff -u -N -r671f4b1792a20d98b186f4e0a9cc6a620dede019 -ra13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0 --- src/ch/FeedbackNotEnoughSpaceDlg.cpp (.../FeedbackNotEnoughSpaceDlg.cpp) (revision 671f4b1792a20d98b186f4e0a9cc6a620dede019) +++ src/ch/FeedbackNotEnoughSpaceDlg.cpp (.../FeedbackNotEnoughSpaceDlg.cpp) (revision a13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0) @@ -76,14 +76,13 @@ pWnd->SetWindowText(fmt); // now the sizes - TCHAR szData[128]; pWnd=GetDlgItem(IDC_REQUIRED_STATIC); if (pWnd) - pWnd->SetWindowText(GetSizeString(m_ullRequired, szData, 128)); + pWnd->SetWindowText(GetSizeString(m_ullRequired)); ull_t ullFree; pWnd=GetDlgItem(IDC_AVAILABLE_STATIC); if (pWnd && GetDynamicFreeSpace(m_strDisk, &ullFree, NULL)) - pWnd->SetWindowText(GetSizeString(ullFree, szData, 128)); + pWnd->SetWindowText(GetSizeString(ullFree)); } BOOL CFeedbackNotEnoughSpaceDlg::OnInitDialog() @@ -133,8 +132,7 @@ CWnd *pWnd=GetDlgItem(IDC_AVAILABLE_STATIC); if (pWnd && GetDynamicFreeSpace(m_strDisk, &ullFree, NULL)) { - TCHAR szData[128]; - pWnd->SetWindowText(GetSizeString(ullFree, szData, 128)); + pWnd->SetWindowText(GetSizeString(ullFree)); // end dialog if this is enough if (m_ullRequired <= ullFree) Index: src/ch/FolderDialog.cpp =================================================================== diff -u -N -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d -ra13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0 --- src/ch/FolderDialog.cpp (.../FolderDialog.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) +++ src/ch/FolderDialog.cpp (.../FolderDialog.cpp) (revision a13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0) @@ -646,7 +646,6 @@ // try to get path CString strPath, strMask; - TCHAR szSizeFree[32], szSizeTotal[32]; bool bPath; if ( (bPath=m_ctlTree.GetPath(pit->hItem, strPath.GetBuffer(_MAX_PATH))) == true ) { @@ -660,8 +659,8 @@ ull_t ullFree, ullTotal; if (GetDynamicFreeSpace(strPath, &ullFree, &ullTotal)) { - m_strTip+=GetResManager().LoadString(IDS_BDFREESPACE_STRING)+CString(GetSizeString(ullFree, szSizeFree, 32, false))+_T("\n"); - m_strTip+=GetResManager().LoadString(IDS_BDCAPACITY_STRING)+CString(GetSizeString(ullTotal, szSizeTotal, 32, false))+_T("\n"); + m_strTip += GetResManager().LoadString(IDS_BDFREESPACE_STRING) + GetSizeString(ullFree, false) + _T("\n"); + m_strTip += GetResManager().LoadString(IDS_BDCAPACITY_STRING) + GetSizeString(ullTotal, false) + _T("\n"); } } } Index: src/ch/MainWnd.cpp =================================================================== diff -u -N -rba618764ec3c9221fa704e905a9f807bd85ed4c5 -ra13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0 --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision ba618764ec3c9221fa704e905a9f807bd85ed4c5) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision a13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0) @@ -749,8 +749,6 @@ bool bRetrieveFreeSpace = GetPropValue(rConfig); std::vector vShortcuts; - const size_t stSizeBufferSize = 64; - boost::shared_array spSizeBuffer(new wchar_t[stSizeBufferSize]); BOOST_FOREACH(const CString& strShortcutString, vShortcutStrings) { @@ -763,7 +761,7 @@ if(bRetrieveFreeSpace && GetDynamicFreeSpace(tShortcut.m_strPath, &ullSize, NULL)) { CString strNameFormat; - strNameFormat.Format(_T("%s (%s)"), tShortcut.m_strName, GetSizeString(ullSize, spSizeBuffer.get(), stSizeBufferSize)); + strNameFormat.Format(_T("%s (%s)"), tShortcut.m_strName, GetSizeString(ullSize)); tShortcut.m_strName = strNameFormat; } Index: src/ch/StatusDlg.cpp =================================================================== diff -u -N -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d -ra13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0 --- src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) +++ src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision a13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0) @@ -1089,9 +1089,8 @@ CString CStatusDlg::GetSpeedString(double dSizeSpeed, double dAvgSizeSpeed, double dCountSpeed, double dAvgCountSpeed) const { - TCHAR szData[_MAX_PATH]; - CString strSpeedText = GetSizeString(dSizeSpeed, szData, _MAX_PATH); // last avg - CString strAvgSpeedText = GetSizeString(dAvgSizeSpeed, szData, _MAX_PATH); // last avg + CString strSpeedText = GetSizeString(dSizeSpeed); // last avg + CString strAvgSpeedText = GetSizeString(dAvgSizeSpeed); // last avg CString strAvgWord = GetResManager().LoadString(IDS_AVERAGEWORD_STRING); Index: src/ch/StringHelpers.cpp =================================================================== diff -u -N -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d -ra13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0 --- src/ch/StringHelpers.cpp (.../StringHelpers.cpp) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) +++ src/ch/StringHelpers.cpp (.../StringHelpers.cpp) (revision a13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0) @@ -1,21 +1,21 @@ -/*************************************************************************** -* Copyright (C) 2001-2008 by J�zef Starosczyk * -* ixen@copyhandler.com * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU Library General Public License * -* (version 2) as published by the Free Software Foundation; * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU Library General Public * -* License along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * -***************************************************************************/ +// ============================================================================ +// Copyright (C) 2001-2015 by Jozef Starosczyk +// ixen@copyhandler.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License +// (version 2) as published by the Free Software Foundation; +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// ============================================================================ #include "stdafx.h" #include "ch.h" #include "StringHelpers.h" @@ -25,40 +25,6 @@ #define new DEBUG_NEW #endif -LPCTSTR GetSizeString(double dData, LPTSTR pszBuffer, size_t stMaxBufferSize) -{ - if (dData < 0.0) - dData=0.0; - - if (dData < 1200.0) - _sntprintf(pszBuffer, stMaxBufferSize, _T("%.2f %s"), dData, GetResManager().LoadString(IDS_BYTE_STRING)); - else if (dData < 1228800.0) - _sntprintf(pszBuffer, stMaxBufferSize, _T("%.2f %s"), static_cast(dData)/1024.0, GetResManager().LoadString(IDS_KBYTE_STRING)); - else if (dData < 1258291200.0) - _sntprintf(pszBuffer, stMaxBufferSize, _T("%.2f %s"), static_cast(dData)/1048576.0, GetResManager().LoadString(IDS_MBYTE_STRING)); - else - _sntprintf(pszBuffer, stMaxBufferSize, _T("%.2f %s"), static_cast(dData)/1073741824.0, GetResManager().LoadString(IDS_GBYTE_STRING)); - - return pszBuffer; -} - -LPCTSTR GetSizeString(ull_t ullData, LPTSTR pszBuffer, size_t stMaxBufferSize, bool bStrict) -{ - if (ullData < 0) - ullData=0; - - if (ullData >= 1258291200 && (!bStrict || (ullData % 1073741824) == 0)) - _sntprintf(pszBuffer, stMaxBufferSize, _T("%.2f %s"), (double)(ullData/1073741824.0), GetResManager().LoadString(IDS_GBYTE_STRING)); - else if (ullData >= 1228800 && (!bStrict || (ullData % 1048576) == 0)) - _sntprintf(pszBuffer, stMaxBufferSize, _T("%.2f %s"), (double)(ullData/1048576.0), GetResManager().LoadString(IDS_MBYTE_STRING)); - else if (ullData >= 1200 && (!bStrict || (ullData % 1024) == 0)) - _sntprintf(pszBuffer, stMaxBufferSize, _T("%.2f %s"), (double)(ullData/1024.0), GetResManager().LoadString(IDS_KBYTE_STRING)); - else - _sntprintf(pszBuffer, stMaxBufferSize, _T("%I64u %s"), ullData, GetResManager().LoadString(IDS_BYTE_STRING)); - - return pszBuffer; -} - CString GetSizeString(double dData) { if(dData < 0.0) Index: src/ch/StringHelpers.h =================================================================== diff -u -N -r44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d -ra13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0 --- src/ch/StringHelpers.h (.../StringHelpers.h) (revision 44a2ec5f1eb0a435b56daef42ef5fe3b7a91da0d) +++ src/ch/StringHelpers.h (.../StringHelpers.h) (revision a13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0) @@ -1,27 +1,24 @@ -/*************************************************************************** -* Copyright (C) 2001-2008 by J�zef Starosczyk * -* ixen@copyhandler.com * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU Library General Public License * -* (version 2) as published by the Free Software Foundation; * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU Library General Public * -* License along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * -***************************************************************************/ +// ============================================================================ +// Copyright (C) 2001-2015 by Jozef Starosczyk +// ixen@copyhandler.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License +// (version 2) as published by the Free Software Foundation; +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// ============================================================================ #ifndef __STRINGHELPERS_H__ #define __STRINGHELPERS_H__ -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); Index: src/chext/ShellPathsHelpers.cpp =================================================================== diff -u -N -r73583f2ca01fa1b2eae49bbc63bce46b9ecff5db -ra13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0 --- src/chext/ShellPathsHelpers.cpp (.../ShellPathsHelpers.cpp) (revision 73583f2ca01fa1b2eae49bbc63bce46b9ecff5db) +++ src/chext/ShellPathsHelpers.cpp (.../ShellPathsHelpers.cpp) (revision a13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0) @@ -56,10 +56,9 @@ TCHAR szPath[stMaxPathLength]; // get files and put it in a table - UINT uiSize; for(UINT uiIndex = 0; uiIndex < uiFilesCount; ++uiIndex) { - uiSize = DragQueryFile(hDrop, uiIndex, szPath, stMaxPathLength); + UINT uiSize = DragQueryFile(hDrop, uiIndex, szPath, stMaxPathLength); szPath[uiSize] = _T('\0'); tPathContainer.Add(chcore::PathFromString(szPath)); Index: src/libchcore/TFakeFilesystemFile.cpp =================================================================== diff -u -N -r41383599835bbab64d854eed179a7db21a59c6bf -ra13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0 --- src/libchcore/TFakeFilesystemFile.cpp (.../TFakeFilesystemFile.cpp) (revision 41383599835bbab64d854eed179a7db21a59c6bf) +++ src/libchcore/TFakeFilesystemFile.cpp (.../TFakeFilesystemFile.cpp) (revision a13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0) @@ -115,16 +115,16 @@ APCINFO* pInfo = new APCINFO; unsigned long long ullNewSize = 0; - unsigned long long ullGrow = 0; + //unsigned long long ullGrow = 0; if (rBuffer.GetFilePosition() >= spFileDesc->GetFileInfo().GetLength64()) { ullNewSize = rBuffer.GetFilePosition() + rBuffer.GetRealDataSize(); - ullGrow = ullNewSize - spFileDesc->GetFileInfo().GetLength64(); + //ullGrow = ullNewSize - spFileDesc->GetFileInfo().GetLength64(); } else { ullNewSize = std::max(rBuffer.GetFilePosition() + rBuffer.GetRealDataSize(), spFileDesc->GetFileInfo().GetLength64()); - ullGrow = ullNewSize - spFileDesc->GetFileInfo().GetLength64(); + //ullGrow = ullNewSize - spFileDesc->GetFileInfo().GetLength64(); } spFileDesc->GetFileInfo().SetLength64(ullNewSize); Index: src/libictranslate/LanguageDialog.cpp =================================================================== diff -u -N -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -ra13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0 --- src/libictranslate/LanguageDialog.cpp (.../LanguageDialog.cpp) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/libictranslate/LanguageDialog.cpp (.../LanguageDialog.cpp) (revision a13bee8e2ecd1e8f61be0aa9b51d99acdc43a5d0) @@ -939,8 +939,6 @@ CRect rcCurrentDlgPos; GetClientRect(&rcCurrentDlgPos); - bool bRepositioned = false; - std::map::iterator iterControl = m_mapResizeInfo.begin(); while(iterControl != m_mapResizeInfo.end()) { @@ -951,17 +949,11 @@ { (*iterControl).second.GetNewControlPlacement(m_rcDialogInitialPosition, rcCurrentDlgPos, rcControl); pWnd->SetWindowPos(NULL, rcControl.left, rcControl.top, rcControl.Width(), rcControl.Height(), SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS); - bRepositioned = true; } } ++iterControl; } - -/* - if(bRepositioned) - RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);*/ - } END_ICTRANSLATE_NAMESPACE