From a306892509a50d9296edbf7d39ba13a1e4f812f1 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 7 Aug 2010 20:34:54 -0400 Subject: [PATCH] Code Cleanup - Removed unreachable code from Table::sort_compare. --- src/Table.cpp | 45 +++++++++++++-------------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/src/Table.cpp b/src/Table.cpp index 1a8c73b98..519225f92 100644 --- a/src/Table.cpp +++ b/src/Table.cpp @@ -612,43 +612,24 @@ bool sort_compare (int left, int right) if (cell_left && cell_right && *cell_left == *cell_right) continue; + // Note: Table::ascendingDueDate is not represented here because it is not + // possible to have a NULL due date, only a blank "". + // nothing < something. if (cell_left == NULL && cell_right != NULL) - { - if (sort_type == Table::ascendingDueDate) - return true; - - else if (sort_type == Table::descendingDueDate) - return false; - - else if (sort_type == Table::ascendingNumeric || - sort_type == Table::ascendingCharacter || - sort_type == Table::ascendingPriority || - sort_type == Table::ascendingDate || - sort_type == Table::ascendingPeriod) - return true; - - return false; - } + return (sort_type == Table::ascendingNumeric || + sort_type == Table::ascendingCharacter || + sort_type == Table::ascendingPriority || + sort_type == Table::ascendingDate || + sort_type == Table::ascendingPeriod) ? true : false; // something > nothing. if (cell_left != NULL && cell_right == NULL) - { - if (sort_type == Table::ascendingDueDate) - return false; - - else if (sort_type == Table::descendingDueDate) - return true; - - else if (sort_type == Table::ascendingNumeric || - sort_type == Table::ascendingCharacter || - sort_type == Table::ascendingPriority || - sort_type == Table::ascendingDate || - sort_type == Table::ascendingPeriod) - return false; - - return true; - } + return (sort_type == Table::ascendingNumeric || + sort_type == Table::ascendingCharacter || + sort_type == Table::ascendingPriority || + sort_type == Table::ascendingDate || + sort_type == Table::ascendingPeriod) ? false : true; // Differing data - do a proper comparison. if (cell_left && cell_right)