lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master ddc7b2d 4/4: Prefer 'if(' to 'if ('


From: Greg Chicares
Subject: [lmi-commits] [lmi] master ddc7b2d 4/4: Prefer 'if(' to 'if ('
Date: Thu, 9 Aug 2018 11:26:00 -0400 (EDT)

branch: master
commit ddc7b2d9ccf691fbcf48f9083144f1b833b1ab3f
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Prefer 'if(' to 'if ('
---
 ledger_pdf_generator_wx.cpp  |  8 ++++----
 main_wx_test.cpp             | 18 +++++++++---------
 rate_table.cpp               |  4 ++--
 single_choice_popup_menu.cpp |  2 +-
 skeleton.cpp                 |  2 +-
 stl_extensions.hpp           |  6 +++---
 wx_test_config_settings.cpp  |  6 +++---
 wx_test_create_open.cpp      |  4 ++--
 wx_test_default_update.cpp   |  2 +-
 9 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index e224ad4..583ca30 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -568,7 +568,7 @@ TAG_HANDLER_BEGIN(scaled_image, "IMG")
     TAG_HANDLER_PROC(tag)
     {
         wxString src;
-        if (!tag.GetParamAsString("SRC", &src))
+        if(!tag.GetParamAsString("SRC", &src))
             {
             throw std::runtime_error
                 ("missing mandatory \"src\" attribute of \"img\" tag"
@@ -586,10 +586,10 @@ TAG_HANDLER_BEGIN(scaled_image, "IMG")
         // could use separate "numerator" and "denominator" attributes. But for
         // now implement just the bare minimum of what we need.
         wxString inv_factor_str;
-        if (tag.GetParamAsString("INV_FACTOR", &inv_factor_str))
+        if(tag.GetParamAsString("INV_FACTOR", &inv_factor_str))
             {
             double inv_factor = 0.0;
-            if (!inv_factor_str.ToCDouble(&inv_factor) || inv_factor == 0.0)
+            if(!inv_factor_str.ToCDouble(&inv_factor) || inv_factor == 0.0)
                 {
                 throw std::runtime_error
                     ( "invalid value for \"inv_factor\" attribute of "
@@ -603,7 +603,7 @@ TAG_HANDLER_BEGIN(scaled_image, "IMG")
             }
 
         wxImage image(load_image(src.c_str()));
-        if (image.IsOk())
+        if(image.IsOk())
             {
             m_WParser->GetContainer()->InsertCell
                 (new scaled_image_cell(image, src, scale_factor)
diff --git a/main_wx_test.cpp b/main_wx_test.cpp
index ebbd00e..4ea8b9e 100644
--- a/main_wx_test.cpp
+++ b/main_wx_test.cpp
@@ -244,7 +244,7 @@ void application_test::process_test_name(char const* name)
     // A test can be specified either as "test" to run it, or "-test" to avoid
     // running it, check which one have we got.
     test_run run;
-    if (name[0] == '-')
+    if(name[0] == '-')
         {
         run = run_no;
         ++name; // Skip the leading minus sign.
@@ -268,7 +268,7 @@ void application_test::process_test_name(char const* name)
             }
         }
 
-    if (!any_tests_matched)
+    if(!any_tests_matched)
         {
         warning()
             << "Test specification '"
@@ -309,7 +309,7 @@ bool application_test::process_command_line(int& argc, 
char* argv[])
         {
         char const* const arg = argv[n];
 
-        if (last_test_option)
+        if(last_test_option)
             {
             last_test_option = nullptr;
             process_test_name(arg);
@@ -339,13 +339,13 @@ bool application_test::process_command_line(int& argc, 
char* argv[])
             }
         else if(0 == std::strncmp(arg, opt_gui_test_path, 
opt_gui_test_path_length))
             {
-            if (arg[opt_gui_test_path_length]=='=')
+            if(arg[opt_gui_test_path_length]=='=')
                 {
                 test_files_path_ = arg + opt_gui_test_path_length + 1;
                 }
             else
                 {
-                if (n == argc - 1)
+                if(n == argc - 1)
                     {
                     warning()
                         << "Option '"
@@ -395,7 +395,7 @@ bool application_test::process_command_line(int& argc, 
char* argv[])
             }
         }
 
-    if (last_test_option)
+    if(last_test_option)
         {
         warning()
             << "Option '"
@@ -413,7 +413,7 @@ bool application_test::process_command_line(int& argc, 
char* argv[])
         test_files_path_ = "/opt/lmi/gui_test";
         }
 
-    if (!fs::exists(test_files_path_))
+    if(!fs::exists(test_files_path_))
         {
         warning()
             << "Test files path '"
@@ -442,7 +442,7 @@ TestsResults application_test::run()
 
     for(auto const& i : tests_)
         {
-        if ((run_all_ && i.run != run_no) || i.run == run_yes)
+        if((run_all_ && i.run != run_no) || i.run == run_yes)
             {
             std::string error;
             ++results.total;
@@ -475,7 +475,7 @@ TestsResults application_test::run()
                 error = "unknown exception";
                 }
 
-            if (!error.empty())
+            if(!error.empty())
                 {
                 ++results.failed;
 
diff --git a/rate_table.cpp b/rate_table.cpp
index 2d7d04d..94d7e52 100644
--- a/rate_table.cpp
+++ b/rate_table.cpp
@@ -1413,7 +1413,7 @@ void table_impl::parse_select_header(std::istream& is, 
int& line_num) const
                 ;
             }
 
-        if (actual == *select_period_)
+        if(actual == *select_period_)
             {
             break;
             }
@@ -2044,7 +2044,7 @@ void table_impl::read_from_text(std::istream& is)
             }
 
         auto const fv = parse_field_and_value(line, line_num, number_);
-        if (fv)
+        if(fv)
             {
             // Just to avoid using "fv->" everywhere.
             auto const field = fv->field;
diff --git a/single_choice_popup_menu.cpp b/single_choice_popup_menu.cpp
index 2c17f7f..4fba416 100644
--- a/single_choice_popup_menu.cpp
+++ b/single_choice_popup_menu.cpp
@@ -55,7 +55,7 @@ int SingleChoicePopupMenu::Choose()
 {
     int const selection_index = parent_.GetPopupMenuSelectionFromUser(menu_);
 
-    if (wxEventLoopBase* const loop = wxEventLoopBase::GetActive())
+    if(wxEventLoopBase* const loop = wxEventLoopBase::GetActive())
         {
         // This function can often be used to get users choice before starting
         // some time-consuming operation. Ensure that the area previously
diff --git a/skeleton.cpp b/skeleton.cpp
index 17658f6..94b3d6e 100644
--- a/skeleton.cpp
+++ b/skeleton.cpp
@@ -1338,7 +1338,7 @@ bool Skeleton::ProcessCommandLine()
         return false;
         }
 
-    if (!input_files.empty())
+    if(!input_files.empty())
         {
         // Can't open files until main window is initialized.
         CallAfter(&Skeleton::OpenCommandLineFiles, input_files);
diff --git a/stl_extensions.hpp b/stl_extensions.hpp
index 1d40af2..ac171f1 100644
--- a/stl_extensions.hpp
+++ b/stl_extensions.hpp
@@ -81,11 +81,11 @@ template <typename T> inline T 
identity_element(std::multiplies<T>)
 template <typename T, typename Integer, typename MonoidOperation>
 T power(T x, Integer n, MonoidOperation opr)
 {
-    if (n < 0)
+    if(n < 0)
         {
         throw std::logic_error("power() called with negative exponent.");
         }
-    if (n == 0)
+    if(n == 0)
         {
         return identity_element(opr);
         }
@@ -101,7 +101,7 @@ T power(T x, Integer n, MonoidOperation opr)
         while (n != 0)
             {
             x = opr(x, x);
-            if ((n & 1) != 0)
+            if((n & 1) != 0)
                 result = opr(result, x);
             n >>= 1;
             }
diff --git a/wx_test_config_settings.cpp b/wx_test_config_settings.cpp
index 6063cdf..2020cf2 100644
--- a/wx_test_config_settings.cpp
+++ b/wx_test_config_settings.cpp
@@ -94,15 +94,15 @@ LMI_WX_TEST_CASE(configurable_settings)
         || "skin_single_premium.xrc" == skin
         ,"unknown skin " << skin
         );
-    if ("skin_coli_boli.xrc" == skin)
+    if("skin_coli_boli.xrc" == skin)
         {
         LMI_ASSERT_EQUAL(default_input, "c:/fop-0.20.5/coli_boli_default.ill");
         }
-    if ("skin_group_carveout.xrc" == skin)
+    if("skin_group_carveout.xrc" == skin)
         {
         LMI_ASSERT_EQUAL(default_input, 
"c:/fop-0.20.5/group_carveout_default.ill");
         }
-    if ("skin_single_premium.xrc" == skin)
+    if("skin_single_premium.xrc" == skin)
         {
         LMI_ASSERT_EQUAL(default_input, "c:/fop-0.20.5/default.ill");
         }
diff --git a/wx_test_create_open.cpp b/wx_test_create_open.cpp
index 3131ddc..b29af1d 100644
--- a/wx_test_create_open.cpp
+++ b/wx_test_create_open.cpp
@@ -58,7 +58,7 @@ void do_test_create_open
     wxUIActionSimulator z;
     z.Char('n', wxMOD_CONTROL); // new file
     z.Char(key               ); // choose document type
-    if (uses_dialog)
+    if(uses_dialog)
         {
         wxTEST_DIALOG
             (wxYield()
@@ -82,7 +82,7 @@ void do_test_create_open
 
     z.Char('o', wxMOD_CONTROL); // and open it again
 
-    if (uses_dialog)
+    if(uses_dialog)
         {
         wxTEST_DIALOG
             (wxYield()
diff --git a/wx_test_default_update.cpp b/wx_test_default_update.cpp
index b2eb25d..49cf59f 100644
--- a/wx_test_default_update.cpp
+++ b/wx_test_default_update.cpp
@@ -78,7 +78,7 @@ LMI_WX_TEST_CASE(default_update)
                 ,"UseDOB"
                 );
 
-            if (!dob_window->IsEnabled())
+            if(!dob_window->IsEnabled())
                 {
                 ToggleUseDOB(usedob_window);
                 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]