Index: src/ch/BufferSizeDlg.cpp =================================================================== diff -u -r6df9b4cff81dedf8c5571a98702b584b061eac09 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/ch/BufferSizeDlg.cpp (.../BufferSizeDlg.cpp) (revision 6df9b4cff81dedf8c5571a98702b584b061eac09) +++ src/ch/BufferSizeDlg.cpp (.../BufferSizeDlg.cpp) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -30,42 +30,41 @@ ///////////////////////////////////////////////////////////////////////////// // CBufferSizeDlg dialog -CBufferSizeDlg::CBufferSizeDlg() - : ictranslate::CLanguageDialog(CBufferSizeDlg::IDD) +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) { - //{{AFX_DATA_INIT(CBufferSizeDlg) - m_uiDefaultSize = 0; - m_uiLANSize = 0; - m_uiCDROMSize = 0; - m_uiOneDiskSize = 0; - m_uiTwoDisksSize = 0; - m_bOnlyDefaultCheck = FALSE; - //}}AFX_DATA_INIT - m_iActiveIndex = chcore::TBufferSizes::eBuffer_Default; + if (pInitialBufferSizes) + m_bsSizes = *pInitialBufferSizes; } void CBufferSizeDlg::DoDataExchange(CDataExchange* pDX) { CLanguageDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CBufferSizeDlg) + DDX_Control(pDX, IDC_TWODISKSMULTIPLIER_COMBO, m_ctlTwoDisksMulti); DDX_Control(pDX, IDC_ONEDISKMULTIPLIER_COMBO, m_ctlOneDiskMulti); DDX_Control(pDX, IDC_LANMULTIPLIER_COMBO, m_ctlLANMulti); DDX_Control(pDX, IDC_DEFAULTMULTIPLIER_COMBO, m_ctlDefaultMulti); DDX_Control(pDX, IDC_CDROMMULTIPLIER_COMBO, m_ctlCDROMMulti); + DDX_Control(pDX, IDC_BUFFERCOUNT_SPIN, m_ctlBufferCountSpin); DDX_Text(pDX, IDC_DEFAULTSIZE_EDIT, m_uiDefaultSize); DDX_Text(pDX, IDC_LANSIZE_EDIT, m_uiLANSize); DDX_Text(pDX, IDC_CDROMSIZE_EDIT, m_uiCDROMSize); DDX_Text(pDX, IDC_ONEDISKSIZE_EDIT, m_uiOneDiskSize); DDX_Text(pDX, IDC_TWODISKSSIZE_EDIT, m_uiTwoDisksSize); DDX_Check(pDX, IDC_ONLYDEFAULT_CHECK, m_bOnlyDefaultCheck); - //}}AFX_DATA_MAP + DDX_Text(pDX, IDC_BUFFERCOUNT_EDIT, m_uiBufferCount); } BEGIN_MESSAGE_MAP(CBufferSizeDlg,ictranslate::CLanguageDialog) - //{{AFX_MSG_MAP(CBufferSizeDlg) ON_BN_CLICKED(IDC_ONLYDEFAULT_CHECK, OnOnlydefaultCheck) - //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// @@ -102,14 +101,18 @@ SetTwoDisksSize(m_bsSizes.GetTwoDisksSize()); SetCDSize(m_bsSizes.GetCDSize()); SetLANSize(m_bsSizes.GetLANSize()); + m_uiBufferCount = m_bsSizes.GetBufferCount(); m_bOnlyDefaultCheck=m_bsSizes.IsOnlyDefault(); + // buffer count handling + m_ctlBufferCountSpin.SetRange(1, 1000); + EnableControls(!m_bsSizes.IsOnlyDefault()); UpdateData(FALSE); // set focus to the requested control - switch (m_iActiveIndex) + switch (m_eSelectedBuffer) { case chcore::TBufferSizes::eBuffer_Default: GetDlgItem(IDC_DEFAULTSIZE_EDIT)->SetFocus(); @@ -214,6 +217,7 @@ m_bsSizes.SetTwoDisksSize(m_uiTwoDisksSize*IndexToValue(m_ctlTwoDisksMulti.GetCurSel())); m_bsSizes.SetCDSize(m_uiCDROMSize*IndexToValue(m_ctlCDROMMulti.GetCurSel())); m_bsSizes.SetLANSize(m_uiLANSize*IndexToValue(m_ctlLANMulti.GetCurSel())); + m_bsSizes.SetBufferCount(m_uiBufferCount); CLanguageDialog::OnOK(); } Index: src/ch/BufferSizeDlg.h =================================================================== diff -u -r6df9b4cff81dedf8c5571a98702b584b061eac09 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/ch/BufferSizeDlg.h (.../BufferSizeDlg.h) (revision 6df9b4cff81dedf8c5571a98702b584b061eac09) +++ src/ch/BufferSizeDlg.h (.../BufferSizeDlg.h) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -19,66 +19,54 @@ #ifndef __BUFFERSIZEDLG_H__ #define __BUFFERSIZEDLG_H__ -#include "../libchcore/DataBuffer.h" +#include "..\libchcore\TBufferSizes.h" ///////////////////////////////////////////////////////////////////////////// // CBufferSizeDlg dialog class CBufferSizeDlg : public ictranslate::CLanguageDialog { -// Construction public: - CBufferSizeDlg(); // standard constructor + CBufferSizeDlg(chcore::TBufferSizes* pInitialBufferSizes, chcore::TBufferSizes::EBufferType eSelectedBuffer = chcore::TBufferSizes::eBuffer_Default); + const chcore::TBufferSizes& GetBufferSizes() const { return m_bsSizes; } + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual void OnLanguageChanged(); + virtual BOOL OnInitDialog(); + virtual void OnOK(); + void OnOnlydefaultCheck(); + void SetLANSize(UINT uiSize); void SetCDSize(UINT uiSize); void SetTwoDisksSize(UINT uiSize); void SetOneDiskSize(UINT uiSize); void SetDefaultSize(UINT uiSize); UINT IndexToValue(int iIndex); - int m_iActiveIndex; - chcore::TBufferSizes m_bsSizes; + void EnableControls(bool bEnable=true); -// Dialog Data - //{{AFX_DATA(CBufferSizeDlg) - enum { IDD = IDD_BUFFERSIZE_DIALOG }; + DECLARE_MESSAGE_MAP() + +private: CComboBox m_ctlTwoDisksMulti; CComboBox m_ctlOneDiskMulti; CComboBox m_ctlLANMulti; CComboBox m_ctlDefaultMulti; 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; - //}}AFX_DATA - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CBufferSizeDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - virtual void OnLanguageChanged(); - - void EnableControls(bool bEnable=true); - // Generated message map functions - //{{AFX_MSG(CBufferSizeDlg) - virtual BOOL OnInitDialog(); - virtual void OnOK(); - afx_msg void OnOnlydefaultCheck(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() + chcore::TBufferSizes::EBufferType m_eSelectedBuffer; + chcore::TBufferSizes m_bsSizes; }; -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - #endif Index: src/ch/CustomCopyDlg.cpp =================================================================== diff -u -r503a68180cbb933c97e9af965744bf106994c05a -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/ch/CustomCopyDlg.cpp (.../CustomCopyDlg.cpp) (revision 503a68180cbb933c97e9af965744bf106994c05a) +++ src/ch/CustomCopyDlg.cpp (.../CustomCopyDlg.cpp) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -28,6 +28,7 @@ #include "StringHelpers.h" #include "ch.h" #include "../libicpf/file.h" +#include "../libchcore/TTaskConfigBufferSizes.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -486,13 +487,7 @@ TCHAR szSize[64]; ictranslate::CFormat fmt; - chcore::TBufferSizes bsSizes; - bsSizes.SetOnlyDefault(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - bsSizes.SetDefaultSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - bsSizes.SetOneDiskSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - bsSizes.SetTwoDisksSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - bsSizes.SetCDSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - bsSizes.SetLANSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); + 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)); @@ -518,26 +513,14 @@ } } -void CCustomCopyDlg::OnChangebufferButton() +void CCustomCopyDlg::OnChangebufferButton() { - CBufferSizeDlg dlg; + chcore::TBufferSizes tBufferSizes = GetTaskPropBufferSizes(m_tTaskDefinition.GetConfiguration()); - dlg.m_bsSizes.SetOnlyDefault(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetDefaultSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetOneDiskSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetTwoDisksSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetCDSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetLANSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - + CBufferSizeDlg dlg(&tBufferSizes); if(dlg.DoModal() == IDOK) { - chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.IsOnlyDefault()); - chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetDefaultSize()); - chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetOneDiskSize()); - chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetTwoDisksSize()); - chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetCDSize()); - chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetLANSize()); - + SetTaskPropBufferSizes(m_tTaskDefinition.GetConfiguration(), dlg.GetBufferSizes()); SetBuffersizesString(); } } @@ -836,25 +819,12 @@ int iItem = m_ctlBufferSizes.GetCurSel(); if(iItem != LB_ERR) { - CBufferSizeDlg dlg; + chcore::TBufferSizes tBufferSizes = GetTaskPropBufferSizes(m_tTaskDefinition.GetConfiguration()); + CBufferSizeDlg dlg(&tBufferSizes, (chcore::TBufferSizes::EBufferType)iItem); - dlg.m_bsSizes.SetOnlyDefault(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetDefaultSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetOneDiskSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetTwoDisksSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetCDSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - dlg.m_bsSizes.SetLANSize(chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration())); - - dlg.m_iActiveIndex = iItem; if(dlg.DoModal() == IDOK) { - chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.IsOnlyDefault()); - chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetDefaultSize()); - chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetOneDiskSize()); - chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetTwoDisksSize()); - chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetCDSize()); - chcore::SetTaskPropValue(m_tTaskDefinition.GetConfiguration(), dlg.m_bsSizes.GetLANSize()); - + SetTaskPropBufferSizes(m_tTaskDefinition.GetConfiguration(), dlg.GetBufferSizes()); SetBuffersizesString(); } } Index: src/ch/CustomCopyDlg.h =================================================================== diff -u -r503a68180cbb933c97e9af965744bf106994c05a -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/ch/CustomCopyDlg.h (.../CustomCopyDlg.h) (revision 503a68180cbb933c97e9af965744bf106994c05a) +++ src/ch/CustomCopyDlg.h (.../CustomCopyDlg.h) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -19,7 +19,6 @@ #ifndef __CUSTOMCOPYDLG_H__ #define __CUSTOMCOPYDLG_H__ -#include "../libchcore/DataBuffer.h" #include "../libchcore/TFileFilter.h" #include "../libchcore/TTaskDefinition.h" Index: src/ch/OptionsDlg.cpp =================================================================== diff -u -r73d92717b7ba780c7aea1489a5eaa87404afa408 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/ch/OptionsDlg.cpp (.../OptionsDlg.cpp) (revision 73d92717b7ba780c7aea1489a5eaa87404afa408) +++ src/ch/OptionsDlg.cpp (.../OptionsDlg.cpp) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -132,33 +132,37 @@ void CustomPropertyCallbackProc(LPVOID lpParam, int iParam, CPtrList* pList, int iIndex) { COptionsDlg* pDlg=static_cast(lpParam); - CBufferSizeDlg dlg; - dlg.m_bsSizes.SetOnlyDefault(pDlg->GetBoolProp(iIndex-iParam-1)); - dlg.m_bsSizes.SetDefaultSize(pDlg->GetUintProp(iIndex-iParam)); - dlg.m_bsSizes.SetOneDiskSize(pDlg->GetUintProp(iIndex-iParam+1)); - dlg.m_bsSizes.SetTwoDisksSize(pDlg->GetUintProp(iIndex-iParam+2)); - dlg.m_bsSizes.SetCDSize(pDlg->GetUintProp(iIndex-iParam+3)); - dlg.m_bsSizes.SetLANSize(pDlg->GetUintProp(iIndex-iParam+4)); - dlg.m_iActiveIndex=iParam; // selected buffer for editing + chcore::TBufferSizes tBufferSizes(pDlg->GetBoolProp(iIndex - iParam - 1), + pDlg->GetUintProp(iIndex - iParam + 5), + pDlg->GetUintProp(iIndex - iParam), + pDlg->GetUintProp(iIndex - iParam + 1), + pDlg->GetUintProp(iIndex - iParam + 2), + pDlg->GetUintProp(iIndex - iParam + 3), + pDlg->GetUintProp(iIndex - iParam + 4)); + CBufferSizeDlg dlg(&tBufferSizes, (chcore::TBufferSizes::EBufferType)iParam); if (dlg.DoModal() == IDOK) { + tBufferSizes = dlg.GetBufferSizes(); + PROPERTYITEM* pItem; TCHAR xx[32]; pItem = (PROPERTYITEM*)pList->GetAt(pList->FindIndex(iIndex-iParam-1)); - pItem->nPropertySelected=(dlg.m_bsSizes.IsOnlyDefault() ? 1 : 0); + pItem->nPropertySelected=(tBufferSizes.IsOnlyDefault() ? 1 : 0); pItem = (PROPERTYITEM*)pList->GetAt(pList->FindIndex(iIndex-iParam)); - pItem->csProperties.SetAt(0, _itot(dlg.m_bsSizes.GetDefaultSize(), xx, 10)); + pItem->csProperties.SetAt(0, _itot(tBufferSizes.GetDefaultSize(), xx, 10)); pItem = (PROPERTYITEM*)pList->GetAt(pList->FindIndex(iIndex-iParam+1)); - pItem->csProperties.SetAt(0, _itot(dlg.m_bsSizes.GetOneDiskSize(), xx, 10)); + pItem->csProperties.SetAt(0, _itot(tBufferSizes.GetOneDiskSize(), xx, 10)); pItem = (PROPERTYITEM*)pList->GetAt(pList->FindIndex(iIndex-iParam+2)); - pItem->csProperties.SetAt(0, _itot(dlg.m_bsSizes.GetTwoDisksSize(), xx, 10)); + pItem->csProperties.SetAt(0, _itot(tBufferSizes.GetTwoDisksSize(), xx, 10)); pItem = (PROPERTYITEM*)pList->GetAt(pList->FindIndex(iIndex-iParam+3)); - pItem->csProperties.SetAt(0, _itot(dlg.m_bsSizes.GetCDSize(), xx, 10)); - pItem = (PROPERTYITEM*)pList->GetAt(pList->FindIndex(iIndex-iParam+4)); - pItem->csProperties.SetAt(0, _itot(dlg.m_bsSizes.GetLANSize(), xx, 10)); + pItem->csProperties.SetAt(0, _itot(tBufferSizes.GetCDSize(), xx, 10)); + pItem = (PROPERTYITEM*) pList->GetAt(pList->FindIndex(iIndex - iParam + 4)); + pItem->csProperties.SetAt(0, _itot(tBufferSizes.GetLANSize(), xx, 10)); + pItem = (PROPERTYITEM*) pList->GetAt(pList->FindIndex(iIndex - iParam + 5)); + pItem->csProperties.SetAt(0, _itot(tBufferSizes.GetBufferCount(), xx, 10)); } } Index: src/ch/StatusDlg.cpp =================================================================== diff -u -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) +++ src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -239,11 +239,12 @@ iCurrentBufferIndex = spSubTaskStats->GetCurrentBufferIndex(); } - CBufferSizeDlg dlg; - spTask->GetBufferSizes(dlg.m_bsSizes); - dlg.m_iActiveIndex = iCurrentBufferIndex; + chcore::TBufferSizes tBufferSizes; + spTask->GetBufferSizes(tBufferSizes); + + CBufferSizeDlg dlg(&tBufferSizes, (chcore::TBufferSizes::EBufferType)iCurrentBufferIndex); if(dlg.DoModal() == IDOK) - spTask->SetBufferSizes(dlg.m_bsSizes); + spTask->SetBufferSizes(dlg.GetBufferSizes()); } chcore::TTaskPtr CStatusDlg::GetSelectedItemPointer() Index: src/ch/ch.rc =================================================================== diff -u -r73d92717b7ba780c7aea1489a5eaa87404afa408 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/ch/ch.rc (.../ch.rc) (revision 73d92717b7ba780c7aea1489a5eaa87404afa408) +++ src/ch/ch.rc (.../ch.rc) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -43,7 +43,7 @@ CONTROL "",IDC_MEASURE_RICHEDIT,"RichEdit20W",ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,7,7,11,7 END -IDD_BUFFERSIZE_DIALOG DIALOGEX 0, 0, 344, 127 +IDD_BUFFERSIZE_DIALOG DIALOGEX 0, 0, 345, 135 STYLE DS_SETFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Buffer size settings" FONT 8, "Tahoma", 0, 0, 0x1 @@ -55,23 +55,26 @@ EDITTEXT IDC_TWODISKSSIZE_EDIT,35,81,97,14,ES_AUTOHSCROLL | NOT WS_BORDER,WS_EX_CLIENTEDGE,HIDC_TWODISKSSIZE_EDIT COMBOBOX IDC_TWODISKSMULTIPLIER_COMBO,134,82,31,56,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP,0,HIDC_TWODISKSMULTIPLIER_COMBO EDITTEXT IDC_CDROMSIZE_EDIT,206,18,97,14,ES_AUTOHSCROLL | NOT WS_BORDER,WS_EX_CLIENTEDGE,HIDC_CDROMSIZE_EDIT - COMBOBOX IDC_CDROMMULTIPLIER_COMBO,306,18,31,56,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP,0,HIDC_CDROMMULTIPLIER_COMBO + COMBOBOX IDC_CDROMMULTIPLIER_COMBO,307,18,31,56,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP,0,HIDC_CDROMMULTIPLIER_COMBO EDITTEXT IDC_LANSIZE_EDIT,206,51,97,14,ES_AUTOHSCROLL | NOT WS_BORDER,WS_EX_CLIENTEDGE,HIDC_LANSIZE_EDIT - COMBOBOX IDC_LANMULTIPLIER_COMBO,306,52,31,56,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP,0,HIDC_LANMULTIPLIER_COMBO - DEFPUSHBUTTON "&OK",IDOK,176,106,50,14,0,0,HIDCANCEL - PUSHBUTTON "&Cancel",IDCANCEL,229,106,50,14,0,0,HIDCANCEL + COMBOBOX IDC_LANMULTIPLIER_COMBO,307,52,31,56,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP,0,HIDC_LANMULTIPLIER_COMBO + EDITTEXT IDC_BUFFERCOUNT_EDIT,206,82,122,14,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_BUFFERCOUNT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,327,82,11,14 + CONTROL "Use only default buffer",IDC_ONLYDEFAULT_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,102,331,10,0,HIDC_ONLYDEFAULT_CHECK + DEFPUSHBUTTON "&OK",IDOK,176,114,50,14,0,0,0x80890001 + PUSHBUTTON "&Cancel",IDCANCEL,229,114,50,14,0,0,HIDCANCEL + PUSHBUTTON "&Help",IDC_HELP_BUTTON,288,114,50,14,0,0,HIDC_HELP_BUTTON LTEXT "Default",IDC_001_STATIC,35,7,127,8 LTEXT "For copying inside one disk boundary",IDC_002_STATIC,35,38,130,8 LTEXT "For copying between two different disks",IDC_003_STATIC,35,70,132,8 - LTEXT "For copying with CD-ROM use",IDC_004_STATIC,206,7,131,8 - LTEXT "For copying with network use",IDC_005_STATIC,206,40,131,8 - CONTROL "Use only default buffer",IDC_ONLYDEFAULT_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,83,137,10,0,HIDC_ONLYDEFAULT_CHECK + LTEXT "For copying with CD-ROM use",IDC_004_STATIC,207,7,131,8 + LTEXT "For copying with network use",IDC_005_STATIC,207,40,131,8 ICON IDI_CD_ICON,IDC_006_STATIC,179,13,20,20,SS_REALSIZEIMAGE ICON IDI_NET_ICON,IDC_007_STATIC,179,44,20,20,SS_REALSIZEIMAGE ICON IDI_HDD_ICON,IDC_008_STATIC,7,43,20,20,SS_REALSIZEIMAGE ICON IDI_HDD2_ICON,IDC_009_STATIC,7,73,20,20,SS_REALSIZEIMAGE ICON IDI_TRIBE_ICON,IDC_010_STATIC,7,9,20,20,SS_REALSIZEIMAGE - PUSHBUTTON "&Help",IDC_HELP_BUTTON,287,106,50,14,0,0,HIDC_HELP_BUTTON + LTEXT "Count of buffers",IDC_011_STATIC,207,70,131,8 END IDD_FEEDBACK_FILE_ERROR_DIALOG DIALOGEX 0, 0, 283, 112 @@ -425,9 +428,9 @@ IDD_BUFFERSIZE_DIALOG, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 337 + RIGHTMARGIN, 338 TOPMARGIN, 7 - BOTTOMMARGIN, 120 + BOTTOMMARGIN, 128 END IDD_FEEDBACK_FILE_ERROR_DIALOG, DIALOG Index: src/ch/resource.h =================================================================== diff -u -r73d92717b7ba780c7aea1489a5eaa87404afa408 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/ch/resource.h (.../resource.h) (revision 73d92717b7ba780c7aea1489a5eaa87404afa408) +++ src/ch/resource.h (.../resource.h) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -350,6 +350,8 @@ #define IDC_MSG_RICHEDIT2 1321 #define IDC_MEASURE_RICHEDIT 1321 #define IDC_EXPORT_BUTTON 1322 +#define IDC_BUFFERCOUNT_SPIN 1324 +#define IDC_BUFFERCOUNT_EDIT 1325 #define IDS_APPNAME_STRING 5000 #define IDS_PRIORITY0_STRING 5001 #define IDS_PRIORITY1_STRING 5002 @@ -389,7 +391,7 @@ #define IDS_HIDE_AND_REGISTER 5036 #define IDS_HIDE_AND_DONT_REGISTER 5037 #define IDS_DIALOGS_SHOW_HIDE_STRING 5040 -#define IDS_SHELLEXT_REGISTER_SHOWHIDE_STRING 5041 +#define IDS_SHELLEXT_REGISTER_SHOWHIDE_STRING 5041 #define IDS_SHELLEXT_VERSIONMISMATCH_SHOWHIDE_STRING 5042 #define IDS_SHELLEXT_XML_IMPORT_FAILED 5043 #define IDS_ONECOPY_STRING 6000 @@ -493,7 +495,7 @@ #define IDS_CFGLOGLEVEL 8099 #define IDS_CFGLOGLEVEL_VALUES 8100 #define IDS_UPDATE_FREQUENCIES 8101 -#define IDS_BUFFER_QUEUE_DEPTH 8102 +#define IDS_BUFFER_QUEUE_DEPTH 8102 #define IDS_MENUCOPY_STRING 9000 #define IDS_MENUMOVE_STRING 9001 #define IDS_MENUCOPYMOVESPECIAL_STRING 9002 @@ -644,7 +646,7 @@ #define IDS_STATUS_INITIALIZING_STRING 21552 #define IDS_STATUS_FASTMOVE_STRING 21553 #define IDS_EMPTYSUBTASKNAME_STRING 21554 -#define IDS_STATUS_LOADERROR_STRING 21555 +#define IDS_STATUS_LOADERROR_STRING 21555 #define IDS_EXPORTING_TASK_FAILED 21556 #define ID_POPUP_SHOW_STATUS 32773 #define ID_POPUP_TIME_CRITICAL 32774 @@ -674,7 +676,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 216 #define _APS_NEXT_COMMAND_VALUE 32818 -#define _APS_NEXT_CONTROL_VALUE 1323 +#define _APS_NEXT_CONTROL_VALUE 1325 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif Fisheye: Tag cdc76e1a95383dff63a5254aeb8d37035028512c refers to a dead (removed) revision in file `src/libchcore/DataBuffer.cpp'. Fisheye: No comparison available. Pass `N' to diff? Index: src/libchcore/RoundingFunctions.h =================================================================== diff -u -r6103ac74583f2136b821dc67515ed8469abd8155 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/libchcore/RoundingFunctions.h (.../RoundingFunctions.h) (revision 6103ac74583f2136b821dc67515ed8469abd8155) +++ src/libchcore/RoundingFunctions.h (.../RoundingFunctions.h) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -24,6 +24,7 @@ BEGIN_CHCORE_NAMESPACE template T RoundUp(T number, T roundValue) { return ((number + roundValue - 1) & ~(roundValue - 1)); } +template T RoundDown(T number, T roundValue) { return (number & ~(roundValue - 1)); } END_CHCORE_NAMESPACE Index: src/libchcore/TBufferSizes.cpp =================================================================== diff -u --- src/libchcore/TBufferSizes.cpp (revision 0) +++ src/libchcore/TBufferSizes.cpp (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -0,0 +1,141 @@ +/*************************************************************************** +* 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. * +***************************************************************************/ +#include "stdafx.h" +#include "TBufferSizes.h" +#include "TCoreException.h" +#include "ErrorCodes.h" +#include "RoundingFunctions.h" + +BEGIN_CHCORE_NAMESPACE + +TBufferSizes::TBufferSizes() : + m_uiDefaultSize(BufferGranularity), + m_uiOneDiskSize(BufferGranularity), + m_uiTwoDisksSize(BufferGranularity), + m_uiCDSize(BufferGranularity), + m_uiLANSize(BufferGranularity), + m_bOnlyDefault(false), + m_uiBufferCount(MinBufferCount) +{ +} + +TBufferSizes::TBufferSizes(bool bOnlyDefault, UINT uiBufferCount, UINT uiDefaultSize, UINT uiOneDiskSize, UINT uiTwoDisksSize, UINT uiCDSize, UINT uiLANSize) : + m_uiDefaultSize(std::max(BufferGranularity, RoundUp(uiDefaultSize, BufferGranularity))), + m_uiOneDiskSize(std::max(BufferGranularity, RoundUp(uiOneDiskSize, BufferGranularity))), + m_uiTwoDisksSize(std::max(BufferGranularity, RoundUp(uiTwoDisksSize, BufferGranularity))), + m_uiCDSize(std::max(BufferGranularity, RoundUp(uiCDSize, BufferGranularity))), + m_uiLANSize(std::max(BufferGranularity, RoundUp(uiLANSize, BufferGranularity))), + m_bOnlyDefault(bOnlyDefault), + m_uiBufferCount(std::max(uiBufferCount, MinBufferCount)) +{ +} + +void TBufferSizes::Clear() +{ + m_uiDefaultSize = BufferGranularity; + m_uiOneDiskSize = BufferGranularity; + m_uiTwoDisksSize = BufferGranularity; + m_uiCDSize = BufferGranularity; + m_uiLANSize = BufferGranularity; + m_bOnlyDefault = false; + m_uiBufferCount = MinBufferCount; +} + +UINT TBufferSizes::GetSizeByType(EBufferType eType) const +{ + switch(eType) + { + case eBuffer_Default: + return m_uiDefaultSize; + case eBuffer_OneDisk: + return m_uiOneDiskSize; + case eBuffer_TwoDisks: + return m_uiTwoDisksSize; + case eBuffer_CD: + return m_uiCDSize; + case eBuffer_LAN: + return m_uiLANSize; + default: + THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + } +} + +void TBufferSizes::SetSizeByType(EBufferType eType, UINT uiSize) +{ + switch(eType) + { + case eBuffer_Default: + m_uiDefaultSize = std::max(BufferGranularity, RoundUp(uiSize, BufferGranularity)); + break; + case eBuffer_OneDisk: + m_uiOneDiskSize = std::max(BufferGranularity, RoundUp(uiSize, BufferGranularity)); + break; + case eBuffer_TwoDisks: + m_uiTwoDisksSize = std::max(BufferGranularity, RoundUp(uiSize, BufferGranularity)); + break; + case eBuffer_CD: + m_uiCDSize = std::max(BufferGranularity, RoundUp(uiSize, BufferGranularity)); + break; + case eBuffer_LAN: + m_uiLANSize = std::max(BufferGranularity, RoundUp(uiSize, BufferGranularity)); + break; + default: + THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + } +} + +void chcore::TBufferSizes::SetDefaultSize(UINT uiSize) +{ + m_uiDefaultSize = std::max(BufferGranularity, RoundUp(uiSize, BufferGranularity)); +} + +void chcore::TBufferSizes::SetOneDiskSize(UINT uiSize) +{ + m_uiOneDiskSize = std::max(BufferGranularity, RoundUp(uiSize, BufferGranularity)); +} + +void chcore::TBufferSizes::SetTwoDisksSize(UINT uiSize) +{ + m_uiTwoDisksSize = std::max(BufferGranularity, RoundUp(uiSize, BufferGranularity)); +} + +void chcore::TBufferSizes::SetCDSize(UINT uiSize) +{ + m_uiCDSize = std::max(BufferGranularity, RoundUp(uiSize, BufferGranularity)); +} + +void chcore::TBufferSizes::SetLANSize(UINT uiSize) +{ + m_uiLANSize = std::max(BufferGranularity, RoundUp(uiSize, BufferGranularity)); +} + +void chcore::TBufferSizes::SetBufferCount(UINT uiBufferCount) +{ + m_uiBufferCount = std::max(uiBufferCount, MinBufferCount); +} + +UINT TBufferSizes::GetMaxSize() const +{ + if(m_bOnlyDefault) + return m_uiDefaultSize; + + return std::max({ m_uiDefaultSize, m_uiOneDiskSize, m_uiTwoDisksSize, m_uiCDSize, m_uiLANSize }); +} + +END_CHCORE_NAMESPACE Index: src/libchcore/TBufferSizes.h =================================================================== diff -u --- src/libchcore/TBufferSizes.h (revision 0) +++ src/libchcore/TBufferSizes.h (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -0,0 +1,86 @@ +/*************************************************************************** +* 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. * +***************************************************************************/ +#ifndef __DATABUFFER_H__ +#define __DATABUFFER_H__ + +#include "libchcore.h" + +BEGIN_CHCORE_NAMESPACE + +class LIBCHCORE_API TBufferSizes +{ +public: + enum EBufferType + { + eBuffer_Default = 0, + eBuffer_OneDisk = 1, + eBuffer_TwoDisks = 2, + eBuffer_CD = 3, + eBuffer_LAN = 4, + + // do not remove this marker + eBuffer_Last + }; + + static const unsigned int BufferGranularity = 4096; + static const unsigned int MinBufferCount = 1; + +public: + TBufferSizes(); + TBufferSizes(bool bOnlyDefault, UINT uiBufferCount, UINT uiDefaultSize, + UINT uiOneDiskSize, UINT uiTwoDisksSize, UINT uiCDSize, UINT uiLANSize); + + void Clear(); + + bool IsOnlyDefault() const { return m_bOnlyDefault; } + UINT GetDefaultSize() const { return m_uiDefaultSize; } + UINT GetOneDiskSize() const { return m_uiOneDiskSize; } + UINT GetTwoDisksSize() const { return m_uiTwoDisksSize; } + UINT GetCDSize() const { return m_uiCDSize; } + UINT GetLANSize() const { return m_uiLANSize; } + + void SetOnlyDefault(bool bOnlyDefault) { m_bOnlyDefault = bOnlyDefault; } + void SetDefaultSize(UINT uiSize); + void SetOneDiskSize(UINT uiSize); + void SetTwoDisksSize(UINT uiSize); + void SetCDSize(UINT uiSize); + void SetLANSize(UINT uiSize); + + UINT GetBufferCount() const { return m_uiBufferCount; } + void SetBufferCount(UINT uiBufferCount); + + UINT GetSizeByType(EBufferType eType) const; + void SetSizeByType(EBufferType eType, UINT uiSize); + + UINT GetMaxSize() const; + +private: + UINT m_uiDefaultSize; + UINT m_uiOneDiskSize; + UINT m_uiTwoDisksSize; + UINT m_uiCDSize; + UINT m_uiLANSize; + + bool m_bOnlyDefault; + UINT m_uiBufferCount; +}; + +END_CHCORE_NAMESPACE + +#endif Index: src/libchcore/TLocalFilesystem.cpp =================================================================== diff -u -re4005a958c9412d890eeff1e8087c8298aa7bcf7 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/libchcore/TLocalFilesystem.cpp (.../TLocalFilesystem.cpp) (revision e4005a958c9412d890eeff1e8087c8298aa7bcf7) +++ src/libchcore/TLocalFilesystem.cpp (.../TLocalFilesystem.cpp) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -26,7 +26,6 @@ #include #include "TAutoHandles.h" #include "TFileInfo.h" -#include "DataBuffer.h" // disable "warning C4201: nonstandard extension used : nameless struct/union" // for standard VS2008 with SDK 6.0A where winioctl.h generates some warnings // converted to errors by the project settings. @@ -41,9 +40,13 @@ #include "TOverlappedDataBuffer.h" #include "RoundingFunctions.h" #include +#include "TBufferSizes.h" BEGIN_CHCORE_NAMESPACE +// compile-time check - ensure the buffer granularity used for transfers are bigger than expected sector size +static_assert(TLocalFilesystemFile::MaxSectorSize <= TBufferSizes::BufferGranularity, "Buffer granularity must be equal to or bigger than the max sector size"); + UINT TLocalFilesystem::GetDriveData(const TSmartPath& spPath) { UINT uiDrvType = DRIVE_UNKNOWN; Index: src/libchcore/TSubTaskCopyMove.cpp =================================================================== diff -u -ref565fe3652e2435fc6c71722ef3dfb4cb3351a0 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision ef565fe3652e2435fc6c71722ef3dfb4cb3351a0) +++ src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -25,7 +25,6 @@ #include "TSubTaskContext.h" #include "TTaskConfiguration.h" #include "TLocalFilesystem.h" -#include "DataBuffer.h" #include "../libicpf/log.h" #include "TTaskLocalStats.h" #include "TTaskConfigTracker.h" @@ -45,6 +44,7 @@ #include "TOverlappedDataBuffer.h" #include "RoundingFunctions.h" #include +#include "TTaskConfigBufferSizes.h" BEGIN_CHCORE_NAMESPACE @@ -119,7 +119,7 @@ ccp.bOnlyCreate = GetTaskPropValue(rConfig); // remove changes in buffer sizes to avoid re-creation later - rCfgTracker.RemoveModificationSet(TOptionsSet() % eTO_DefaultBufferSize % eTO_OneDiskBufferSize % eTO_TwoDisksBufferSize % eTO_CDBufferSize % eTO_LANBufferSize % eTO_UseOnlyDefaultBuffer); + rCfgTracker.RemoveModificationSet(TOptionsSet() % eTO_DefaultBufferSize % eTO_OneDiskBufferSize % eTO_TwoDisksBufferSize % eTO_CDBufferSize % eTO_LANBufferSize % eTO_UseOnlyDefaultBuffer % eTO_BufferQueueDepth); AdjustBufferIfNeeded(ccp.dbBuffer, ccp.tBufferSizes, true); @@ -624,7 +624,7 @@ if(ullSeekTo != 0) // src and dst files exists, requested resume at the specified index { // try to move file pointers to the end - ULONGLONG ullMove = (bNoBuffer ? ROUNDDOWN(ullSeekTo, TLocalFilesystemFile::MaxSectorSize) : ullSeekTo); + ULONGLONG ullMove = (bNoBuffer ? RoundDown(ullSeekTo, TLocalFilesystemFile::MaxSectorSize) : ullSeekTo); eResult = SetFilePointerFB(spFeedbackHandler, fileSrc, ullMove, pData->spSrcFile->GetFullFilePath(), bSkip); if(eResult != TSubTaskBase::eSubResult_Continue) @@ -697,28 +697,24 @@ TTaskConfigTracker& rCfgTracker = GetContext().GetCfgTracker(); icpf::log_file& rLog = GetContext().GetLog(); - if(bForce || (rCfgTracker.IsModified() && rCfgTracker.IsModified(TOptionsSet() % eTO_DefaultBufferSize % eTO_OneDiskBufferSize % eTO_TwoDisksBufferSize % eTO_CDBufferSize % eTO_LANBufferSize % eTO_UseOnlyDefaultBuffer, true))) + if(bForce || (rCfgTracker.IsModified() && rCfgTracker.IsModified(TOptionsSet() % eTO_DefaultBufferSize % eTO_OneDiskBufferSize % eTO_TwoDisksBufferSize % eTO_CDBufferSize % eTO_LANBufferSize % eTO_UseOnlyDefaultBuffer % eTO_BufferQueueDepth, true))) { - rBufferSizes.SetOnlyDefault(GetTaskPropValue(rConfig)); - rBufferSizes.SetDefaultSize(GetTaskPropValue(rConfig)); - rBufferSizes.SetOneDiskSize(GetTaskPropValue(rConfig)); - rBufferSizes.SetTwoDisksSize(GetTaskPropValue(rConfig)); - rBufferSizes.SetCDSize(GetTaskPropValue(rConfig)); - rBufferSizes.SetLANSize(GetTaskPropValue(rConfig)); + rBufferSizes = GetTaskPropBufferSizes(rConfig); // log TString strFormat; - strFormat = _T("Changing buffer size to [Def:%defsize2, One:%onesize2, Two:%twosize2, CD:%cdsize2, LAN:%lansize2]"); + strFormat = _T("Changing buffer size to [Def:%defsize2, One:%onesize2, Two:%twosize2, CD:%cdsize2, LAN:%lansize2, Count:%cnt]"); strFormat.Replace(_T("%defsize2"), boost::lexical_cast(rBufferSizes.GetDefaultSize()).c_str()); strFormat.Replace(_T("%onesize2"), boost::lexical_cast(rBufferSizes.GetOneDiskSize()).c_str()); strFormat.Replace(_T("%twosize2"), boost::lexical_cast(rBufferSizes.GetTwoDisksSize()).c_str()); strFormat.Replace(_T("%cdsize2"), boost::lexical_cast(rBufferSizes.GetCDSize()).c_str()); strFormat.Replace(_T("%lansize2"), boost::lexical_cast(rBufferSizes.GetLANSize()).c_str()); + strFormat.Replace(_T("%cnt"), boost::lexical_cast(rBufferSizes.GetBufferCount()).c_str()); rLog.logi(strFormat.c_str()); - rBuffer.ReinitializeBuffers(GetTaskPropValue(rConfig), rBufferSizes.GetMaxSize()); + rBuffer.ReinitializeBuffers(rBufferSizes.GetBufferCount(), rBufferSizes.GetMaxSize()); return true; // buffer adjusted } Index: src/libchcore/TSubTaskCopyMove.h =================================================================== diff -u -r3c343f2e7aa0d489706136e78f2f56cdd5d417a9 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/libchcore/TSubTaskCopyMove.h (.../TSubTaskCopyMove.h) (revision 3c343f2e7aa0d489706136e78f2f56cdd5d417a9) +++ src/libchcore/TSubTaskCopyMove.h (.../TSubTaskCopyMove.h) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -25,8 +25,8 @@ #include "libchcore.h" #include "TSubTaskBase.h" -#include "DataBuffer.h" #include "CommonDataTypes.h" +#include "TBufferSizes.h" BEGIN_CHCORE_NAMESPACE Index: src/libchcore/TSubTaskDelete.cpp =================================================================== diff -u -r671f4b1792a20d98b186f4e0a9cc6a620dede019 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/libchcore/TSubTaskDelete.cpp (.../TSubTaskDelete.cpp) (revision 671f4b1792a20d98b186f4e0a9cc6a620dede019) +++ src/libchcore/TSubTaskDelete.cpp (.../TSubTaskDelete.cpp) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -32,12 +32,12 @@ #include "TFileInfoArray.h" #include "TFileInfo.h" #include "TTaskLocalStats.h" -#include "DataBuffer.h" #include "TCoreException.h" #include "ErrorCodes.h" #include "TScopedRunningTimeTracker.h" #include "TFeedbackHandlerWrapper.h" #include +#include "TBufferSizes.h" BEGIN_CHCORE_NAMESPACE Index: src/libchcore/TSubTaskFastMove.cpp =================================================================== diff -u -r671f4b1792a20d98b186f4e0a9cc6a620dede019 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/libchcore/TSubTaskFastMove.cpp (.../TSubTaskFastMove.cpp) (revision 671f4b1792a20d98b186f4e0a9cc6a620dede019) +++ src/libchcore/TSubTaskFastMove.cpp (.../TSubTaskFastMove.cpp) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -33,12 +33,12 @@ #include "..\libicpf\log.h" #include "TFileInfo.h" #include -#include "DataBuffer.h" #include "TCoreException.h" #include "ErrorCodes.h" #include "TPathContainer.h" #include "TScopedRunningTimeTracker.h" #include "TFeedbackHandlerWrapper.h" +#include "TBufferSizes.h" BEGIN_CHCORE_NAMESPACE Index: src/libchcore/TSubTaskScanDirectory.cpp =================================================================== diff -u -r671f4b1792a20d98b186f4e0a9cc6a620dede019 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/libchcore/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision 671f4b1792a20d98b186f4e0a9cc6a620dede019) +++ src/libchcore/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -33,12 +33,12 @@ #include "..\libicpf\log.h" #include "TFileInfoArray.h" #include "TFileInfo.h" -#include "DataBuffer.h" #include "TCoreException.h" #include "ErrorCodes.h" #include "TPathContainer.h" #include "TScopedRunningTimeTracker.h" #include "TFeedbackHandlerWrapper.h" +#include "TBufferSizes.h" BEGIN_CHCORE_NAMESPACE Index: src/libchcore/TSubTaskStatsInfo.cpp =================================================================== diff -u -r11b0a299be97bc3afaa633d6522c17b214ba3b79 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/libchcore/TSubTaskStatsInfo.cpp (.../TSubTaskStatsInfo.cpp) (revision 11b0a299be97bc3afaa633d6522c17b214ba3b79) +++ src/libchcore/TSubTaskStatsInfo.cpp (.../TSubTaskStatsInfo.cpp) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -23,7 +23,6 @@ #include "stdafx.h" #include "TSubTaskStatsInfo.h" #include -#include "DataBuffer.h" #include "TSubTaskStatsSnapshot.h" #include "TCoreException.h" #include "ErrorCodes.h" Index: src/libchcore/TSubTaskStatsSnapshot.cpp =================================================================== diff -u -rd76d3ce6c8c55fa23009dbb03b8bc06f482c5b72 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/libchcore/TSubTaskStatsSnapshot.cpp (.../TSubTaskStatsSnapshot.cpp) (revision d76d3ce6c8c55fa23009dbb03b8bc06f482c5b72) +++ src/libchcore/TSubTaskStatsSnapshot.cpp (.../TSubTaskStatsSnapshot.cpp) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -22,9 +22,9 @@ // ============================================================================ #include "stdafx.h" #include "TSubTaskStatsSnapshot.h" -#include "DataBuffer.h" #include #include "MathFunctions.h" +#include "TBufferSizes.h" BEGIN_CHCORE_NAMESPACE Index: src/libchcore/TTask.cpp =================================================================== diff -u -r11b0a299be97bc3afaa633d6522c17b214ba3b79 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/libchcore/TTask.cpp (.../TTask.cpp) (revision 11b0a299be97bc3afaa633d6522c17b214ba3b79) +++ src/libchcore/TTask.cpp (.../TTask.cpp) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -26,7 +26,6 @@ #include #include "../libicpf/exception.h" #include -#include "DataBuffer.h" #include "TFileInfo.h" #include "TSubTaskArray.h" #include "TTaskStatsSnapshot.h" @@ -39,6 +38,7 @@ #include "TScopedRunningTimeTrackerPause.h" #include "TFeedbackHandlerWrapper.h" #include +#include "TTaskConfigBufferSizes.h" BEGIN_CHCORE_NAMESPACE @@ -102,23 +102,14 @@ void TTask::SetBufferSizes(const TBufferSizes& bsSizes) { m_tConfiguration.DelayNotifications(); - SetTaskPropValue(m_tConfiguration, bsSizes.GetDefaultSize()); - SetTaskPropValue(m_tConfiguration, bsSizes.GetOneDiskSize()); - SetTaskPropValue(m_tConfiguration, bsSizes.GetTwoDisksSize()); - SetTaskPropValue(m_tConfiguration, bsSizes.GetCDSize()); - SetTaskPropValue(m_tConfiguration, bsSizes.GetLANSize()); - SetTaskPropValue(m_tConfiguration, bsSizes.IsOnlyDefault()); + + SetTaskPropBufferSizes(m_tConfiguration, bsSizes); m_tConfiguration.ResumeNotifications(); } void TTask::GetBufferSizes(TBufferSizes& bsSizes) { - bsSizes.SetDefaultSize(GetTaskPropValue(m_tConfiguration)); - bsSizes.SetOneDiskSize(GetTaskPropValue(m_tConfiguration)); - bsSizes.SetTwoDisksSize(GetTaskPropValue(m_tConfiguration)); - bsSizes.SetCDSize(GetTaskPropValue(m_tConfiguration)); - bsSizes.SetLANSize(GetTaskPropValue(m_tConfiguration)); - bsSizes.SetOnlyDefault(GetTaskPropValue(m_tConfiguration)); + bsSizes = GetTaskPropBufferSizes(m_tConfiguration); } // thread @@ -346,6 +337,7 @@ spSnapshot->SetIgnoreDirectories(GetTaskPropValue(m_tConfiguration)); spSnapshot->SetCreateEmptyFiles(GetTaskPropValue(m_tConfiguration)); + spSnapshot->SetBufferCount(GetTaskPropValue(m_tConfiguration)); TSubTaskStatsSnapshotPtr spCurrentSubTask = spSnapshot->GetSubTasksStats().GetCurrentSubTaskSnapshot(); Index: src/libchcore/TTaskConfigBufferSizes.cpp =================================================================== diff -u --- src/libchcore/TTaskConfigBufferSizes.cpp (revision 0) +++ src/libchcore/TTaskConfigBufferSizes.cpp (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -0,0 +1,46 @@ +// ============================================================================ +// 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 "TTaskConfigBufferSizes.h" + +BEGIN_CHCORE_NAMESPACE + +TBufferSizes GetTaskPropBufferSizes(const TConfig& rConfig) +{ + return TBufferSizes(GetTaskPropValue(rConfig), + GetTaskPropValue(rConfig), + GetTaskPropValue(rConfig), + GetTaskPropValue(rConfig), + GetTaskPropValue(rConfig), + GetTaskPropValue(rConfig), + GetTaskPropValue(rConfig)); +} + +void SetTaskPropBufferSizes(TConfig& rConfig, const TBufferSizes& rBufferSizes) +{ + SetTaskPropValue(rConfig, rBufferSizes.IsOnlyDefault()); + SetTaskPropValue(rConfig, rBufferSizes.GetBufferCount()); + SetTaskPropValue(rConfig, rBufferSizes.GetDefaultSize()); + SetTaskPropValue(rConfig, rBufferSizes.GetOneDiskSize()); + SetTaskPropValue(rConfig, rBufferSizes.GetTwoDisksSize()); + SetTaskPropValue(rConfig, rBufferSizes.GetCDSize()); + SetTaskPropValue(rConfig, rBufferSizes.GetLANSize()); +} + +END_CHCORE_NAMESPACE Fisheye: tag 6103ac74583f2136b821dc67515ed8469abd8155 is not in file src/libchcore/TTaskConfigBufferSizes.h Index: src/libchcore/TTaskConfiguration.h =================================================================== diff -u -r73d92717b7ba780c7aea1489a5eaa87404afa408 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/libchcore/TTaskConfiguration.h (.../TTaskConfiguration.h) (revision 73d92717b7ba780c7aea1489a5eaa87404afa408) +++ src/libchcore/TTaskConfiguration.h (.../TTaskConfiguration.h) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -25,7 +25,6 @@ #include "libchcore.h" #include "TConfig.h" -#include "TFileFiltersArray.h" BEGIN_CHCORE_NAMESPACE @@ -98,10 +97,10 @@ TASK_PROPERTY_MINMAX(eTO_TwoDisksBufferSize, unsigned int, _T("Buffer.TwoPhysicalDisksSize"), 524288, 1, 0xffffffff); TASK_PROPERTY_MINMAX(eTO_CDBufferSize, unsigned int, _T("Buffer.CDSize"), 262144, 1, 0xffffffff); TASK_PROPERTY_MINMAX(eTO_LANBufferSize, unsigned int, _T("Buffer.LANSize"), 131072, 1, 0xffffffff); +TASK_PROPERTY_MINMAX(eTO_BufferQueueDepth, unsigned int, _T("Buffer.QueueDepth"), 5, 1, 1000); TASK_PROPERTY(eTO_DisableBuffering, bool, _T("Operation.Buffering.DisableBufferingForLargeFiles"), true); TASK_PROPERTY_MINMAX(eTO_DisableBufferingMinSize, int, _T("Operation.Buffering.MinSizeOfFileToDisableBuffering"), 2097152, 1, 0xffffffff); -TASK_PROPERTY_MINMAX(eTO_BufferQueueDepth, unsigned int, _T("Operation.Buffering.BufferQueueDepth"), 2, 1, 100); TASK_PROPERTY(eTO_SetDestinationAttributes, bool, _T("Operation.SetDestinationAttributes"), true); TASK_PROPERTY(eTO_SetDestinationDateTime, bool, _T("Operation.SetDestinationTime"), true); Index: src/libchcore/TTaskLocalStats.cpp =================================================================== diff -u -re92d7e2b63df1305b23aa04132c45ad8747dc22c -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/libchcore/TTaskLocalStats.cpp (.../TTaskLocalStats.cpp) (revision e92d7e2b63df1305b23aa04132c45ad8747dc22c) +++ src/libchcore/TTaskLocalStats.cpp (.../TTaskLocalStats.cpp) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -24,7 +24,6 @@ #include "TTaskLocalStats.h" #include "TSubTaskStatsInfo.h" #include -#include "DataBuffer.h" #include "TTaskStatsSnapshot.h" #include "ISerializerContainer.h" #include "ISerializerRowData.h" Index: src/libchcore/TTaskStatsSnapshot.cpp =================================================================== diff -u -rb1ecc12ba4c1f2a7b4acd6e82fc4193535e55ff0 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/libchcore/TTaskStatsSnapshot.cpp (.../TTaskStatsSnapshot.cpp) (revision b1ecc12ba4c1f2a7b4acd6e82fc4193535e55ff0) +++ src/libchcore/TTaskStatsSnapshot.cpp (.../TTaskStatsSnapshot.cpp) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -49,7 +49,8 @@ m_ullTotalSize(0), m_dTaskCountSpeed(0.0), m_dTaskSizeSpeed(0.0), - m_dCombinedProgress(0.0) + m_dCombinedProgress(0.0), + m_uiBufferCount(0) { } @@ -75,6 +76,7 @@ m_dTaskCountSpeed = 0.0; m_dTaskSizeSpeed = 0.0; m_dCombinedProgress = 0.0; + m_uiBufferCount = 0; } void TTaskStatsSnapshot::CalculateProgressAndSpeeds() const Index: src/libchcore/TTaskStatsSnapshot.h =================================================================== diff -u -rb1ecc12ba4c1f2a7b4acd6e82fc4193535e55ff0 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/libchcore/TTaskStatsSnapshot.h (.../TTaskStatsSnapshot.h) (revision b1ecc12ba4c1f2a7b4acd6e82fc4193535e55ff0) +++ src/libchcore/TTaskStatsSnapshot.h (.../TTaskStatsSnapshot.h) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -99,6 +99,9 @@ void SetCurrentBufferSize(unsigned long long ullSize) { m_ullCurrentBufferSize = ullSize; } unsigned long long GetCurrentBufferSize() const { return m_ullCurrentBufferSize; } + unsigned int GetBufferCount() const { return m_uiBufferCount; } + void SetBufferCount(unsigned int uiBufferCount) { m_uiBufferCount = uiBufferCount; } + private: void CalculateProgressAndSpeeds() const; @@ -118,7 +121,9 @@ EOperationType m_eOperationType; bool m_bIgnoreDirectories; bool m_bCreateEmptyFiles; + unsigned long long m_ullCurrentBufferSize; + unsigned int m_uiBufferCount; // cache for items calculated on-demand mutable bool m_bCacheFilled; Index: src/libchcore/Tests/TestsTBufferSizes.cpp =================================================================== diff -u --- src/libchcore/Tests/TestsTBufferSizes.cpp (revision 0) +++ src/libchcore/Tests/TestsTBufferSizes.cpp (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -0,0 +1,344 @@ +#include "stdafx.h" +#include "gtest/gtest.h" +#include "gmock/gmock.h" +#include "../TBufferSizes.h" +#include "../TCoreException.h" + +using namespace chcore; + +TEST(TestsTBufferSizes, DefaultConstructor) +{ + TBufferSizes tSizes; + + EXPECT_EQ(TBufferSizes::MinBufferCount, tSizes.GetBufferCount()); + EXPECT_EQ(TBufferSizes::BufferGranularity, tSizes.GetDefaultSize()); + EXPECT_EQ(TBufferSizes::BufferGranularity, tSizes.GetOneDiskSize()); + EXPECT_EQ(TBufferSizes::BufferGranularity, tSizes.GetTwoDisksSize()); + EXPECT_EQ(TBufferSizes::BufferGranularity, tSizes.GetCDSize()); + EXPECT_EQ(TBufferSizes::BufferGranularity, tSizes.GetLANSize()); + EXPECT_EQ(false, tSizes.IsOnlyDefault()); +} + +TEST(TestsTBufferSizes, ParametrizedConstructor_RoundedValues) +{ + TBufferSizes tSizes(true, 2, 4096, 8192, 16384, 32768, 65536); + + EXPECT_EQ(2, tSizes.GetBufferCount()); + EXPECT_EQ(4096, tSizes.GetDefaultSize()); + EXPECT_EQ(8192, tSizes.GetOneDiskSize()); + EXPECT_EQ(16384, tSizes.GetTwoDisksSize()); + EXPECT_EQ(32768, tSizes.GetCDSize()); + EXPECT_EQ(65536, tSizes.GetLANSize()); + EXPECT_EQ(true, tSizes.IsOnlyDefault()); +} + +TEST(TestsTBufferSizes, ParametrizedConstructor_MinimumCheck) +{ + TBufferSizes tSizes(true, 0, 0, 0, 0, 0, 0); + + EXPECT_EQ(TBufferSizes::MinBufferCount, tSizes.GetBufferCount()); + EXPECT_EQ(TBufferSizes::BufferGranularity, tSizes.GetDefaultSize()); + EXPECT_EQ(TBufferSizes::BufferGranularity, tSizes.GetOneDiskSize()); + EXPECT_EQ(TBufferSizes::BufferGranularity, tSizes.GetTwoDisksSize()); + EXPECT_EQ(TBufferSizes::BufferGranularity, tSizes.GetCDSize()); + EXPECT_EQ(TBufferSizes::BufferGranularity, tSizes.GetLANSize()); + EXPECT_EQ(true, tSizes.IsOnlyDefault()); +} + +TEST(TestsTBufferSizes, ParametrizedConstructor_RoundingCheck) +{ + TBufferSizes tSizes(true, 2, 6543, 9891, 17123, 37012, 72089); + + EXPECT_EQ(2, tSizes.GetBufferCount()); + EXPECT_EQ(8192, tSizes.GetDefaultSize()); + EXPECT_EQ(12288, tSizes.GetOneDiskSize()); + EXPECT_EQ(20480, tSizes.GetTwoDisksSize()); + EXPECT_EQ(40960, tSizes.GetCDSize()); + EXPECT_EQ(73728, tSizes.GetLANSize()); + EXPECT_EQ(true, tSizes.IsOnlyDefault()); +} + +TEST(TestsTBufferSizes, Clear) +{ + TBufferSizes tSizes(true, 2, 6543, 9891, 17123, 37012, 72089); + + tSizes.Clear(); + + EXPECT_EQ(TBufferSizes::MinBufferCount, tSizes.GetBufferCount()); + EXPECT_EQ(TBufferSizes::BufferGranularity, tSizes.GetDefaultSize()); + EXPECT_EQ(TBufferSizes::BufferGranularity, tSizes.GetOneDiskSize()); + EXPECT_EQ(TBufferSizes::BufferGranularity, tSizes.GetTwoDisksSize()); + EXPECT_EQ(TBufferSizes::BufferGranularity, tSizes.GetCDSize()); + EXPECT_EQ(TBufferSizes::BufferGranularity, tSizes.GetLANSize()); + EXPECT_EQ(false, tSizes.IsOnlyDefault()); +} + +TEST(TestsTBufferSizes, SetOnlyDefault_IsOnlyDefault) +{ + TBufferSizes tSizes; + + tSizes.SetOnlyDefault(true); + + EXPECT_EQ(true, tSizes.IsOnlyDefault()); +} + +//////////////////////////////////////////////////////////////////////// +TEST(TestsTBufferSizes, SetDefaultSize_GetDefaultSize_Rounded) +{ + TBufferSizes tSizes; + + tSizes.SetDefaultSize(8192); + + EXPECT_EQ(8192, tSizes.GetDefaultSize()); +} + +TEST(TestsTBufferSizes, SetDefaultSize_GetDefaultSize_MinCheck) +{ + TBufferSizes tSizes; + + tSizes.SetDefaultSize(1); + + EXPECT_EQ(4096, tSizes.GetDefaultSize()); +} + +TEST(TestsTBufferSizes, SetDefaultSize_GetDefaultSize_RoundCheck) +{ + TBufferSizes tSizes; + + tSizes.SetDefaultSize(8193); + + EXPECT_EQ(12288, tSizes.GetDefaultSize()); +} + +///////////////////////////////////////////////////////////////////////// +TEST(TestsTBufferSizes, SetOneDiskSize_GetOneDiskSize_Rounded) +{ + TBufferSizes tSizes; + + tSizes.SetOneDiskSize(8192); + + EXPECT_EQ(8192, tSizes.GetOneDiskSize()); +} + +TEST(TestsTBufferSizes, SetOneDiskSize_GetOneDiskSize_MinCheck) +{ + TBufferSizes tSizes; + + tSizes.SetOneDiskSize(1); + + EXPECT_EQ(4096, tSizes.GetOneDiskSize()); +} + +TEST(TestsTBufferSizes, SetOneDiskSize_GetOneDiskSize_RoundCheck) +{ + TBufferSizes tSizes; + + tSizes.SetOneDiskSize(8193); + + EXPECT_EQ(12288, tSizes.GetOneDiskSize()); +} + +//////////////////////////////////////////////////////////////////////// +TEST(TestsTBufferSizes, SetTwoDisksSize_GetTwoDisksSize_Rounded) +{ + TBufferSizes tSizes; + + tSizes.SetTwoDisksSize(8192); + + EXPECT_EQ(8192, tSizes.GetTwoDisksSize()); +} + +TEST(TestsTBufferSizes, SetTwoDisksSize_GetTwoDisksSize_MinCheck) +{ + TBufferSizes tSizes; + + tSizes.SetTwoDisksSize(1); + + EXPECT_EQ(4096, tSizes.GetTwoDisksSize()); +} + +TEST(TestsTBufferSizes, SetTwoDisksSize_GetTwoDisksSize_RoundCheck) +{ + TBufferSizes tSizes; + + tSizes.SetTwoDisksSize(8193); + + EXPECT_EQ(12288, tSizes.GetTwoDisksSize()); +} +//////////////////////////////////////////////////////////////////////// +TEST(TestsTBufferSizes, SetCDSize_GetCDSize_Rounded) +{ + TBufferSizes tSizes; + + tSizes.SetCDSize(8192); + + EXPECT_EQ(8192, tSizes.GetCDSize()); +} + +TEST(TestsTBufferSizes, SetCDSize_GetCDSize_MinCheck) +{ + TBufferSizes tSizes; + + tSizes.SetCDSize(1); + + EXPECT_EQ(4096, tSizes.GetCDSize()); +} + +TEST(TestsTBufferSizes, SetCDSize_GetCDSize_RoundCheck) +{ + TBufferSizes tSizes; + + tSizes.SetCDSize(8193); + + EXPECT_EQ(12288, tSizes.GetCDSize()); +} + +//////////////////////////////////////////////////////////////////////// +TEST(TestsTBufferSizes, SetLANSize_GetLANSize_Rounded) +{ + TBufferSizes tSizes; + + tSizes.SetLANSize(8192); + + EXPECT_EQ(8192, tSizes.GetLANSize()); +} + +TEST(TestsTBufferSizes, SetLANSize_GetLANSize_MinCheck) +{ + TBufferSizes tSizes; + + tSizes.SetLANSize(1); + + EXPECT_EQ(4096, tSizes.GetLANSize()); +} + +TEST(TestsTBufferSizes, SetLANSize_GetLANSize_RoundCheck) +{ + TBufferSizes tSizes; + + tSizes.SetLANSize(8193); + + EXPECT_EQ(12288, tSizes.GetLANSize()); +} + +////////////////////////////////////////////////////////////////////// +TEST(TestsTBufferSizes, SetBufferCount_GetBufferCount) +{ + TBufferSizes tSizes; + + tSizes.SetBufferCount(5); + + EXPECT_EQ(5, tSizes.GetBufferCount()); +} + +TEST(TestsTBufferSizes, SetBufferCount_GetBufferCount_MinSize) +{ + TBufferSizes tSizes; + + tSizes.SetBufferCount(0); + + EXPECT_EQ(1, tSizes.GetBufferCount()); +} + +//////////////////////////////////////////////////////////////////// +TEST(TestsTBufferSizes, SetSizeByType_GetSizeByType_RoundedSize) +{ + TBufferSizes tSizes; + + tSizes.SetSizeByType(TBufferSizes::eBuffer_Default, 8192); + tSizes.SetSizeByType(TBufferSizes::eBuffer_OneDisk, 16384); + tSizes.SetSizeByType(TBufferSizes::eBuffer_TwoDisks, 32768); + tSizes.SetSizeByType(TBufferSizes::eBuffer_CD, 65536); + tSizes.SetSizeByType(TBufferSizes::eBuffer_LAN, 131072); + + EXPECT_EQ(8192, tSizes.GetSizeByType(TBufferSizes::eBuffer_Default)); + EXPECT_EQ(16384, tSizes.GetSizeByType(TBufferSizes::eBuffer_OneDisk)); + EXPECT_EQ(32768, tSizes.GetSizeByType(TBufferSizes::eBuffer_TwoDisks)); + EXPECT_EQ(65536, tSizes.GetSizeByType(TBufferSizes::eBuffer_CD)); + EXPECT_EQ(131072, tSizes.GetSizeByType(TBufferSizes::eBuffer_LAN)); +} + +TEST(TestsTBufferSizes, SetSizeByType_GetSizeByType_RoundCheck) +{ + TBufferSizes tSizes; + + tSizes.SetSizeByType(TBufferSizes::eBuffer_Default, 8190); + tSizes.SetSizeByType(TBufferSizes::eBuffer_OneDisk, 16380); + tSizes.SetSizeByType(TBufferSizes::eBuffer_TwoDisks, 32760); + tSizes.SetSizeByType(TBufferSizes::eBuffer_CD, 65530); + tSizes.SetSizeByType(TBufferSizes::eBuffer_LAN, 131070); + + EXPECT_EQ(8192, tSizes.GetSizeByType(TBufferSizes::eBuffer_Default)); + EXPECT_EQ(16384, tSizes.GetSizeByType(TBufferSizes::eBuffer_OneDisk)); + EXPECT_EQ(32768, tSizes.GetSizeByType(TBufferSizes::eBuffer_TwoDisks)); + EXPECT_EQ(65536, tSizes.GetSizeByType(TBufferSizes::eBuffer_CD)); + EXPECT_EQ(131072, tSizes.GetSizeByType(TBufferSizes::eBuffer_LAN)); +} + +TEST(TestsTBufferSizes, SetSizeByType_GetSizeByType_MinSize) +{ + TBufferSizes tSizes; + + tSizes.SetSizeByType(TBufferSizes::eBuffer_Default, 0); + tSizes.SetSizeByType(TBufferSizes::eBuffer_OneDisk, 0); + tSizes.SetSizeByType(TBufferSizes::eBuffer_TwoDisks, 0); + tSizes.SetSizeByType(TBufferSizes::eBuffer_CD, 0); + tSizes.SetSizeByType(TBufferSizes::eBuffer_LAN, 0); + + EXPECT_EQ(4096, tSizes.GetSizeByType(TBufferSizes::eBuffer_Default)); + EXPECT_EQ(4096, tSizes.GetSizeByType(TBufferSizes::eBuffer_OneDisk)); + EXPECT_EQ(4096, tSizes.GetSizeByType(TBufferSizes::eBuffer_TwoDisks)); + EXPECT_EQ(4096, tSizes.GetSizeByType(TBufferSizes::eBuffer_CD)); + EXPECT_EQ(4096, tSizes.GetSizeByType(TBufferSizes::eBuffer_LAN)); +} + +TEST(TestsTBufferSizes, SetSizeByType_GetSizeByType_OutOfRange) +{ + TBufferSizes tSizes; + + EXPECT_THROW(tSizes.SetSizeByType(TBufferSizes::eBuffer_Last, 0), TCoreException); + EXPECT_THROW(tSizes.GetSizeByType(TBufferSizes::eBuffer_Last), TCoreException); +} + +//////////////////////////////////////////////////////////////////////////////////////////////// +TEST(TestsTBufferSizes, GetMaxSize_Default) +{ + TBufferSizes tSizes(false, 1, 16384, 0, 0, 0, 0); + + EXPECT_EQ(16384, tSizes.GetMaxSize()); +} + +TEST(TestsTBufferSizes, GetMaxSize_OneDisk) +{ + TBufferSizes tSizes(false, 1, 0, 16384, 0, 0, 0); + + EXPECT_EQ(16384, tSizes.GetMaxSize()); +} + +TEST(TestsTBufferSizes, GetMaxSize_TwoDisks) +{ + TBufferSizes tSizes(false, 1, 0, 0, 16384, 0, 0); + + EXPECT_EQ(16384, tSizes.GetMaxSize()); +} + +TEST(TestsTBufferSizes, GetMaxSize_CD) +{ + TBufferSizes tSizes(false, 1, 0, 0, 0, 16384, 0); + + EXPECT_EQ(16384, tSizes.GetMaxSize()); +} + +TEST(TestsTBufferSizes, GetMaxSize_LAN) +{ + TBufferSizes tSizes(false, 1, 0, 0, 0, 0, 16384); + + EXPECT_EQ(16384, tSizes.GetMaxSize()); +} + +TEST(TestsTBufferSizes, GetMaxSize_OnlyDefault) +{ + TBufferSizes tSizes(true, 1, 16384, 0, 0, 0, 32768); + + EXPECT_EQ(16384, tSizes.GetMaxSize()); +} Index: src/libchcore/libchcore.vc120.vcxproj =================================================================== diff -u -re4005a958c9412d890eeff1e8087c8298aa7bcf7 -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/libchcore/libchcore.vc120.vcxproj (.../libchcore.vc120.vcxproj) (revision e4005a958c9412d890eeff1e8087c8298aa7bcf7) +++ src/libchcore/libchcore.vc120.vcxproj (.../libchcore.vc120.vcxproj) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -571,14 +571,15 @@ + - + @@ -639,6 +640,12 @@ + + true + true + true + true + true true @@ -740,13 +747,14 @@ + - + Index: src/libchcore/libchcore.vc120.vcxproj.filters =================================================================== diff -u -refe016ef1d0cb0cf1ba379dbe3693e35f6a2361e -rcdc76e1a95383dff63a5254aeb8d37035028512c --- src/libchcore/libchcore.vc120.vcxproj.filters (.../libchcore.vc120.vcxproj.filters) (revision efe016ef1d0cb0cf1ba379dbe3693e35f6a2361e) +++ src/libchcore/libchcore.vc120.vcxproj.filters (.../libchcore.vc120.vcxproj.filters) (revision cdc76e1a95383dff63a5254aeb8d37035028512c) @@ -60,12 +60,15 @@ {30d60be9-a936-4191-a66d-64e127f3d258} - - {202d13d3-126b-4811-8c1c-a14b4f0476b7} - {49c9ae7e-1bc4-4875-8512-e92e0c00fb19} + + {02c88ac8-15f7-4372-9f47-247ecbada7db} + + + {202d13d3-126b-4811-8c1c-a14b4f0476b7} + @@ -98,12 +101,6 @@ Source Files\Task - - Source Files\Task - - - Source Files\Task - Source Files\Task @@ -116,9 +113,6 @@ Source Files\Task Manager - - Source Files\Tools - Source Files\Tools @@ -354,13 +348,13 @@ Source Files\Tools - Source Files\Tools\OverlappedBuffer + Source Files\Tools\Data Buffer - Source Files\Tools\OverlappedBuffer + Source Files\Tools\Data Buffer - Source Files\Tools\OverlappedBuffer + Source Files\Tools\Data Buffer Source Files\Tools @@ -371,6 +365,18 @@ Source Files\Tools\DebugTrace + + Source Files\Task Config + + + Source Files\Task Config + + + Source Files\Task Config + + + Source Files\Tools\Data Buffer + @@ -400,9 +406,6 @@ Source Files\Task - - Source Files\Task - Source Files\Task @@ -415,9 +418,6 @@ Source Files\Task Manager - - Source Files\Tools - Source Files\Tools @@ -659,13 +659,13 @@ Source Files\Tools - Source Files\Tools\OverlappedBuffer + Source Files\Tools\Data Buffer - Source Files\Tools\OverlappedBuffer + Source Files\Tools\Data Buffer - Source Files\Tools\OverlappedBuffer + Source Files\Tools\Data Buffer Source Files\Tools @@ -676,5 +676,17 @@ Tests + + Source Files\Task Config + + + Source Files\Task Config + + + Tests + + + Source Files\Tools\Data Buffer + \ No newline at end of file