Index: src/ch/CustomCopyDlg.cpp =================================================================== diff -u -rcdc76e1a95383dff63a5254aeb8d37035028512c -r8dc649003961dad64b92da67426814fb5dd862e0 --- src/ch/CustomCopyDlg.cpp (.../CustomCopyDlg.cpp) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) +++ src/ch/CustomCopyDlg.cpp (.../CustomCopyDlg.cpp) (revision 8dc649003961dad64b92da67426814fb5dd862e0) @@ -27,7 +27,6 @@ #include "FilterDlg.h" #include "StringHelpers.h" #include "ch.h" -#include "../libicpf/file.h" #include "../libchcore/TTaskConfigBufferSizes.h" #ifdef _DEBUG @@ -43,15 +42,7 @@ CCustomCopyDlg::CCustomCopyDlg() : ictranslate::CLanguageDialog(CCustomCopyDlg::IDD) { - m_bOnlyCreate = FALSE; - m_bIgnoreFolders = FALSE; - m_bFilters = FALSE; - m_bAdvanced = FALSE; - m_bForceDirectories = FALSE; - GetConfig().ExtractSubConfig(BRANCH_TASK_SETTINGS, m_tTaskDefinition.GetConfiguration()); - - m_bActualisation = false; } CCustomCopyDlg::CCustomCopyDlg(const chcore::TTaskDefinition& rTaskDefinition) : @@ -484,31 +475,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); } } @@ -580,7 +570,6 @@ { LVITEM lvi; TCHAR szLoaded[1024]; - TCHAR szData[64]; lvi.mask=LVIF_TEXT; lvi.iItem=(iPos == -1) ? m_ctlFilters.GetItemCount() : iPos; @@ -620,13 +609,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); } } @@ -906,31 +895,29 @@ { boost::shared_array spBuffer; - ulong_t ulSize = 0; - CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, GetResManager().LoadString(IDS_FLTALLFILTER_STRING)); if(dlg.DoModal() == IDOK) { + unsigned long ulSize = 0; UINT uiCount=0; try { - icpf::file file; - file.open(dlg.GetPathName(), FA_READ); + CFile file(dlg.GetPathName(), CFile::modeRead); // load files max 1MB in size; - ll_t llSize = file.get_size(); - if(llSize > 1*1024*1024 || llSize < 2) + unsigned long long ullSize = file.GetLength(); + if(ullSize > 1*1024*1024 || ullSize < 2) { AfxMessageBox(GetResManager().LoadString(IDS_IMPORTERROR_STRING)); return; } - ulSize = boost::numeric_cast(llSize); + ulSize = boost::numeric_cast(ullSize); spBuffer.reset(new BYTE[ulSize + 3]); // guarantee that we have null at the end of the string (3 bytes to compensate for possible odd number of bytes and for unicode) memset(spBuffer.get(), 0, ulSize + 3); - ulSize = file.read(spBuffer.get(), ulSize); - file.close(); + ulSize = file.Read(spBuffer.get(), ulSize); + file.Close(); } catch(...) { @@ -988,7 +975,7 @@ // report ictranslate::CFormat fmt(GetResManager().LoadString(IDS_IMPORTREPORT_STRING)); - fmt.SetParam(_t("%count"), uiCount); + fmt.SetParam(_T("%count"), uiCount); AfxMessageBox(fmt); } } @@ -1036,7 +1023,7 @@ { ictranslate::CFormat fmt; fmt.SetFormat(GetResManager().LoadString(IDS_EXPORTING_TASK_FAILED)); - fmt.SetParam(_t("%reason"), strError); + fmt.SetParam(_T("%reason"), strError); AfxMessageBox(fmt, MB_OK | MB_ICONERROR); }