[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 8c70624 2/2: Expunge unwanted whitespace
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 8c70624 2/2: Expunge unwanted whitespace |
Date: |
Fri, 27 Jan 2017 00:32:08 +0000 (UTC) |
branch: master
commit 8c70624cb1447292ef2b003c2aa1afc77de1715f
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Expunge unwanted whitespace
:vim 'for(' didn't find
all for-statements, impeding
modernization
when I see for (
I reach for my delete key
git -w shows no change
all that whitespace died
it confused me--but now I've
learned vim's \k char class
---
docmanager_ex.cpp | 20 ++--
getopt.cpp | 298 +++++++++++++++++++++++-----------------------
getopt.hpp | 32 ++---
input_sequence_entry.cpp | 4 +-
main_wx_test.cpp | 24 ++--
multidimgrid_any.cpp | 2 +-
round_test.cpp | 4 +-
round_to_test.cpp | 4 +-
8 files changed, 194 insertions(+), 194 deletions(-)
diff --git a/docmanager_ex.cpp b/docmanager_ex.cpp
index cf8e904..8cf008f 100644
--- a/docmanager_ex.cpp
+++ b/docmanager_ex.cpp
@@ -215,22 +215,22 @@ wxDocTemplate* DocManagerEx::SelectDocumentType
int i;
int n = 0;
- for (i = 0; i < noTemplates; i++)
+ for(i = 0; i < noTemplates; i++)
{
- if (templates[i]->IsVisible())
+ if(templates[i]->IsVisible())
{
int j;
bool want = TRUE;
- for (j = 0; j < n; j++)
+ for(j = 0; j < n; j++)
{
//filter out NOT unique documents + view combinations
- if ( templates[i]->GetDocumentName() ==
data[j]->GetDocumentName() &&
+ if( templates[i]->GetDocumentName() ==
data[j]->GetDocumentName() &&
templates[i]->GetViewName() == data[j]->GetViewName()
)
want = FALSE;
}
- if ( want )
+ if(want)
{
strings.Add(templates[i]->GetDescription());
@@ -240,18 +240,18 @@ wxDocTemplate* DocManagerEx::SelectDocumentType
}
} // for
- if (sort)
+ if(sort)
{
strings.Sort(wxStringSortAscending);
// Yes, this will be slow, but template lists
// are typically short.
int j;
n = strings.Count();
- for (i = 0; i < n; i++)
+ for(i = 0; i < n; i++)
{
- for (j = 0; j < noTemplates; j++)
+ for(j = 0; j < noTemplates; j++)
{
- if (strings[i] == templates[j]->GetDescription())
+ if(strings[i] == templates[j]->GetDescription())
data[i] = templates[j];
}
}
@@ -259,7 +259,7 @@ wxDocTemplate* DocManagerEx::SelectDocumentType
wxDocTemplate* theTemplate;
- switch ( n )
+ switch(n)
{
case 0:
// no visible templates, hence nothing to choose from
diff --git a/getopt.cpp b/getopt.cpp
index 17219e8..cce482f 100644
--- a/getopt.cpp
+++ b/getopt.cpp
@@ -113,7 +113,7 @@ char* GetOpt::nextchar = nullptr;
int GetOpt::first_nonopt = 0;
int GetOpt::last_nonopt = 0;
-GetOpt::GetOpt (int argc, char** argv, char const* optstring)
+GetOpt::GetOpt(int argc, char** argv, char const* optstring)
:list_option (nullptr)
,list_option_first (0)
,optindvalue (EOF)
@@ -125,10 +125,10 @@ GetOpt::GetOpt (int argc, char** argv, char const*
optstring)
,nlongind (nullptr)
,nlong_only (0)
{
- Initialize (noptstring);
+ Initialize(noptstring);
}
-GetOpt::GetOpt (int argc, char** argv, char const* optstring,
+GetOpt::GetOpt(int argc, char** argv, char const* optstring,
Option const* longopts, int* longind, int long_only)
:list_option (nullptr)
,list_option_first (0)
@@ -159,13 +159,13 @@ GetOpt::GetOpt (int argc, char** argv, char const*
optstring,
noptstring += ":";
}
}
- Initialize (noptstring);
+ Initialize(noptstring);
}
GetOpt::~GetOpt() = default;
void
-GetOpt::Initialize (std::string const& a_optstring)
+GetOpt::Initialize(std::string const& a_optstring)
{
// Initialize the internal data when the first call is made.
// Start processing options with ARGV-element 1 (since ARGV-element 0
@@ -179,30 +179,30 @@ GetOpt::Initialize (std::string const& a_optstring)
// GWC replaced an erroneous test comparing nullptr to
// a_optstring.c_str(), which cannot be a null pointer:
- if (a_optstring.empty())
+ if(a_optstring.empty())
{
// GWC comment: the next line is apparently pleonastic.
noptstring = "";
- if (std::getenv ("_POSIX_OPTION_ORDER"))
+ if(std::getenv("_POSIX_OPTION_ORDER"))
ordering = REQUIRE_ORDER;
else
ordering = PERMUTE;
}
- else if ('-' == a_optstring[0])
+ else if('-' == a_optstring[0])
ordering = RETURN_IN_ORDER;
- else if (('+' == a_optstring[0]) || (std::getenv ("_POSIX_OPTION_ORDER")))
+ else if(('+' == a_optstring[0]) || (std::getenv("_POSIX_OPTION_ORDER")))
ordering = REQUIRE_ORDER;
else
ordering = PERMUTE;
}
void
-GetOpt::exchange (char** argv)
+GetOpt::exchange(char** argv)
{
- int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char*);
+ int nonopts_size = (last_nonopt - first_nonopt) * sizeof(char*);
// GWC substituted std::malloc() for alloca() and added call to std::free()
below.
-// char** temp = static_cast<char**>(alloca (nonopts_size));
- char** temp = static_cast<char**>(std::malloc (nonopts_size));
+// char** temp = static_cast<char**>(alloca(nonopts_size));
+ char** temp = static_cast<char**>(std::malloc(nonopts_size));
if(nullptr == temp)
{
throw std::runtime_error("Out of memory.");
@@ -210,10 +210,10 @@ GetOpt::exchange (char** argv)
// Interchange the two blocks of data in argv.
- std::memcpy (temp, &argv[first_nonopt], nonopts_size);
- std::memcpy (&argv[first_nonopt], &argv[last_nonopt],
- (optind - last_nonopt) * sizeof (char*));
- std::memcpy (&argv[first_nonopt + optind - last_nonopt], temp,
+ std::memcpy(temp, &argv[first_nonopt], nonopts_size);
+ std::memcpy(&argv[first_nonopt], &argv[last_nonopt],
+ (optind - last_nonopt) * sizeof(char*));
+ std::memcpy(&argv[first_nonopt + optind - last_nonopt], temp,
nonopts_size);
std::free(temp);
@@ -225,25 +225,25 @@ GetOpt::exchange (char** argv)
}
int
-GetOpt::List_Value (int i)
+GetOpt::List_Value(int i)
{
Option const* x = list_option;
list_option_first = 0;
optarg = nargv[i];
nextchar = nullptr;
- if (list_option->has_arg != LIST_ARG)
+ if(list_option->has_arg != LIST_ARG)
list_option = nullptr;
- if (x->flag)
+ if(x->flag)
{
*(x->flag) = x->val;
- return 0;
+ return 0;
}
- return x->val;
+ return x->val;
}
int
-GetOpt::List_No_Value ()
+GetOpt::List_No_Value()
{
Option const* x = list_option;
@@ -252,34 +252,34 @@ GetOpt::List_No_Value ()
optindvalue = EOF;
optarg = nullptr;
nextchar = nullptr;
- if (x->flag)
+ if(x->flag)
{
*(x->flag) = x->val;
- return 0;
+ return 0;
}
- return x->val;
+ return x->val;
}
void
-GetOpt::print_expanding (char* v)
+GetOpt::print_expanding(char* v)
{
int x;
- for (; (x = *v) != 0; v++)
- if (x < 040)
- std::fprintf (stderr, "^%c", x + '@');
- else if (0177 < x)
- std::fprintf (stderr, "\\%o", x);
+ for(; (x = *v) != 0; v++)
+ if(x < 040)
+ std::fprintf(stderr, "^%c", x + '@');
+ else if(0177 < x)
+ std::fprintf(stderr, "\\%o", x);
else
- std::fprintf (stderr, "%c", x);
+ std::fprintf(stderr, "%c", x);
}
void
-GetOpt::print_invalid ()
+GetOpt::print_invalid()
{
- std::fprintf (stderr, "%s: invalid argument '", nargv[0]);
- print_expanding (optarg);
- std::fprintf (stderr, "'\n");
+ std::fprintf(stderr, "%s: invalid argument '", nargv[0]);
+ print_expanding(optarg);
+ std::fprintf(stderr, "'\n");
}
// Scan elements of ARGV (whose length is ARGC) for option characters
@@ -352,7 +352,7 @@ GetOpt::operator()()
// Without this early exit, a segfault occurs if 'nargc' is zero,
// as the unit test demonstrates.
- if (0 == nargc)
+ if(0 == nargc)
return EOF;
// We are processing a LIST_ARG or ALT_ARG,
@@ -360,26 +360,26 @@ GetOpt::operator()()
// or is another option.
try_to_get_a_value:
- if (list_option)
+ if(list_option)
{
// If we have done all the ARGV-elements, stop the scan.
- if (optind == nargc)
+ if(optind == nargc)
{
// Check if first LIST_ARG with no argument.
- if (list_option_first)
- return List_No_Value ();
+ if(list_option_first)
+ return List_No_Value();
else
return EOF;
}
- if (list_option->valid == nullptr)
+ if(list_option->valid == nullptr)
{
// If there isn't a valid list of values,
// try to see if current argument isn't an option.
- if (nargv[optind][0] != '-')
- return List_Value (optind++);
+ if(nargv[optind][0] != '-')
+ return List_Value(optind++);
// An argument starting with '-' may be an option or not,
// this check is made below.
@@ -391,36 +391,36 @@ GetOpt::operator()()
char const** v;
- for (v = list_option->valid, optindvalue = 0; *v != nullptr; v++,
optindvalue++)
- if (std::strcmp (*v, nargv[optind]) == 0)
- return List_Value (optind++);
+ for(v = list_option->valid, optindvalue = 0; *v != nullptr; v++,
optindvalue++)
+ if(std::strcmp(*v, nargv[optind]) == 0)
+ return List_Value(optind++);
optindvalue = EOF;
// Check if first LIST_ARG with no argument;
// Otherwise, here we know that the LIST_ARG processing terminates.
- if (list_option_first)
- return List_No_Value ();
+ if(list_option_first)
+ return List_No_Value();
list_option = nullptr;
}
}
- if (nextchar == nullptr || *nextchar == 0)
+ if(nextchar == nullptr || *nextchar == 0)
{
- if (ordering == PERMUTE)
+ if(ordering == PERMUTE)
{
// If we have just processed some options following some non-options,
// exchange them so that the options come first.
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange (nargv);
- else if (last_nonopt != optind)
+ if(first_nonopt != last_nonopt && last_nonopt != optind)
+ exchange(nargv);
+ else if(last_nonopt != optind)
first_nonopt = optind;
// Now skip any additional non-options
// and extend the range of non-options previously skipped.
- while (optind < nargc
+ while(optind < nargc
&& (nargv[optind][0] != '-' || nargv[optind][1] == 0))
optind++;
last_nonopt = optind;
@@ -431,13 +431,13 @@ GetOpt::operator()()
// then exchange with previous non-options as if it were an option,
// then skip everything else like a non-option.
- if (optind != nargc && !std::strcmp (nargv[optind], "--"))
+ if(optind != nargc && !std::strcmp(nargv[optind], "--"))
{
optind++;
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange (nargv);
- else if (first_nonopt == last_nonopt)
+ if(first_nonopt != last_nonopt && last_nonopt != optind)
+ exchange(nargv);
+ else if(first_nonopt == last_nonopt)
first_nonopt = optind;
last_nonopt = nargc;
@@ -447,19 +447,19 @@ GetOpt::operator()()
// If we have done all the ARGV-elements, stop the scan
// and back over any non-options that we skipped and permuted.
- if (optind == nargc)
+ if(optind == nargc)
{
// Check if first LIST_ARG with no argument;
// Otherwise, terminates LIST_ARG processing.
- if (list_option_first)
- return List_No_Value ();
+ if(list_option_first)
+ return List_No_Value();
list_option = nullptr;
// Set the next-arg-index to point at the non-options
// that we previously skipped, so the caller will digest them.
- if (first_nonopt != last_nonopt)
+ if(first_nonopt != last_nonopt)
optind = first_nonopt;
return EOF;
}
@@ -467,16 +467,16 @@ GetOpt::operator()()
// If we have come to a non-option and did not permute it,
// either stop the scan or describe it to the caller and pass it by.
- if (nargv[optind][0] != '-' || nargv[optind][1] == 0)
+ if(nargv[optind][0] != '-' || nargv[optind][1] == 0)
{
// Check if first LIST_ARG with no argument;
// Otherwise, terminates LIST_ARG processing.
- if (list_option_first)
- return List_No_Value ();
+ if(list_option_first)
+ return List_No_Value();
list_option = nullptr;
- if (ordering == REQUIRE_ORDER)
+ if(ordering == REQUIRE_ORDER)
return EOF;
optarg = nargv[optind++];
optopt = EOF;
@@ -511,7 +511,7 @@ GetOpt::operator()()
nlong_only
&& (
nargv[optind][2]
- || !std::strchr (noptstring.c_str(), nargv[optind][1])
+ || !std::strchr(noptstring.c_str(), nargv[optind][1])
)
)
)
@@ -525,15 +525,15 @@ GetOpt::operator()()
int indfound = 0;
int option_index;
- for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
+ for(nameend = nextchar; *nameend && *nameend != '='; nameend++)
// Do nothing.
;
// Test all long options for either exact match or abbreviated matches.
- for (p = nlongopts, option_index = 0; p->name; p++, option_index++)
- if (!std::strncmp (p->name, nextchar, nameend - nextchar))
+ for(p = nlongopts, option_index = 0; p->name; p++, option_index++)
+ if(!std::strncmp(p->name, nextchar, nameend - nextchar))
{
- if (static_cast<int>(std::strlen (p->name)) == nameend - nextchar)
+ if(static_cast<int>(std::strlen(p->name)) == nameend - nextchar)
{
// Exact match found.
pfound = p;
@@ -541,7 +541,7 @@ GetOpt::operator()()
exact = 1;
break;
}
- else if (pfound == nullptr)
+ else if(pfound == nullptr)
{
// First nonexact match found.
pfound = p;
@@ -552,52 +552,52 @@ GetOpt::operator()()
ambig = 1;
}
- if (ambig && !exact)
+ if(ambig && !exact)
{
- if (list_option)
+ if(list_option)
// It is not a long option, but it is a value for LIST_ARG
- return List_Value (optind++);
- if (opterr)
- std::fprintf (stderr, "%s: option '%s' is ambiguous\n",
+ return List_Value(optind++);
+ if(opterr)
+ std::fprintf(stderr, "%s: option '%s' is ambiguous\n",
nargv[0], nargv[optind]);
- nextchar += std::strlen (nextchar);
+ nextchar += std::strlen(nextchar);
optind++;
return '?';
}
- if (pfound)
+ if(pfound)
{
// Check if first LIST_ARG with no argument;
// Otherwise, terminates LIST_ARG processing.
- if (list_option_first)
- return List_No_Value ();
+ if(list_option_first)
+ return List_No_Value();
list_option = nullptr;
option_index = indfound;
optind++;
- if ((*nameend) != 0)
+ if((*nameend) != 0)
// (-option=value)
// Don't test has_arg with >, because some C compilers don't
// allow it to be used on enums.
- switch (pfound->has_arg)
+ switch(pfound->has_arg)
{
case NO_ARG:
- if (opterr)
+ if(opterr)
{
- if (nargv[optind - 1][1] == '-')
+ if(nargv[optind - 1][1] == '-')
// --option
- std::fprintf (stderr,
+ std::fprintf(stderr,
"%s: option '--%s' doesn't allow an argument\n",
nargv[0], pfound->name);
else
// +option or -option
- std::fprintf (stderr,
+ std::fprintf(stderr,
"%s: option '%c%s' doesn't allow an argument\n",
nargv[0], nargv[optind - 1][0], pfound->name);
}
- nextchar += std::strlen (nextchar);
+ nextchar += std::strlen(nextchar);
return '?';
case LIST_ARG:
@@ -610,29 +610,29 @@ GetOpt::operator()()
}
else
// (-option value) or (-option)
- switch (pfound->has_arg)
+ switch(pfound->has_arg)
{
// See methods List_Value and List_No_Value
case ALT_ARG:
case LIST_ARG:
- nextchar += std::strlen (nextchar);
- if (nlongind)
+ nextchar += std::strlen(nextchar);
+ if(nlongind)
*nlongind = option_index;
list_option_first = 1;
list_option = pfound;
goto try_to_get_a_value;
case REQD_ARG:
- if (optind < nargc)
+ if(optind < nargc)
optarg = nargv[optind++];
else
{
- if (opterr)
- std::fprintf (stderr, "%s: option '%s' requires an
argument\n",
+ if(opterr)
+ std::fprintf(stderr, "%s: option '%s' requires an
argument\n",
nargv[0], nargv[optind - 1]);
- nextchar += std::strlen (nextchar);
- return (':' == noptstring[0]) ? (':') : ('?');
+ nextchar += std::strlen(nextchar);
+ return (':' == noptstring[0]) ? (':') : ('?');
}
break;
@@ -645,12 +645,12 @@ GetOpt::operator()()
// Check if 'optarg' is a valid value.
{
- int result;
+ int result;
- nextchar += std::strlen (nextchar);
- if (nlongind)
+ nextchar += std::strlen(nextchar);
+ if(nlongind)
*nlongind = option_index;
- if (pfound->flag)
+ if(pfound->flag)
{
*(pfound->flag) = pfound->val;
result = 0;
@@ -661,36 +661,36 @@ GetOpt::operator()()
// If there is a valid list of values,
// check if 'optarg' is a valid value.
- if ((pfound->valid) && (optarg))
+ if((pfound->valid) && (optarg))
{
char const** v;
- for (v = pfound->valid, optindvalue = 0; *v != nullptr; v++,
optindvalue++)
- if (std::strcmp (*v, optarg) == 0)
- return result;
+ for(v = pfound->valid, optindvalue = 0; *v != nullptr; v++,
optindvalue++)
+ if(std::strcmp(*v, optarg) == 0)
+ return result;
optindvalue = EOF;
// Here we know it is an invalid value.
- if (opterr)
+ if(opterr)
{
- std::fprintf (stderr, "%s: value '", nargv[0]);
- print_expanding (optarg);
- if (nargv[optind - 2][1] == '-')
+ std::fprintf(stderr, "%s: value '", nargv[0]);
+ print_expanding(optarg);
+ if(nargv[optind - 2][1] == '-')
// --option
- std::fprintf (stderr, "' is invalid for option '--%s'\n",
+ std::fprintf(stderr, "' is invalid for option '--%s'\n",
pfound->name);
else
// +option or -option
- std::fprintf (stderr, "' is invalid for option '%c%s'\n",
+ std::fprintf(stderr, "' is invalid for option '%c%s'\n",
nargv[optind - 2][0], pfound->name);
}
- return '?';
+ return '?';
}
// There is a NULL valid list of values.
- return result;
+ return result;
}
}
@@ -699,27 +699,27 @@ GetOpt::operator()()
// option, then it's an error.
// Otherwise interpret it as a short option.
- if (!nlong_only || nargv[optind][1] == '-' || std::strchr
(noptstring.c_str(), *nextchar) == nullptr)
+ if(!nlong_only || nargv[optind][1] == '-' ||
std::strchr(noptstring.c_str(), *nextchar) == nullptr)
{
- if (list_option)
+ if(list_option)
// It is not a long option, but it is a value for LIST_ARG
- return List_Value (optind++);
- if (opterr)
+ return List_Value(optind++);
+ if(opterr)
{
// GWC suppressed the declarations of these two unused variables.
// char * v;
// int x;
- if (nargv[optind][1] == '-')
+ if(nargv[optind][1] == '-')
// --option
- std::fprintf (stderr, "%s: unrecognized option '--",
+ std::fprintf(stderr, "%s: unrecognized option '--",
nargv[0]);
else
// +option or -option
- std::fprintf (stderr, "%s: unrecognized option '%c",
+ std::fprintf(stderr, "%s: unrecognized option '%c",
nargv[0], nargv[optind][0]);
- print_expanding (nextchar);
- std::fprintf (stderr, "'\n");
+ print_expanding(nextchar);
+ std::fprintf(stderr, "'\n");
}
// THIRD_PARTY !! Does the rhs mean '0'?
nextchar = const_cast<char*>("");
@@ -732,34 +732,34 @@ GetOpt::operator()()
{
int c = *nextchar++;
- char* temp = const_cast<char*>(std::strchr (noptstring.c_str(), c));
+ char* temp = const_cast<char*>(std::strchr(noptstring.c_str(), c));
// Increment 'optind' when we start to process its last character.
- if (*nextchar == 0)
+ if(*nextchar == 0)
optind++;
- if (temp == nullptr || c == ':')
+ if(temp == nullptr || c == ':')
{
- if (opterr)
+ if(opterr)
{
- if (c < 040 || c >= 0177)
+ if(c < 040 || c >= 0177)
{
// Check if first LIST_ARG with no argument;
// Otherwise, terminates LIST_ARG processing.
- if (list_option_first)
- return List_No_Value ();
+ if(list_option_first)
+ return List_No_Value();
list_option = nullptr;
- std::fprintf (stderr, "%s: unrecognized option, character code
0%o\n",
+ std::fprintf(stderr, "%s: unrecognized option, character code
0%o\n",
nargv[0], c);
}
else
{
- if (list_option)
+ if(list_option)
// It is not a short option, but it is a value for LIST_ARG
- return List_Value ((*nextchar == 0) ? (optind - 1) :
(optind++));
- std::fprintf (stderr, "%s: unrecognized option '-%c'\n",
+ return List_Value((*nextchar == 0) ? (optind - 1) :
(optind++));
+ std::fprintf(stderr, "%s: unrecognized option '-%c'\n",
nargv[0], c);
}
}
@@ -770,16 +770,16 @@ GetOpt::operator()()
// Check if first LIST_ARG with no argument;
// Otherwise, terminates LIST_ARG processing.
- if (list_option_first)
- return List_No_Value ();
+ if(list_option_first)
+ return List_No_Value();
list_option = nullptr;
- if (temp[1] == ':')
+ if(temp[1] == ':')
{
- if (temp[2] == ':')
+ if(temp[2] == ':')
{
// This is an option that accepts an argument optionally.
- if (*nextchar != 0)
+ if(*nextchar != 0)
{
optarg = nextchar;
optind++;
@@ -791,17 +791,17 @@ GetOpt::operator()()
else
{
// This is an option that requires an argument.
- if (*nextchar != 0)
+ if(*nextchar != 0)
{
optarg = nextchar;
// If we end this ARGV-element by taking the rest as an arg,
// we must advance to the next element now.
optind++;
}
- else if (optind == nargc)
+ else if(optind == nargc)
{
- if (opterr)
- std::fprintf (stderr, "%s: option '-%c' requires an
argument\n",
+ if(opterr)
+ std::fprintf(stderr, "%s: option '-%c' requires an
argument\n",
nargv[0], c);
optopt = c;
c = (':' == noptstring[0]) ? (':') : ('?');
@@ -818,7 +818,7 @@ GetOpt::operator()()
}
int
-GetOpt::next_arg (int& i)
+GetOpt::next_arg(int& i)
{
int tmp;
@@ -826,7 +826,7 @@ GetOpt::next_arg (int& i)
list_option = nullptr;
- if (0 < std::sscanf (nargv[optind], "%d", &tmp))
+ if(0 < std::sscanf(nargv[optind], "%d", &tmp))
{
i = tmp;
optind++;
@@ -837,7 +837,7 @@ GetOpt::next_arg (int& i)
}
int
-GetOpt::next_arg (double& d)
+GetOpt::next_arg(double& d)
{
double tmp;
@@ -845,7 +845,7 @@ GetOpt::next_arg (double& d)
list_option = nullptr;
- if (0 < std::sscanf (nargv[optind], "%lf", &tmp))
+ if(0 < std::sscanf(nargv[optind], "%lf", &tmp))
{
d = tmp;
optind++;
@@ -857,13 +857,13 @@ GetOpt::next_arg (double& d)
int
// GWC changed nonstandard to standard string class.
-GetOpt::next_arg (std::string& s)
+GetOpt::next_arg(std::string& s)
{
// Terminates LIST_ARG processing.
list_option = nullptr;
- if ('-' != nargv[optind][0])
+ if('-' != nargv[optind][0])
{
s = nargv[optind];
optind++;
diff --git a/getopt.hpp b/getopt.hpp
index a9adbe2..bef9a94 100644
--- a/getopt.hpp
+++ b/getopt.hpp
@@ -120,7 +120,7 @@
// reaches a valid option or an option terminator.
enum Option_Argument
- { NO_ARG, REQD_ARG, OPT_ARG, LIST_ARG, ALT_ARG };
+ {NO_ARG, REQD_ARG, OPT_ARG, LIST_ARG, ALT_ARG};
struct Option
{
@@ -171,7 +171,7 @@ class LMI_SO GetOpt
// of the value of 'ordering'. In the case of RETURN_IN_ORDER, only
// '--' can cause 'getopt' to return EOF with 'optind' != ARGC.
- enum OrderingEnum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER };
+ enum OrderingEnum {REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER};
OrderingEnum ordering;
// Handle permutation of arguments.
@@ -193,14 +193,14 @@ class LMI_SO GetOpt
int list_option_first;
- void exchange (char** argv);
+ void exchange(char** argv);
// Internal methods
- void Initialize (std::string const& a_optstring);
- int List_Value (int i);
- int List_No_Value ();
- void print_expanding (char* v);
+ void Initialize(std::string const& a_optstring);
+ int List_Value(int i);
+ int List_No_Value();
+ void print_expanding(char* v);
public:
// Set to an option character which was unrecognized.
@@ -312,8 +312,8 @@ class LMI_SO GetOpt
// it is parsed as a short option instead.
// GWC note: i.e., use long only iff (bool)long_only is ***false***.
- GetOpt (int argc, char** argv, char const* optstring);
- GetOpt (int argc, char** argv, char const* optstring,
+ GetOpt(int argc, char** argv, char const* optstring);
+ GetOpt(int argc, char** argv, char const* optstring,
Option const* longopts, int* longind, int long_only);
// Write a non-inline dtor explicitly, to prevent an ostensible
// problem detected by a malloc debugger when memory allocated on
@@ -323,7 +323,7 @@ class LMI_SO GetOpt
// first_char returns the first character of the argument.
- int first_char ();
+ int first_char();
// next_arg looks at next argument for an integer, double or string
// depending on the type of argument given to it. If the correct type is
@@ -338,14 +338,14 @@ class LMI_SO GetOpt
// and increment the index to the options. Return 1 if an integer is
// found, else return 0.
- int next_arg (int& i);
- int next_arg (double& d);
+ int next_arg(int& i);
+ int next_arg(double& d);
// GWC changed nonstandard to standard string class.
- int next_arg (std::string& s);
+ int next_arg(std::string& s);
// Prints a message for an invalid argument.
- void print_invalid ();
+ void print_invalid();
// Added by GWC.
void usage(int status = EXIT_SUCCESS);
@@ -353,9 +353,9 @@ class LMI_SO GetOpt
};
// GWC removed an extraneous ';' that followed this function definition.
-inline int GetOpt::first_char ()
+inline int GetOpt::first_char()
{
- return nargv[optind][0];
+ return nargv[optind][0];
}
#endif // getopt_hpp
diff --git a/input_sequence_entry.cpp b/input_sequence_entry.cpp
index 7a578a7..b7ab9fe 100644
--- a/input_sequence_entry.cpp
+++ b/input_sequence_entry.cpp
@@ -775,7 +775,7 @@ void InputSequenceEditor::set_tab_order()
std::vector<wxWindow*> order;
for(int row = 0; row < rows_count_; ++row)
{
- for (int col = Col_Value; col <= Col_Then; ++col)
+ for(int col = Col_Value; col <= Col_Then; ++col)
order.push_back(get_field_win(col, row));
}
for(int row = 0; row < rows_count_; ++row)
@@ -912,7 +912,7 @@ void InputSequenceEditor::really_do_layout()
// Now check if we're actually going to have a scrollbar or not by
// comparing our ideal minimum size with the size we would actually have.
- if ( sizer->ComputeFittingClientSize(this) != sizer->GetMinSize() )
+ if(sizer->ComputeFittingClientSize(this) != sizer->GetMinSize())
{
// The only possible reason for discrepancy is that the window would be
// too big to fit on the screen and so the actual size of the rows area
diff --git a/main_wx_test.cpp b/main_wx_test.cpp
index 69510ee..6fa8593 100644
--- a/main_wx_test.cpp
+++ b/main_wx_test.cpp
@@ -581,7 +581,7 @@ wxWindow* wx_test_focus_controller_child(MvcController&
dialog, char const* name
// Then find the book control containing it by walking up the window chain
// until we reach it.
- for (wxWindow* maybe_page = w;;)
+ for(wxWindow* maybe_page = w;;)
{
wxWindow* const maybe_book = maybe_page->GetParent();
@@ -593,14 +593,14 @@ wxWindow* wx_test_focus_controller_child(MvcController&
dialog, char const* name
,"book control containing window \"" << name << "\" not found"
);
- if (wxBookCtrlBase* const book =
dynamic_cast<wxBookCtrlBase*>(maybe_book))
+ if(wxBookCtrlBase* const book =
dynamic_cast<wxBookCtrlBase*>(maybe_book))
{
// We found the notebook, now we can use it to make the page
// containing the target window current.
size_t const num_pages = book->GetPageCount();
- for (size_t n = 0; n < num_pages; n++)
+ for(size_t n = 0; n < num_pages; n++)
{
- if (book->GetPage(n) == maybe_page)
+ if(book->GetPage(n) == maybe_page)
{
book->SetSelection(n);
wxYield();
@@ -719,7 +719,7 @@ bool SkeletonTest::StoreCurrentException()
domain_error_ = e.what();
return true;
}
- catch (std::runtime_error const& e)
+ catch(std::runtime_error const& e)
{
runtime_error_ = e.what();
return true;
@@ -747,7 +747,7 @@ void SkeletonTest::RethrowStoredException()
bool SkeletonTest::OnExceptionInMainLoop()
{
- if (is_running_tests_)
+ if(is_running_tests_)
{
// Don't let the base class catch, report and ignore the exceptions
// that happen while running the tests, we need to ensure that the test
@@ -770,7 +770,7 @@ void SkeletonTest::OnAssertFailure
// another exception is already in flight as this would just result in the
// program termination without any useful information about the reason of
// the failure whatsoever.
- if (is_running_tests_ && !std::uncaught_exception())
+ if(is_running_tests_ && !std::uncaught_exception())
{
throw test_assertion_failure_exception(msg ? msg : cond, file, line,
func);
}
@@ -783,7 +783,7 @@ void SkeletonTest::OnAssertFailure
void SkeletonTest::RunTheTests()
{
wxWindow* const mainWin = GetTopWindow();
- if (!mainWin)
+ if(!mainWin)
{
wxLogError("Failed to find the application main window.");
ExitMainLoop();
@@ -818,10 +818,10 @@ void SkeletonTest::RunTheTests()
// Close any initially opened dialogs (e.g. "About" dialog shown unless a
// special command line option is specified).
- for (;;)
+ for(;;)
{
wxWindow* const activeWin = wxGetActiveWindow();
- if (!activeWin || activeWin == mainWin)
+ if(!activeWin || activeWin == mainWin)
break;
// Try to close the dialog.
@@ -830,7 +830,7 @@ void SkeletonTest::RunTheTests()
wxYield();
// But stop trying if it didn't work.
- if (wxGetActiveWindow() == activeWin)
+ if(wxGetActiveWindow() == activeWin)
{
wxLogError("Failed to close the currently opened window, "
"please ensure it doesn't appear on program startup.");
@@ -912,7 +912,7 @@ int main(int argc, char* argv[])
initialize_application();
initialize_filesystem();
- if (!application_test::instance().process_command_line(argc, argv))
+ if(!application_test::instance().process_command_line(argc, argv))
{
return 0;
}
diff --git a/multidimgrid_any.cpp b/multidimgrid_any.cpp
index 400802d..514872f 100644
--- a/multidimgrid_any.cpp
+++ b/multidimgrid_any.cpp
@@ -1045,7 +1045,7 @@ void
MultiDimGrid::PopulateGridAxisSelection(enum_axis_x_or_y x_or_y)
int MultiDimGrid::GetAxisIndexByName(std::string const& axisName)
{
- for (unsigned int i = 0; i < dimension_; ++i)
+ for(unsigned int i = 0; i < dimension_; ++i)
{
if(axis_[i]->GetName() == axisName)
{
diff --git a/round_test.cpp b/round_test.cpp
index f4dcf43..d6f948e 100644
--- a/round_test.cpp
+++ b/round_test.cpp
@@ -154,7 +154,7 @@ void print_hex_val(T t, char const* name)
#endif // defined __GNUC__ && defined LMI_X87
// GWC modifications end
- for (unsigned int i = 0; i < size_of_T; ++i) { // modified by GWC
+ for(unsigned int i = 0; i < size_of_T; ++i) { // modified by GWC
if(p[i] <= 0xF)
std::cout << "0";
// GWC changed C cast to static_cast:
@@ -162,7 +162,7 @@ void print_hex_val(T t, char const* name)
}
// GWC modifications begin
std::cout << " / ";
- for (int i = size_of_T - 1; 0 <= i; --i) {
+ for(int i = size_of_T - 1; 0 <= i; --i) {
if(p[i] <= 0xF)
std::cout << "0";
std::cout << std::hex << static_cast<int>(p[i]);
diff --git a/round_to_test.cpp b/round_to_test.cpp
index a3465d0..103117a 100644
--- a/round_to_test.cpp
+++ b/round_to_test.cpp
@@ -142,7 +142,7 @@ void print_hex_val(T t, char const* name)
#endif // defined __GNUC__ && defined LMI_X87
// GWC modifications end
- for (unsigned int i = 0; i < size_of_T; ++i) { // modified by GWC
+ for(unsigned int i = 0; i < size_of_T; ++i) { // modified by GWC
if(p[i] <= 0xF)
std::cout << "0";
// GWC changed C cast to static_cast:
@@ -150,7 +150,7 @@ void print_hex_val(T t, char const* name)
}
// GWC modifications begin
std::cout << " / ";
- for (int i = size_of_T - 1; 0 <= i; --i) {
+ for(int i = size_of_T - 1; 0 <= i; --i) {
if(p[i] <= 0xF)
std::cout << "0";
std::cout << std::hex << static_cast<int>(p[i]);