Skip to content

Commit

Permalink
fixed a few annoying issues, killed some globals
Browse files Browse the repository at this point in the history
"inexplicable crashes" on Win 7 due to my idiot self NOT using the `if`
statement that I needed,
  • Loading branch information
ariccio committed Feb 15, 2015
1 parent 836dfe6 commit 38470d2
Show file tree
Hide file tree
Showing 32 changed files with 1,362 additions and 916 deletions.
15 changes: 15 additions & 0 deletions WinDirStat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ Major features:

This is a Microsoft Visual Studio 2013 Project.

=============================================================================
# A few notes on style

I have some (admittedly weird) style preferences, so I'll try to document them.

1. I use [Ratliff-style indentation](http://en.wikipedia.org/wiki/Indent_style#Ratliff_style).
- I find it much easier to spot weird scope issues.
- I find it much easier to quickly skim code, all the while comprehending control-flow.
2. I never throw exceptions.
3. I never catch exceptions.
4. I compile with exceptions **disabled**.
- Don't get me wrong, exceptions are a great feature of C++, but (sadly) they currently add too much bloat to code.
- Exceptions theoretically can *improve* performance, but that's not the case just quite yet.
- When Visual Studio supports `noexcept`, I'll reconsider.
5. I *ALWAYS* use braces in an `if`/`else` statement.
=============================================================================
How to create a resource dll.
* **Don't**, this isn't a solved problem yet.
Expand Down
Binary file modified WinDirStat/altWinDirStat.smproj
Binary file not shown.
3 changes: 2 additions & 1 deletion WinDirStat/windirstat/PageGeneral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ BOOL CPageGeneral::OnInitDialog( ) {

void CPageGeneral::OnOK( ) {
VERIFY( UpdateData( ) );
ASSERT( m_appptr != NULL );
const auto Options = GetOptions( );
//Compare with TRUE to prevent int->bool coercion
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->SetHumanFormat ( ( ( m_humanFormat == TRUE ) ? true : false ), m_appptr );
Options->SetListGrid ( ( ( m_listGrid == TRUE ) ? true : false ) );
Options->SetListStripes ( ( ( m_listStripes == TRUE ) ? true : false ) );
Options->SetListFullRowSelection( ( ( m_listFullRowSelection == TRUE ) ? true : false ) );
Expand Down
8 changes: 3 additions & 5 deletions WinDirStat/windirstat/PageGeneral.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
#pragma once

#include "stdafx.h"
#include "windirstat.h"

#ifndef WDS_PAGEGENERAL_H
#define WDS_PAGEGENERAL_H





class COptionsPropertySheet;
class CPageGeneral;

Expand All @@ -28,7 +26,7 @@ class CPageGeneral final : public CPropertyPage {
CPageGeneral& operator=( const CPageGeneral& in ) = delete;
CPageGeneral( const CPageGeneral& in ) = delete;

CPageGeneral( ) : CPropertyPage( CPageGeneral::IDD ), m_followMountPoints( FALSE ), m_followJunctionPoints( FALSE ), m_humanFormat( FALSE ), m_listGrid( FALSE ), m_listStripes( FALSE ), m_listFullRowSelection( FALSE ), m_showTimeSpent( FALSE ) { }
CPageGeneral( CDirstatApp* app ) : CPropertyPage( CPageGeneral::IDD ), m_followMountPoints( FALSE ), m_followJunctionPoints( FALSE ), m_humanFormat( FALSE ), m_listGrid( FALSE ), m_listStripes( FALSE ), m_listFullRowSelection( FALSE ), m_showTimeSpent( FALSE ), m_appptr( app ) { }

protected:

Expand Down Expand Up @@ -59,7 +57,7 @@ class CPageGeneral final : public CPropertyPage {

CButton m_ctlFollowMountPoints;
CButton m_ctlFollowJunctionPoints;

CDirstatApp* m_appptr;
DECLARE_MESSAGE_MAP()
afx_msg void OnBnClickedAnyOption( ) {
SetModified( );
Expand Down
2 changes: 2 additions & 0 deletions WinDirStat/windirstat/PageTreemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
//
//CTreemap::Options;

class CDirstatApp;

class CPageTreemap final : public CPropertyPage {
DECLARE_DYNAMIC(CPageTreemap)
enum {
Expand Down
Loading

0 comments on commit 38470d2

Please sign in to comment.