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)