Skip to content

Commit

Permalink
hopefully fixed issue #3
Browse files Browse the repository at this point in the history
In issue #3, GetDateFormat was bitching mysteriously. Of course, the
default windows error message was useless.

So I went ahead and added a crapload of diagnostics & error reporting to
clarify what's going on.

I also refactored some arrow code, here and there.
  • Loading branch information
ariccio committed Feb 8, 2015
1 parent 0553682 commit 85e3ac6
Show file tree
Hide file tree
Showing 16 changed files with 538 additions and 374 deletions.
27 changes: 13 additions & 14 deletions WinDirStat/windirstat/PageGeneral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ _Must_inspect_result_ COptionsPropertySheet* CPageGeneral::GetSheet( ) {
}

BEGIN_MESSAGE_MAP(CPageGeneral, CPropertyPage)
ON_BN_CLICKED(IDC_HUMANFORMAT, &( CPageGeneral::OnBnClickedAnyOption ) )
ON_BN_CLICKED(IDC_HUMANFORMAT, &( CPageGeneral::OnBnClickedAnyOption ) )
ON_BN_CLICKED(IDC_FOLLOWMOUNTPOINTS, &( CPageGeneral::OnBnClickedAnyOption ) )
ON_BN_CLICKED(IDC_FOLLOWJUNCTIONS, &( CPageGeneral::OnBnClickedAnyOption ) )
ON_BN_CLICKED(IDC_SHOWGRID, &( CPageGeneral::OnBnClickedAnyOption ) )
ON_BN_CLICKED(IDC_SHOWSTRIPES, &( CPageGeneral::OnBnClickedAnyOption ) )
ON_BN_CLICKED(IDC_FULLROWSELECTION, &( CPageGeneral::OnBnClickedAnyOption ) )
ON_BN_CLICKED(IDC_SHOWTIMESPENT, &( CPageGeneral::OnBnClickedAnyOption ) )
ON_BN_CLICKED(IDC_FOLLOWJUNCTIONS, &( CPageGeneral::OnBnClickedAnyOption ) )
ON_BN_CLICKED(IDC_SHOWGRID, &( CPageGeneral::OnBnClickedAnyOption ) )
ON_BN_CLICKED(IDC_SHOWSTRIPES, &( CPageGeneral::OnBnClickedAnyOption ) )
ON_BN_CLICKED(IDC_FULLROWSELECTION, &( CPageGeneral::OnBnClickedAnyOption ) )
ON_BN_CLICKED(IDC_SHOWTIMESPENT, &( CPageGeneral::OnBnClickedAnyOption ) )
END_MESSAGE_MAP()


Expand Down Expand Up @@ -62,14 +62,13 @@ void CPageGeneral::OnOK( ) {
VERIFY( UpdateData( ) );
const auto Options = GetOptions( );
//Compare with TRUE to prevent int->bool coercion
Options->SetHumanFormat ( ( ( m_humanFormat == TRUE ) ? true : false ) );
Options->m_followMountPoints = ( ( m_followMountPoints == TRUE ) ? true : false );
Options->m_followJunctionPoints = ( ( m_followJunctionPoints == TRUE ) ? true : false );
Options->SetListGrid ( ( ( m_listGrid == TRUE ) ? true : false ) );
Options->SetListStripes ( ( ( m_listStripes == TRUE ) ? true : false ) );
Options->SetListFullRowSelection ( ( ( m_listFullRowSelection == TRUE ) ? true : false ) );
Options->m_showTimeSpent = ( ( m_showTimeSpent == TRUE ) ? true : false );

Options->m_followMountPoints = ( ( m_followMountPoints == TRUE ) ? true : false );
Options->m_followJunctionPoints = ( ( m_followJunctionPoints == TRUE ) ? true : false );
Options->m_showTimeSpent = ( ( m_showTimeSpent == TRUE ) ? true : false );
Options->SetHumanFormat ( ( ( m_humanFormat == TRUE ) ? true : false ) );
Options->SetListGrid ( ( ( m_listGrid == TRUE ) ? true : false ) );
Options->SetListStripes ( ( ( m_listStripes == TRUE ) ? true : false ) );
Options->SetListFullRowSelection( ( ( m_listFullRowSelection == TRUE ) ? true : false ) );
CPropertyPage::OnOK( );
}

Expand Down
4 changes: 2 additions & 2 deletions WinDirStat/windirstat/SelectDrivesDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ INT CDriveItem::Compare( _In_ const COwnerDrawnListItem* const baseOther, RANGE_
}

_Must_inspect_result_ _Success_( SUCCEEDED( return ) )
HRESULT CDriveItem::Text_WriteToStackBuffer( RANGE_ENUM_COL const column::ENUM_COL subitem, WDS_WRITES_TO_STACK( strSize, chars_written ) PWSTR psz_text, _In_ const rsize_t strSize, _Out_ _On_failure_( _Post_valid_ ) rsize_t& sizeBuffNeed, _Out_ rsize_t& chars_written ) const {
HRESULT CDriveItem::Text_WriteToStackBuffer( RANGE_ENUM_COL const column::ENUM_COL subitem, WDS_WRITES_TO_STACK( strSize, chars_written ) PWSTR psz_text, _In_ const rsize_t strSize, _On_failure_( _Post_valid_ ) rsize_t& sizeBuffNeed, _Out_ rsize_t& chars_written ) const {
switch ( subitem )
{
case column::COL_TOTAL:
case column::COL_FREE:
//return Text_WriteToStackBuffer_COL_TOTAL( subitem, psz_text, strSize, sizeBuffNeed, chars_written );
return wds_fmt::FormatBytes( ( ( subitem == column::COL_TOTAL ) ? m_totalBytes : m_freeBytes ), psz_text, strSize, chars_written );
return wds_fmt::FormatBytes( ( ( subitem == column::COL_TOTAL ) ? m_totalBytes : m_freeBytes ), psz_text, strSize, chars_written, sizeBuffNeed );
case column::COL_NAME:
case column::COL_ITEMS:
case column::COL_BYTESPERCENT:
Expand Down
2 changes: 1 addition & 1 deletion WinDirStat/windirstat/SelectDrivesDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class CDriveItem final : public COwnerDrawnListItem {
}

_Must_inspect_result_ _Success_( SUCCEEDED( return ) )
virtual HRESULT Text_WriteToStackBuffer( RANGE_ENUM_COL const column::ENUM_COL subitem, WDS_WRITES_TO_STACK( strSize, chars_written ) PWSTR psz_text, _In_ const rsize_t strSize, _Out_ _On_failure_( _Post_valid_ ) rsize_t& sizeBuffNeed, _Out_ rsize_t& chars_written ) const override final;
virtual HRESULT Text_WriteToStackBuffer( RANGE_ENUM_COL const column::ENUM_COL subitem, WDS_WRITES_TO_STACK( strSize, chars_written ) PWSTR psz_text, _In_ const rsize_t strSize, _On_failure_( _Post_valid_ ) rsize_t& sizeBuffNeed, _Out_ rsize_t& chars_written ) const override final;

public:
const std::wstring m_path; // e.g. "C:\"
Expand Down
2 changes: 2 additions & 0 deletions WinDirStat/windirstat/datastructures.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ namespace global_strings {
_Null_terminated_ const wchar_t get_date_format_param_err[ ] = { L"Any of the parameter values ( for GetDateFormatW ) was invalid." };
_Null_terminated_ const wchar_t get_time_format_param_err[ ] = { L"Any of the parameter values ( for GetTimeFormatW ) was invalid." };

_Null_terminated_ const wchar_t get_time_format_err_OUTOFMEMORY[ ] = { L"GetTimeFormatW failed because not enough memory was available to complete this operation! (unrecoverable)" };

_Null_terminated_ const wchar_t write_to_stackbuffer_file[ ] = { L"Not implemented yet. Try normal GetText." };

_Null_terminated_ const wchar_t global_alloc_failed[ ] = { L"GlobalAlloc failed! Cannot copy to clipboard!" };
Expand Down
Loading

0 comments on commit 85e3ac6

Please sign in to comment.