Преглед изворни кода

KWSys 2025-01-24 (2535f5f1)

Code extracted from:

    https://gitlab.kitware.com/utils/kwsys.git

at commit 2535f5f16a4077bba6da2d4cad2a417ca0c3918e (master).

Upstream Shortlog
-----------------

Brad King (4):
      a42b7759 clang-format.bash: update to clang-format-18
      6da5c6ac Empty commit at end of history preceding clang-format-18 style transition
      a234f2ff clang-format: Enforce "east const" qualifier placement
      ac2b3378 Empty commit at end of history preceding clang-format "east const" transition

Kitware Robot (2):
      7a19509c Revise C++ coding style using clang-format-18
      7dec9555 Revise C++ coding style using clang-format with "east const"

Nikita Nemkin (1):
      4a126278 clang-format.bash: Preserve CRLF line endings on Windows
KWSys Upstream пре 11 месеци
родитељ
комит
ca5cdc6741

+ 12 - 12
Base64.c

@@ -9,12 +9,12 @@
 #  include "Base64.h.in"
 #endif
 
-static const unsigned char kwsysBase64EncodeTable[65] =
+static unsigned char const kwsysBase64EncodeTable[65] =
   "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
   "abcdefghijklmnopqrstuvwxyz"
   "0123456789+/";
 
-static const unsigned char kwsysBase64DecodeTable[256] = {
+static unsigned char const kwsysBase64DecodeTable[256] = {
   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
   0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
@@ -49,7 +49,7 @@ static unsigned char kwsysBase64DecodeChar(unsigned char c)
 }
 
 /* Encode 3 bytes into a 4 byte string. */
-void kwsysBase64_Encode3(const unsigned char* src, unsigned char* dest)
+void kwsysBase64_Encode3(unsigned char const* src, unsigned char* dest)
 {
   dest[0] = kwsysBase64EncodeChar((src[0] >> 2) & 0x3F);
   dest[1] =
@@ -60,7 +60,7 @@ void kwsysBase64_Encode3(const unsigned char* src, unsigned char* dest)
 }
 
 /* Encode 2 bytes into a 4 byte string. */
-void kwsysBase64_Encode2(const unsigned char* src, unsigned char* dest)
+void kwsysBase64_Encode2(unsigned char const* src, unsigned char* dest)
 {
   dest[0] = kwsysBase64EncodeChar((src[0] >> 2) & 0x3F);
   dest[1] =
@@ -70,7 +70,7 @@ void kwsysBase64_Encode2(const unsigned char* src, unsigned char* dest)
 }
 
 /* Encode 1 bytes into a 4 byte string. */
-void kwsysBase64_Encode1(const unsigned char* src, unsigned char* dest)
+void kwsysBase64_Encode1(unsigned char const* src, unsigned char* dest)
 {
   dest[0] = kwsysBase64EncodeChar((src[0] >> 2) & 0x3F);
   dest[1] = kwsysBase64EncodeChar(((src[0] << 4) & 0x30));
@@ -88,11 +88,11 @@ void kwsysBase64_Encode1(const unsigned char* src, unsigned char* dest)
    actually knowing how much data to expect (if the input is not a multiple of
    3 bytes then the extra padding needed to complete the encode 4 bytes will
    stop the decoding anyway).  */
-size_t kwsysBase64_Encode(const unsigned char* input, size_t length,
+size_t kwsysBase64_Encode(unsigned char const* input, size_t length,
                           unsigned char* output, int mark_end)
 {
-  const unsigned char* ptr = input;
-  const unsigned char* end = input + length;
+  unsigned char const* ptr = input;
+  unsigned char const* end = input + length;
   unsigned char* optr = output;
 
   /* Encode complete triplet */
@@ -128,7 +128,7 @@ size_t kwsysBase64_Encode(const unsigned char* input, size_t length,
 }
 
 /* Decode 4 bytes into a 3 byte string. */
-int kwsysBase64_Decode3(const unsigned char* src, unsigned char* dest)
+int kwsysBase64_Decode3(unsigned char const* src, unsigned char* dest)
 {
   unsigned char d0;
   unsigned char d1;
@@ -172,16 +172,16 @@ int kwsysBase64_Decode3(const unsigned char* src, unsigned char* dest)
    'length' parameter is ignored. This enables the caller to decode a stream
    without actually knowing how much decoded data to expect (of course, the
    buffer must be large enough). */
-size_t kwsysBase64_Decode(const unsigned char* input, size_t length,
+size_t kwsysBase64_Decode(unsigned char const* input, size_t length,
                           unsigned char* output, size_t max_input_length)
 {
-  const unsigned char* ptr = input;
+  unsigned char const* ptr = input;
   unsigned char* optr = output;
 
   /* Decode complete triplet */
 
   if (max_input_length) {
-    const unsigned char* end = input + max_input_length;
+    unsigned char const* end = input + max_input_length;
     while (ptr < end) {
       int len = kwsysBase64_Decode3(ptr, optr);
       optr += len;

+ 6 - 6
Base64.h.in

@@ -32,19 +32,19 @@ extern "C" {
 /**
  * Encode 3 bytes into a 4 byte string.
  */
-kwsysEXPORT void kwsysBase64_Encode3(const unsigned char* src,
+kwsysEXPORT void kwsysBase64_Encode3(unsigned char const* src,
                                      unsigned char* dest);
 
 /**
  * Encode 2 bytes into a 4 byte string.
  */
-kwsysEXPORT void kwsysBase64_Encode2(const unsigned char* src,
+kwsysEXPORT void kwsysBase64_Encode2(unsigned char const* src,
                                      unsigned char* dest);
 
 /**
  * Encode 1 bytes into a 4 byte string.
  */
-kwsysEXPORT void kwsysBase64_Encode1(const unsigned char* src,
+kwsysEXPORT void kwsysBase64_Encode1(unsigned char const* src,
                                      unsigned char* dest);
 
 /**
@@ -60,7 +60,7 @@ kwsysEXPORT void kwsysBase64_Encode1(const unsigned char* src,
  * the extra padding needed to complete the encode 4 bytes will stop
  * the decoding anyway).
  */
-kwsysEXPORT size_t kwsysBase64_Encode(const unsigned char* input,
+kwsysEXPORT size_t kwsysBase64_Encode(unsigned char const* input,
                                       size_t length, unsigned char* output,
                                       int mark_end);
 
@@ -68,7 +68,7 @@ kwsysEXPORT size_t kwsysBase64_Encode(const unsigned char* input,
  * Decode 4 bytes into a 3 byte string.  Returns the number of bytes
  * actually decoded.
  */
-kwsysEXPORT int kwsysBase64_Decode3(const unsigned char* src,
+kwsysEXPORT int kwsysBase64_Decode3(unsigned char const* src,
                                     unsigned char* dest);
 
 /**
@@ -83,7 +83,7 @@ kwsysEXPORT int kwsysBase64_Decode3(const unsigned char* src,
  * much decoded data to expect (of course, the buffer must be large
  * enough).
  */
-kwsysEXPORT size_t kwsysBase64_Decode(const unsigned char* input,
+kwsysEXPORT size_t kwsysBase64_Decode(unsigned char const* input,
                                       size_t length, unsigned char* output,
                                       size_t max_input_length);
 

+ 1 - 1
CONTRIBUTING.rst

@@ -27,7 +27,7 @@ copies of KWSys within dependent projects can be updated to get the changes.
 Code Style
 ==========
 
-We use `clang-format`_ version **15** to define our style for C++ code in
+We use `clang-format`_ version **18** to define our style for C++ code in
 the KWSys source tree.  See the `.clang-format`_ configuration file for
 our style settings.  Use the `clang-format.bash`_ script to format source
 code.  It automatically runs ``clang-format`` on the set of source files

+ 30 - 30
CommandLineArguments.cxx

@@ -42,13 +42,13 @@ namespace KWSYS_NAMESPACE {
 
 struct CommandLineArgumentsCallbackStructure
 {
-  const char* Argument;
+  char const* Argument;
   int ArgumentType;
   CommandLineArguments::CallbackType Callback;
   void* CallData;
   void* Variable;
   int VariableType;
-  const char* Help;
+  char const* Help;
 };
 
 class CommandLineArgumentsVectorOfStrings : public std::vector<std::string>
@@ -97,7 +97,7 @@ CommandLineArguments::~CommandLineArguments()
   delete this->Internals;
 }
 
-void CommandLineArguments::Initialize(int argc, const char* const argv[])
+void CommandLineArguments::Initialize(int argc, char const* const argv[])
 {
   int cc;
 
@@ -110,7 +110,7 @@ void CommandLineArguments::Initialize(int argc, const char* const argv[])
 
 void CommandLineArguments::Initialize(int argc, char* argv[])
 {
-  this->Initialize(argc, static_cast<const char* const*>(argv));
+  this->Initialize(argc, static_cast<char const* const*>(argv));
 }
 
 void CommandLineArguments::Initialize()
@@ -119,13 +119,13 @@ void CommandLineArguments::Initialize()
   this->Internals->LastArgument = 0;
 }
 
-void CommandLineArguments::ProcessArgument(const char* arg)
+void CommandLineArguments::ProcessArgument(char const* arg)
 {
   this->Internals->Argv.push_back(arg);
 }
 
 bool CommandLineArguments::GetMatchedArguments(
-  std::vector<std::string>* matches, const std::string& arg)
+  std::vector<std::string>* matches, std::string const& arg)
 {
   matches->clear();
   CommandLineArguments::Internal::CallbacksMap::iterator it;
@@ -133,7 +133,7 @@ bool CommandLineArguments::GetMatchedArguments(
   // Does the argument match to any we know about?
   for (it = this->Internals->Callbacks.begin();
        it != this->Internals->Callbacks.end(); ++it) {
-    const CommandLineArguments::Internal::String& parg = it->first;
+    CommandLineArguments::Internal::String const& parg = it->first;
     CommandLineArgumentsCallbackStructure* cs = &it->second;
     if (cs->ArgumentType == CommandLineArguments::NO_ARGUMENT ||
         cs->ArgumentType == CommandLineArguments::SPACE_ARGUMENT) {
@@ -155,7 +155,7 @@ int CommandLineArguments::Parse()
     this->Internals->UnusedArguments.clear();
   }
   for (cc = 0; cc < this->Internals->Argv.size(); cc++) {
-    const std::string& arg = this->Internals->Argv[cc];
+    std::string const& arg = this->Internals->Argv[cc];
     CommandLineArguments_DEBUG("Process argument: " << arg);
     this->Internals->LastArgument = cc;
     if (this->GetMatchedArguments(&matches, arg)) {
@@ -174,7 +174,7 @@ int CommandLineArguments::Parse()
       // additional value
       CommandLineArgumentsCallbackStructure* cs =
         &this->Internals->Callbacks[matches[maxidx]];
-      const std::string& sarg = matches[maxidx];
+      std::string const& sarg = matches[maxidx];
       if (cs->Argument != sarg) {
         abort();
       }
@@ -220,7 +220,7 @@ int CommandLineArguments::Parse()
           // Suck in all the rest of the arguments
           CommandLineArguments_DEBUG("This is a multi argument: " << arg);
           for (cc++; cc < this->Internals->Argv.size(); ++cc) {
-            const std::string& marg = this->Internals->Argv[cc];
+            std::string const& marg = this->Internals->Argv[cc];
             CommandLineArguments_DEBUG(
               " check multi argument value: " << marg);
             if (this->GetMatchedArguments(&matches, marg)) {
@@ -320,13 +320,13 @@ void CommandLineArguments::DeleteRemainingArguments(int argc, char*** argv)
   for (cc = 0; cc < argc; ++cc) {
     delete[] (*argv)[cc];
   }
-  delete[] * argv;
+  delete[] *argv;
 }
 
-void CommandLineArguments::AddCallback(const char* argument,
+void CommandLineArguments::AddCallback(char const* argument,
                                        ArgumentTypeEnum type,
                                        CallbackType callback, void* call_data,
-                                       const char* help)
+                                       char const* help)
 {
   CommandLineArgumentsCallbackStructure s;
   s.Argument = argument;
@@ -341,10 +341,10 @@ void CommandLineArguments::AddCallback(const char* argument,
   this->GenerateHelp();
 }
 
-void CommandLineArguments::AddArgument(const char* argument,
+void CommandLineArguments::AddArgument(char const* argument,
                                        ArgumentTypeEnum type,
                                        VariableTypeEnum vtype, void* variable,
-                                       const char* help)
+                                       char const* help)
 {
   CommandLineArgumentsCallbackStructure s;
   s.Argument = argument;
@@ -416,7 +416,7 @@ void CommandLineArguments::SetUnknownArgumentCallback(
   this->Internals->UnknownArgumentCallback = callback;
 }
 
-const char* CommandLineArguments::GetHelp(const char* arg)
+char const* CommandLineArguments::GetHelp(char const* arg)
 {
   auto it = this->Internals->Callbacks.find(arg);
   if (it == this->Internals->Callbacks.end()) {
@@ -445,7 +445,7 @@ void CommandLineArguments::SetLineLength(unsigned int ll)
   this->GenerateHelp();
 }
 
-const char* CommandLineArguments::GetArgv0()
+char const* CommandLineArguments::GetArgv0()
 {
   return this->Internals->Argv0.c_str();
 }
@@ -547,7 +547,7 @@ void CommandLineArguments::GenerateHelp()
       }
       str << "  " << argument.substr(0, maxstrlen) << "  ";
     }
-    const char* ptr = this->Internals->Callbacks[mpit->first].Help;
+    char const* ptr = this->Internals->Callbacks[mpit->first].Help;
     size_t len = strlen(ptr);
     int cnt = 0;
     while (len > 0) {
@@ -598,7 +598,7 @@ void CommandLineArguments::GenerateHelp()
 }
 
 void CommandLineArguments::PopulateVariable(bool* variable,
-                                            const std::string& value)
+                                            std::string const& value)
 {
   if (value == "1" || value == "ON" || value == "on" || value == "On" ||
       value == "TRUE" || value == "true" || value == "True" ||
@@ -610,7 +610,7 @@ void CommandLineArguments::PopulateVariable(bool* variable,
 }
 
 void CommandLineArguments::PopulateVariable(int* variable,
-                                            const std::string& value)
+                                            std::string const& value)
 {
   char* res = nullptr;
   *variable = static_cast<int>(strtol(value.c_str(), &res, 10));
@@ -621,7 +621,7 @@ void CommandLineArguments::PopulateVariable(int* variable,
 }
 
 void CommandLineArguments::PopulateVariable(double* variable,
-                                            const std::string& value)
+                                            std::string const& value)
 {
   char* res = nullptr;
   *variable = strtod(value.c_str(), &res);
@@ -632,21 +632,21 @@ void CommandLineArguments::PopulateVariable(double* variable,
 }
 
 void CommandLineArguments::PopulateVariable(char** variable,
-                                            const std::string& value)
+                                            std::string const& value)
 {
-  delete[] * variable;
+  delete[] *variable;
   *variable = new char[value.size() + 1];
   strcpy(*variable, value.c_str());
 }
 
 void CommandLineArguments::PopulateVariable(std::string* variable,
-                                            const std::string& value)
+                                            std::string const& value)
 {
   *variable = value;
 }
 
 void CommandLineArguments::PopulateVariable(std::vector<bool>* variable,
-                                            const std::string& value)
+                                            std::string const& value)
 {
   bool val = false;
   if (value == "1" || value == "ON" || value == "on" || value == "On" ||
@@ -658,7 +658,7 @@ void CommandLineArguments::PopulateVariable(std::vector<bool>* variable,
 }
 
 void CommandLineArguments::PopulateVariable(std::vector<int>* variable,
-                                            const std::string& value)
+                                            std::string const& value)
 {
   char* res = nullptr;
   variable->push_back(static_cast<int>(strtol(value.c_str(), &res, 10)));
@@ -669,7 +669,7 @@ void CommandLineArguments::PopulateVariable(std::vector<int>* variable,
 }
 
 void CommandLineArguments::PopulateVariable(std::vector<double>* variable,
-                                            const std::string& value)
+                                            std::string const& value)
 {
   char* res = nullptr;
   variable->push_back(strtod(value.c_str(), &res));
@@ -680,7 +680,7 @@ void CommandLineArguments::PopulateVariable(std::vector<double>* variable,
 }
 
 void CommandLineArguments::PopulateVariable(std::vector<char*>* variable,
-                                            const std::string& value)
+                                            std::string const& value)
 {
   char* var = new char[value.size() + 1];
   strcpy(var, value.c_str());
@@ -688,13 +688,13 @@ void CommandLineArguments::PopulateVariable(std::vector<char*>* variable,
 }
 
 void CommandLineArguments::PopulateVariable(std::vector<std::string>* variable,
-                                            const std::string& value)
+                                            std::string const& value)
 {
   variable->push_back(value);
 }
 
 bool CommandLineArguments::PopulateVariable(
-  CommandLineArgumentsCallbackStructure* cs, const char* value)
+  CommandLineArgumentsCallbackStructure* cs, char const* value)
 {
   // Call the callback
   if (cs->Callback) {

+ 55 - 55
CommandLineArguments.hxx.in

@@ -62,8 +62,8 @@ public:
   CommandLineArguments();
   ~CommandLineArguments();
 
-  CommandLineArguments(const CommandLineArguments&) = delete;
-  CommandLineArguments& operator=(const CommandLineArguments&) = delete;
+  CommandLineArguments(CommandLineArguments const&) = delete;
+  CommandLineArguments& operator=(CommandLineArguments const&) = delete;
 
   /**
    * Various argument types.
@@ -100,14 +100,14 @@ public:
   /**
    * Prototypes for callbacks for callback interface.
    */
-  typedef int (*CallbackType)(const char* argument, const char* value,
+  typedef int (*CallbackType)(char const* argument, char const* value,
                               void* call_data);
-  typedef int (*ErrorCallbackType)(const char* argument, void* client_data);
+  typedef int (*ErrorCallbackType)(char const* argument, void* client_data);
 
   /**
    * Initialize internal data structures. This should be called before parsing.
    */
-  void Initialize(int argc, const char* const argv[]);
+  void Initialize(int argc, char const* const argv[]);
   void Initialize(int argc, char* argv[]);
 
   /**
@@ -116,7 +116,7 @@ public:
    * are not available.
    */
   void Initialize();
-  void ProcessArgument(const char* arg);
+  void ProcessArgument(char const* arg);
 
   /**
    * This method will parse arguments and call appropriate methods.
@@ -129,56 +129,56 @@ public:
    * argument help specifies the help string used with this option. The
    * callback and call_data can be skipped.
    */
-  void AddCallback(const char* argument, ArgumentTypeEnum type,
-                   CallbackType callback, void* call_data, const char* help);
+  void AddCallback(char const* argument, ArgumentTypeEnum type,
+                   CallbackType callback, void* call_data, char const* help);
 
   /**
    * Add handler for argument which is going to set the variable to the
    * specified value. If the argument is specified, the option is casted to the
    * appropriate type.
    */
-  void AddArgument(const char* argument, ArgumentTypeEnum type, bool* variable,
-                   const char* help);
-  void AddArgument(const char* argument, ArgumentTypeEnum type, int* variable,
-                   const char* help);
-  void AddArgument(const char* argument, ArgumentTypeEnum type,
-                   double* variable, const char* help);
-  void AddArgument(const char* argument, ArgumentTypeEnum type,
-                   char** variable, const char* help);
-  void AddArgument(const char* argument, ArgumentTypeEnum type,
-                   std::string* variable, const char* help);
+  void AddArgument(char const* argument, ArgumentTypeEnum type, bool* variable,
+                   char const* help);
+  void AddArgument(char const* argument, ArgumentTypeEnum type, int* variable,
+                   char const* help);
+  void AddArgument(char const* argument, ArgumentTypeEnum type,
+                   double* variable, char const* help);
+  void AddArgument(char const* argument, ArgumentTypeEnum type,
+                   char** variable, char const* help);
+  void AddArgument(char const* argument, ArgumentTypeEnum type,
+                   std::string* variable, char const* help);
 
   /**
    * Add handler for argument which is going to set the variable to the
    * specified value. If the argument is specified, the option is casted to the
    * appropriate type. This will handle the multi argument values.
    */
-  void AddArgument(const char* argument, ArgumentTypeEnum type,
-                   std::vector<bool>* variable, const char* help);
-  void AddArgument(const char* argument, ArgumentTypeEnum type,
-                   std::vector<int>* variable, const char* help);
-  void AddArgument(const char* argument, ArgumentTypeEnum type,
-                   std::vector<double>* variable, const char* help);
-  void AddArgument(const char* argument, ArgumentTypeEnum type,
-                   std::vector<char*>* variable, const char* help);
-  void AddArgument(const char* argument, ArgumentTypeEnum type,
-                   std::vector<std::string>* variable, const char* help);
+  void AddArgument(char const* argument, ArgumentTypeEnum type,
+                   std::vector<bool>* variable, char const* help);
+  void AddArgument(char const* argument, ArgumentTypeEnum type,
+                   std::vector<int>* variable, char const* help);
+  void AddArgument(char const* argument, ArgumentTypeEnum type,
+                   std::vector<double>* variable, char const* help);
+  void AddArgument(char const* argument, ArgumentTypeEnum type,
+                   std::vector<char*>* variable, char const* help);
+  void AddArgument(char const* argument, ArgumentTypeEnum type,
+                   std::vector<std::string>* variable, char const* help);
 
   /**
    * Add handler for boolean argument. The argument does not take any option
    * and if it is specified, the value of the variable is true/1, otherwise it
    * is false/0.
    */
-  void AddBooleanArgument(const char* argument, bool* variable,
-                          const char* help);
-  void AddBooleanArgument(const char* argument, int* variable,
-                          const char* help);
-  void AddBooleanArgument(const char* argument, double* variable,
-                          const char* help);
-  void AddBooleanArgument(const char* argument, char** variable,
-                          const char* help);
-  void AddBooleanArgument(const char* argument, std::string* variable,
-                          const char* help);
+  void AddBooleanArgument(char const* argument, bool* variable,
+                          char const* help);
+  void AddBooleanArgument(char const* argument, int* variable,
+                          char const* help);
+  void AddBooleanArgument(char const* argument, double* variable,
+                          char const* help);
+  void AddBooleanArgument(char const* argument, char** variable,
+                          char const* help);
+  void AddBooleanArgument(char const* argument, std::string* variable,
+                          char const* help);
 
   /**
    * Set the callbacks for error handling.
@@ -205,8 +205,8 @@ public:
    * Return string containing help. If the argument is specified, only return
    * help for that argument.
    */
-  const char* GetHelp() { return this->Help.c_str(); }
-  const char* GetHelp(const char* arg);
+  char const* GetHelp() { return this->Help.c_str(); }
+  char const* GetHelp(char const* arg);
 
   /**
    * Get / Set the help line length. This length is used when generating the
@@ -219,7 +219,7 @@ public:
    * Get the executable name (argv0). This is only available when using
    * Initialize with argc/argv.
    */
-  const char* GetArgv0();
+  char const* GetArgv0();
 
   /**
    * Get index of the last argument parsed. This is the last argument that was
@@ -231,30 +231,30 @@ protected:
   void GenerateHelp();
 
   //! This is internal method that registers variable with argument
-  void AddArgument(const char* argument, ArgumentTypeEnum type,
-                   VariableTypeEnum vtype, void* variable, const char* help);
+  void AddArgument(char const* argument, ArgumentTypeEnum type,
+                   VariableTypeEnum vtype, void* variable, char const* help);
 
   bool GetMatchedArguments(std::vector<std::string>* matches,
-                           const std::string& arg);
+                           std::string const& arg);
 
   //! Populate individual variables
   bool PopulateVariable(CommandLineArgumentsCallbackStructure* cs,
-                        const char* value);
+                        char const* value);
 
   //! Populate individual variables of type ...
-  void PopulateVariable(bool* variable, const std::string& value);
-  void PopulateVariable(int* variable, const std::string& value);
-  void PopulateVariable(double* variable, const std::string& value);
-  void PopulateVariable(char** variable, const std::string& value);
-  void PopulateVariable(std::string* variable, const std::string& value);
-  void PopulateVariable(std::vector<bool>* variable, const std::string& value);
-  void PopulateVariable(std::vector<int>* variable, const std::string& value);
+  void PopulateVariable(bool* variable, std::string const& value);
+  void PopulateVariable(int* variable, std::string const& value);
+  void PopulateVariable(double* variable, std::string const& value);
+  void PopulateVariable(char** variable, std::string const& value);
+  void PopulateVariable(std::string* variable, std::string const& value);
+  void PopulateVariable(std::vector<bool>* variable, std::string const& value);
+  void PopulateVariable(std::vector<int>* variable, std::string const& value);
   void PopulateVariable(std::vector<double>* variable,
-                        const std::string& value);
+                        std::string const& value);
   void PopulateVariable(std::vector<char*>* variable,
-                        const std::string& value);
+                        std::string const& value);
   void PopulateVariable(std::vector<std::string>* variable,
-                        const std::string& value);
+                        std::string const& value);
 
   typedef CommandLineArgumentsInternal Internal;
   Internal* Internals;

+ 17 - 17
ConsoleBuf.hxx.in

@@ -34,14 +34,14 @@ public:
   class Manager
   {
   public:
-    Manager(std::basic_ios<CharT, Traits>& ios, const bool err = false)
+    Manager(std::basic_ios<CharT, Traits>& ios, bool const err = false)
       : m_consolebuf(0)
     {
       m_ios = &ios;
       try {
         m_consolebuf = new BasicConsoleBuf<CharT, Traits>(err);
         m_streambuf = m_ios->rdbuf(m_consolebuf);
-      } catch (const std::runtime_error& ex) {
+      } catch (std::runtime_error const& ex) {
         std::cerr << "Failed to create ConsoleBuf!" << std::endl
                   << ex.what() << std::endl;
       };
@@ -72,7 +72,7 @@ public:
     BasicConsoleBuf<CharT, Traits>* m_consolebuf;
   };
 
-  BasicConsoleBuf(const bool err = false)
+  BasicConsoleBuf(bool const err = false)
     : flush_on_newline(true)
     , input_pipe_codepage(0)
     , output_pipe_codepage(0)
@@ -111,7 +111,7 @@ protected:
       success = false;
     }
     if (m_hOutput && !m_obuffer.empty()) {
-      const std::wstring wbuffer = getBuffer(m_obuffer);
+      std::wstring const wbuffer = getBuffer(m_obuffer);
       if (m_isConsoleOutput) {
         DWORD charsWritten;
         success =
@@ -320,17 +320,17 @@ private:
     this->setp((char_type*)m_obuffer.data(),
                (char_type*)m_obuffer.data() + m_obuffer.size());
   }
-  bool encodeOutputBuffer(const std::wstring wbuffer, std::string& buffer)
+  bool encodeOutputBuffer(std::wstring const wbuffer, std::string& buffer)
   {
     if (wbuffer.size() == 0) {
       buffer = std::string();
       return true;
     }
-    const int length =
+    int const length =
       WideCharToMultiByte(m_activeOutputCodepage, 0, wbuffer.c_str(),
                           (int)wbuffer.size(), nullptr, 0, nullptr, nullptr);
     char* buf = new char[length];
-    const bool success =
+    bool const success =
       WideCharToMultiByte(m_activeOutputCodepage, 0, wbuffer.c_str(),
                           (int)wbuffer.size(), buf, length, nullptr,
                           nullptr) > 0
@@ -340,7 +340,7 @@ private:
     delete[] buf;
     return success;
   }
-  bool decodeInputBuffer(const std::string buffer, std::wstring& wbuffer)
+  bool decodeInputBuffer(std::string const buffer, std::wstring& wbuffer)
   {
     size_t length = buffer.length();
     if (length == 0) {
@@ -348,19 +348,19 @@ private:
       return true;
     }
     int actualCodepage = m_activeInputCodepage;
-    const char BOM_UTF8[] = { char(0xEF), char(0xBB), char(0xBF) };
-    const char* data = buffer.data();
-    const size_t BOMsize = sizeof(BOM_UTF8);
+    char const BOM_UTF8[] = { char(0xEF), char(0xBB), char(0xBF) };
+    char const* data = buffer.data();
+    size_t const BOMsize = sizeof(BOM_UTF8);
     if (length >= BOMsize && std::memcmp(data, BOM_UTF8, BOMsize) == 0) {
       // PowerShell uses UTF-8 with BOM for pipes
       actualCodepage = CP_UTF8;
       data += BOMsize;
       length -= BOMsize;
     }
-    const size_t wlength = static_cast<size_t>(MultiByteToWideChar(
+    size_t const wlength = static_cast<size_t>(MultiByteToWideChar(
       actualCodepage, 0, data, static_cast<int>(length), nullptr, 0));
     wchar_t* wbuf = new wchar_t[wlength];
-    const bool success =
+    bool const success =
       MultiByteToWideChar(actualCodepage, 0, data, static_cast<int>(length),
                           wbuf, static_cast<int>(wlength)) > 0
       ? true
@@ -369,19 +369,19 @@ private:
     delete[] wbuf;
     return success;
   }
-  std::wstring getBuffer(const std::basic_string<char> buffer)
+  std::wstring getBuffer(std::basic_string<char> const buffer)
   {
     return Encoding::ToWide(buffer);
   }
-  std::wstring getBuffer(const std::basic_string<wchar_t> buffer)
+  std::wstring getBuffer(std::basic_string<wchar_t> const buffer)
   {
     return buffer;
   }
-  void setBuffer(const std::wstring wbuffer, std::basic_string<char>& target)
+  void setBuffer(std::wstring const wbuffer, std::basic_string<char>& target)
   {
     target = Encoding::ToNarrow(wbuffer);
   }
-  void setBuffer(const std::wstring wbuffer,
+  void setBuffer(std::wstring const wbuffer,
                  std::basic_string<wchar_t>& target)
   {
     target = wbuffer;

+ 4 - 4
Directory.cxx

@@ -92,7 +92,7 @@ unsigned long Directory::GetNumberOfFiles() const
   return static_cast<unsigned long>(this->Internal->Files.size());
 }
 
-const char* Directory::GetFile(unsigned long dindex) const
+char const* Directory::GetFile(unsigned long dindex) const
 {
   return this->Internal->Files[dindex].Name.c_str();
 }
@@ -135,7 +135,7 @@ bool Directory::FileIsSymlink(std::size_t i) const
 #endif
 }
 
-const char* Directory::GetPath() const
+char const* Directory::GetPath() const
 {
   return this->Internal->Path.c_str();
 }
@@ -207,7 +207,7 @@ Status Directory::Load(std::string const& name, std::string* errorMessage)
   return Status::Success();
 }
 
-unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
+unsigned long Directory::GetNumberOfFilesInDirectory(std::string const& name,
                                                      std::string* errorMessage)
 {
   HANDLE srchHandle;
@@ -314,7 +314,7 @@ Status Directory::Load(std::string const& name, std::string* errorMessage)
   return Status::Success();
 }
 
-unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
+unsigned long Directory::GetNumberOfFilesInDirectory(std::string const& name,
                                                      std::string* errorMessage)
 {
   errno = 0;

+ 6 - 6
Directory.hxx.in

@@ -26,10 +26,10 @@ class @KWSYS_NAMESPACE@_EXPORT Directory
 public:
   Directory();
   Directory(Directory&& other);
-  Directory(const Directory&) = delete;
-  Directory& operator=(const Directory&) = delete;
+  Directory(Directory const&) = delete;
+  Directory& operator=(Directory const&) = delete;
   Directory& operator=(Directory&& other);
-  bool operator==(const Directory&) = delete;
+  bool operator==(Directory const&) = delete;
   ~Directory();
 
   /**
@@ -48,12 +48,12 @@ public:
    * A higher performance static method.
    */
   static unsigned long GetNumberOfFilesInDirectory(
-    const std::string&, std::string* errorMessage = nullptr);
+    std::string const&, std::string* errorMessage = nullptr);
 
   /**
    * Return the file at the given index, the indexing is 0 based
    */
-  const char* GetFile(unsigned long) const;
+  char const* GetFile(unsigned long) const;
 
   /**
    * Return the name of the file at the given 0-based index.
@@ -78,7 +78,7 @@ public:
   /**
    * Return the path to Open'ed directory
    */
-  const char* GetPath() const;
+  char const* GetPath() const;
 
   /**
    * Clear the internal structure. Used internally at beginning of Load(...)

+ 24 - 24
DynamicLoader.cxx

@@ -46,7 +46,7 @@
 namespace KWSYS_NAMESPACE {
 
 DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
-  const std::string& libname)
+  std::string const& libname)
 {
   return DynamicLoader::OpenLibrary(libname, 0);
 }
@@ -59,7 +59,7 @@ DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
 namespace KWSYS_NAMESPACE {
 
 DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
-  const std::string& libname, int flags)
+  std::string const& libname, int flags)
 {
   return 0;
 }
@@ -74,12 +74,12 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
 }
 
 DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
-  DynamicLoader::LibraryHandle lib, const std::string& sym)
+  DynamicLoader::LibraryHandle lib, std::string const& sym)
 {
   return 0;
 }
 
-const char* DynamicLoader::LastError()
+char const* DynamicLoader::LastError()
 {
   return "General error";
 }
@@ -94,7 +94,7 @@ const char* DynamicLoader::LastError()
 namespace KWSYS_NAMESPACE {
 
 DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
-  const std::string& libname, int flags)
+  std::string const& libname, int flags)
 {
   CHECK_OPEN_FLAGS(flags, 0, 0);
 
@@ -110,7 +110,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
 }
 
 DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
-  DynamicLoader::LibraryHandle lib, const std::string& sym)
+  DynamicLoader::LibraryHandle lib, std::string const& sym)
 {
   void* addr;
   int status;
@@ -127,7 +127,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
   return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
 }
 
-const char* DynamicLoader::LastError()
+char const* DynamicLoader::LastError()
 {
   // TODO: Need implementation with errno/strerror
   /* If successful, shl_findsym returns an integer (int) value zero. If
@@ -159,7 +159,7 @@ const char* DynamicLoader::LastError()
 namespace KWSYS_NAMESPACE {
 
 DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
-  const std::string& libname, int flags)
+  std::string const& libname, int flags)
 {
   CHECK_OPEN_FLAGS(flags, 0, 0);
 
@@ -190,7 +190,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
 }
 
 DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
-  DynamicLoader::LibraryHandle lib, const std::string& sym)
+  DynamicLoader::LibraryHandle lib, std::string const& sym)
 {
   void* result = 0;
   // Need to prepend symbols with '_' on Apple-gcc compilers
@@ -205,7 +205,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
   return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
 }
 
-const char* DynamicLoader::LastError()
+char const* DynamicLoader::LastError()
 {
   return 0;
 }
@@ -221,7 +221,7 @@ const char* DynamicLoader::LastError()
 namespace KWSYS_NAMESPACE {
 
 DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
-  const std::string& libname, int flags)
+  std::string const& libname, int flags)
 {
   CHECK_OPEN_FLAGS(flags, SearchBesideLibrary, nullptr);
 
@@ -240,7 +240,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
 }
 
 DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
-  DynamicLoader::LibraryHandle lib, const std::string& sym)
+  DynamicLoader::LibraryHandle lib, std::string const& sym)
 {
   // TODO: The calling convention affects the name of the symbol.  We
   // should have a tool to help get the symbol with the desired
@@ -254,14 +254,14 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
   // Note that the "@X" part of the name above is the total size (in
   // bytes) of the arguments on the stack.
   void* result;
-  const char* rsym = sym.c_str();
+  char const* rsym = sym.c_str();
   result = (void*)GetProcAddress(lib, rsym);
   return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
 }
 
 #  define DYNLOAD_ERROR_BUFFER_SIZE 1024
 
-const char* DynamicLoader::LastError()
+char const* DynamicLoader::LastError()
 {
   wchar_t lpMsgBuf[DYNLOAD_ERROR_BUFFER_SIZE + 1];
 
@@ -308,7 +308,7 @@ namespace KWSYS_NAMESPACE {
 static image_id last_dynamic_err = B_OK;
 
 DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
-  const std::string& libname, int flags)
+  std::string const& libname, int flags)
 {
   CHECK_OPEN_FLAGS(flags, 0, 0);
 
@@ -341,7 +341,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
 }
 
 DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
-  DynamicLoader::LibraryHandle lib, const std::string& sym)
+  DynamicLoader::LibraryHandle lib, std::string const& sym)
 {
   // Hack to cast pointer-to-data to pointer-to-function.
   union
@@ -368,9 +368,9 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
   return result.psym;
 }
 
-const char* DynamicLoader::LastError()
+char const* DynamicLoader::LastError()
 {
-  const char* retval = strerror(last_dynamic_err);
+  char const* retval = strerror(last_dynamic_err);
   last_dynamic_err = B_OK;
   return retval;
 }
@@ -388,7 +388,7 @@ const char* DynamicLoader::LastError()
 namespace KWSYS_NAMESPACE {
 
 DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
-  const std::string& libname, int flags)
+  std::string const& libname, int flags)
 {
   CHECK_OPEN_FLAGS(flags, 0, nullptr);
 
@@ -407,7 +407,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
 }
 
 DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
-  DynamicLoader::LibraryHandle lib, const std::string& sym)
+  DynamicLoader::LibraryHandle lib, std::string const& sym)
 {
   // Hack to cast pointer-to-data to pointer-to-function.
   union
@@ -419,7 +419,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
   return result.psym;
 }
 
-const char* DynamicLoader::LastError()
+char const* DynamicLoader::LastError()
 {
   return dld_strerror(dld_errno);
 }
@@ -434,7 +434,7 @@ const char* DynamicLoader::LastError()
 namespace KWSYS_NAMESPACE {
 
 DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
-  const std::string& libname, int flags)
+  std::string const& libname, int flags)
 {
   CHECK_OPEN_FLAGS(flags, RTLDGlobal, nullptr);
 
@@ -457,7 +457,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
 }
 
 DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
-  DynamicLoader::LibraryHandle lib, const std::string& sym)
+  DynamicLoader::LibraryHandle lib, std::string const& sym)
 {
   // Hack to cast pointer-to-data to pointer-to-function.
   union
@@ -469,7 +469,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
   return result.psym;
 }
 
-const char* DynamicLoader::LastError()
+char const* DynamicLoader::LastError()
 {
   return dlerror();
 }

+ 6 - 6
DynamicLoader.hxx.in

@@ -86,24 +86,24 @@ public:
    * library. The optional second argument is a set of flags to use when
    * opening the library. If unrecognized or unsupported flags are specified,
    * the library is not opened. */
-  static LibraryHandle OpenLibrary(const std::string&);
-  static LibraryHandle OpenLibrary(const std::string&, int);
+  static LibraryHandle OpenLibrary(std::string const&);
+  static LibraryHandle OpenLibrary(std::string const&, int);
 
   /** Attempt to detach a dynamic library from the
    * process.  A value of true is returned if it is successful. */
   static int CloseLibrary(LibraryHandle);
 
   /** Find the address of the symbol in the given library. */
-  static SymbolPointer GetSymbolAddress(LibraryHandle, const std::string&);
+  static SymbolPointer GetSymbolAddress(LibraryHandle, std::string const&);
 
   /** Return the default module prefix for the current platform.  */
-  static const char* LibPrefix() { return "@KWSYS_DynamicLoader_PREFIX@"; }
+  static char const* LibPrefix() { return "@KWSYS_DynamicLoader_PREFIX@"; }
 
   /** Return the default module suffix for the current platform.  */
-  static const char* LibExtension() { return "@KWSYS_DynamicLoader_SUFFIX@"; }
+  static char const* LibExtension() { return "@KWSYS_DynamicLoader_SUFFIX@"; }
 
   /** Return the last error produced from a calls made on this class. */
-  static const char* LastError();
+  static char const* LastError();
 }; // End Class: DynamicLoader
 
 } // namespace @KWSYS_NAMESPACE@

+ 4 - 4
Encoding.h.in

@@ -31,22 +31,22 @@ extern "C" {
    On Windows, UTF-8 is assumed, and on other platforms,
    the current locale is assumed.
    */
-kwsysEXPORT size_t kwsysEncoding_mbstowcs(wchar_t* dest, const char* src,
+kwsysEXPORT size_t kwsysEncoding_mbstowcs(wchar_t* dest, char const* src,
                                           size_t n);
 
 /* Convert a narrow string to a wide string.
    This can return NULL if the conversion fails. */
-kwsysEXPORT wchar_t* kwsysEncoding_DupToWide(const char* src);
+kwsysEXPORT wchar_t* kwsysEncoding_DupToWide(char const* src);
 
 /* Convert a wide string to a narrow string.
    On Windows, UTF-8 is assumed, and on other platforms,
    the current locale is assumed. */
-kwsysEXPORT size_t kwsysEncoding_wcstombs(char* dest, const wchar_t* src,
+kwsysEXPORT size_t kwsysEncoding_wcstombs(char* dest, wchar_t const* src,
                                           size_t n);
 
 /* Convert a wide string to a narrow string.
    This can return NULL if the conversion fails. */
-kwsysEXPORT char* kwsysEncoding_DupToNarrow(const wchar_t* str);
+kwsysEXPORT char* kwsysEncoding_DupToNarrow(wchar_t const* str);
 
 #if defined(__cplusplus)
 } /* extern "C" */

+ 7 - 7
Encoding.hxx.in

@@ -31,8 +31,8 @@ public:
     // argc and wide argv.  This is useful if wmain() is used.
     CommandLineArguments(int argc, wchar_t const* const* argv);
     ~CommandLineArguments();
-    CommandLineArguments(const CommandLineArguments&);
-    CommandLineArguments& operator=(const CommandLineArguments&);
+    CommandLineArguments(CommandLineArguments const&);
+    CommandLineArguments& operator=(CommandLineArguments const&);
 
     int argc() const;
     char const* const* argv() const;
@@ -50,14 +50,14 @@ public:
   // Convert a narrow string to a wide string.
   // On Windows, UTF-8 is assumed, and on other platforms,
   // the current locale is assumed.
-  static std::wstring ToWide(const std::string& str);
-  static std::wstring ToWide(const char* str);
+  static std::wstring ToWide(std::string const& str);
+  static std::wstring ToWide(char const* str);
 
   // Convert a wide string to a narrow string.
   // On Windows, UTF-8 is assumed, and on other platforms,
   // the current locale is assumed.
-  static std::string ToNarrow(const std::wstring& str);
-  static std::string ToNarrow(const wchar_t* str);
+  static std::string ToNarrow(std::wstring const& str);
+  static std::string ToNarrow(wchar_t const* str);
 
 #  if defined(_WIN32)
   /**
@@ -68,7 +68,7 @@ public:
    * absolute paths with Windows-style backslashes.
    **/
   static std::wstring ToWindowsExtendedPath(std::string const&);
-  static std::wstring ToWindowsExtendedPath(const char* source);
+  static std::wstring ToWindowsExtendedPath(char const* source);
   static std::wstring ToWindowsExtendedPath(std::wstring const& wsource);
 #  endif
 

+ 4 - 4
EncodingC.c

@@ -15,7 +15,7 @@
 #  include <windows.h>
 #endif
 
-size_t kwsysEncoding_mbstowcs(wchar_t* dest, const char* str, size_t n)
+size_t kwsysEncoding_mbstowcs(wchar_t* dest, char const* str, size_t n)
 {
   if (str == 0) {
     return (size_t)-1;
@@ -29,7 +29,7 @@ size_t kwsysEncoding_mbstowcs(wchar_t* dest, const char* str, size_t n)
 #endif
 }
 
-wchar_t* kwsysEncoding_DupToWide(const char* str)
+wchar_t* kwsysEncoding_DupToWide(char const* str)
 {
   wchar_t* ret = NULL;
   size_t length = kwsysEncoding_mbstowcs(NULL, str, 0) + 1;
@@ -43,7 +43,7 @@ wchar_t* kwsysEncoding_DupToWide(const char* str)
   return ret;
 }
 
-size_t kwsysEncoding_wcstombs(char* dest, const wchar_t* str, size_t n)
+size_t kwsysEncoding_wcstombs(char* dest, wchar_t const* str, size_t n)
 {
   if (str == 0) {
     return (size_t)-1;
@@ -57,7 +57,7 @@ size_t kwsysEncoding_wcstombs(char* dest, const wchar_t* str, size_t n)
 #endif
 }
 
-char* kwsysEncoding_DupToNarrow(const wchar_t* str)
+char* kwsysEncoding_DupToNarrow(wchar_t const* str)
 {
   char* ret = NULL;
   size_t length = kwsysEncoding_wcstombs(NULL, str, 0) + 1;

+ 8 - 8
EncodingCXX.cxx

@@ -86,7 +86,7 @@ Encoding::CommandLineArguments::~CommandLineArguments()
 }
 
 Encoding::CommandLineArguments::CommandLineArguments(
-  const CommandLineArguments& other)
+  CommandLineArguments const& other)
 {
   this->argv_.resize(other.argv_.size());
   for (size_t i = 0; i < this->argv_.size(); i++) {
@@ -95,7 +95,7 @@ Encoding::CommandLineArguments::CommandLineArguments(
 }
 
 Encoding::CommandLineArguments& Encoding::CommandLineArguments::operator=(
-  const CommandLineArguments& other)
+  CommandLineArguments const& other)
 {
   if (this != &other) {
     size_t i;
@@ -124,11 +124,11 @@ char const* const* Encoding::CommandLineArguments::argv() const
 
 #if KWSYS_STL_HAS_WSTRING
 
-std::wstring Encoding::ToWide(const std::string& str)
+std::wstring Encoding::ToWide(std::string const& str)
 {
   std::wstring wstr;
 #  if defined(_WIN32)
-  const int wlength =
+  int const wlength =
     MultiByteToWideChar(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(),
                         int(str.size()), nullptr, 0);
   if (wlength > 0) {
@@ -157,7 +157,7 @@ std::wstring Encoding::ToWide(const std::string& str)
   return wstr;
 }
 
-std::string Encoding::ToNarrow(const std::wstring& str)
+std::string Encoding::ToNarrow(std::wstring const& str)
 {
   std::string nstr;
 #  if defined(_WIN32)
@@ -191,7 +191,7 @@ std::string Encoding::ToNarrow(const std::wstring& str)
   return nstr;
 }
 
-std::wstring Encoding::ToWide(const char* cstr)
+std::wstring Encoding::ToWide(char const* cstr)
 {
   std::wstring wstr;
   size_t length = kwsysEncoding_mbstowcs(nullptr, cstr, 0) + 1;
@@ -204,7 +204,7 @@ std::wstring Encoding::ToWide(const char* cstr)
   return wstr;
 }
 
-std::string Encoding::ToNarrow(const wchar_t* wcstr)
+std::string Encoding::ToNarrow(wchar_t const* wcstr)
 {
   std::string str;
   size_t length = kwsysEncoding_wcstombs(nullptr, wcstr, 0) + 1;
@@ -225,7 +225,7 @@ std::wstring Encoding::ToWindowsExtendedPath(std::string const& source)
 }
 
 // Convert local paths to UNC style paths
-std::wstring Encoding::ToWindowsExtendedPath(const char* source)
+std::wstring Encoding::ToWindowsExtendedPath(char const* source)
 {
   return ToWindowsExtendedPath(ToWide(source));
 }

+ 4 - 4
FStream.hxx.in

@@ -33,7 +33,7 @@ public:
   typedef std::basic_filebuf<CharType, Traits> my_base_type;
   basic_filebuf* open(char const* s, std::ios_base::openmode mode)
   {
-    const std::wstring wstr = Encoding::ToWindowsExtendedPath(s);
+    std::wstring const wstr = Encoding::ToWindowsExtendedPath(s);
     return static_cast<basic_filebuf*>(my_base_type::open(wstr.c_str(), mode));
   }
 #    endif
@@ -41,7 +41,7 @@ public:
 
 #  else
 
-inline std::wstring getcmode(const std::ios_base::openmode mode)
+inline std::wstring getcmode(std::ios_base::openmode const mode)
 {
   std::wstring cmode;
   bool plus = false;
@@ -91,9 +91,9 @@ public:
       return false;
     }
 #  if defined(_MSC_VER)
-    const bool success = buf_->open(file_name, mode) != 0;
+    bool const success = buf_->open(file_name, mode) != 0;
 #  else
-    const std::wstring wstr = Encoding::ToWindowsExtendedPath(file_name);
+    std::wstring const wstr = Encoding::ToWindowsExtendedPath(file_name);
     bool success = false;
     std::wstring cmode = getcmode(mode);
     file_ = _wfopen(wstr.c_str(), cmode.c_str());

+ 8 - 8
Glob.cxx

@@ -70,7 +70,7 @@ std::vector<std::string>& Glob::GetFiles()
   return this->Internals->Files;
 }
 
-std::string Glob::PatternToRegex(const std::string& pattern,
+std::string Glob::PatternToRegex(std::string const& pattern,
                                  bool require_whole_string, bool preserve_case)
 {
   // Incrementally build the regular expression from the pattern.
@@ -179,7 +179,7 @@ std::string Glob::PatternToRegex(const std::string& pattern,
 }
 
 bool Glob::RecurseDirectory(std::string::size_type start,
-                            const std::string& dir, GlobMessages* messages)
+                            std::string const& dir, GlobMessages* messages)
 {
   kwsys::Directory d;
   std::string errorMessage;
@@ -281,7 +281,7 @@ bool Glob::RecurseDirectory(std::string::size_type start,
 }
 
 void Glob::ProcessDirectory(std::string::size_type start,
-                            const std::string& dir, GlobMessages* messages)
+                            std::string const& dir, GlobMessages* messages)
 {
   // std::cout << "ProcessDirectory: " << dir << std::endl;
   bool last = (start == this->Internals->Expressions.size() - 1);
@@ -341,7 +341,7 @@ void Glob::ProcessDirectory(std::string::size_type start,
   }
 }
 
-bool Glob::FindFiles(const std::string& inexpr, GlobMessages* messages)
+bool Glob::FindFiles(std::string const& inexpr, GlobMessages* messages)
 {
   std::string cexpr;
   std::string::size_type cc;
@@ -422,12 +422,12 @@ bool Glob::FindFiles(const std::string& inexpr, GlobMessages* messages)
   return true;
 }
 
-void Glob::AddExpression(const std::string& expr)
+void Glob::AddExpression(std::string const& expr)
 {
   this->Internals->Expressions.emplace_back(this->PatternToRegex(expr));
 }
 
-void Glob::SetRelative(const char* dir)
+void Glob::SetRelative(char const* dir)
 {
   if (!dir) {
     this->Relative = "";
@@ -436,7 +436,7 @@ void Glob::SetRelative(const char* dir)
   this->Relative = dir;
 }
 
-const char* Glob::GetRelative()
+char const* Glob::GetRelative()
 {
   if (this->Relative.empty()) {
     return nullptr;
@@ -444,7 +444,7 @@ const char* Glob::GetRelative()
   return this->Relative.c_str();
 }
 
-void Glob::AddFile(std::vector<std::string>& files, const std::string& file)
+void Glob::AddFile(std::vector<std::string>& files, std::string const& file)
 {
   if (!this->Relative.empty()) {
     files.push_back(kwsys::SystemTools::RelativePath(this->Relative, file));

+ 12 - 12
Glob.hxx.in

@@ -37,13 +37,13 @@ public:
     MessageType type;
     std::string content;
 
-    Message(MessageType t, const std::string& c)
+    Message(MessageType t, std::string const& c)
       : type(t)
       , content(c)
     {
     }
     ~Message() = default;
-    Message(const Message& msg) = default;
+    Message(Message const& msg) = default;
     Message& operator=(Message const& msg) = default;
   };
 
@@ -54,11 +54,11 @@ public:
   Glob();
   ~Glob();
 
-  Glob(const Glob&) = delete;
-  void operator=(const Glob&) = delete;
+  Glob(Glob const&) = delete;
+  void operator=(Glob const&) = delete;
 
   //! Find all files that match the pattern.
-  bool FindFiles(const std::string& inexpr, GlobMessages* messages = nullptr);
+  bool FindFiles(std::string const& inexpr, GlobMessages* messages = nullptr);
 
   //! Return the list of files that matched.
   std::vector<std::string>& GetFiles();
@@ -80,8 +80,8 @@ public:
   unsigned int GetFollowedSymlinkCount() { return this->FollowedSymlinkCount; }
 
   //! Set relative to true to only show relative path to files.
-  void SetRelative(const char* dir);
-  const char* GetRelative();
+  void SetRelative(char const* dir);
+  char const* GetRelative();
 
   /** Convert the given globbing pattern to a regular expression.
       There is no way to quote meta-characters.  The
@@ -90,7 +90,7 @@ public:
       string.  This is on by default because patterns always match
       whole strings, but may be disabled to support concatenating
       expressions more easily (regex1|regex2|etc).  */
-  static std::string PatternToRegex(const std::string& pattern,
+  static std::string PatternToRegex(std::string const& pattern,
                                     bool require_whole_string = true,
                                     bool preserve_case = false);
 
@@ -105,19 +105,19 @@ public:
 
 protected:
   //! Process directory
-  void ProcessDirectory(std::string::size_type start, const std::string& dir,
+  void ProcessDirectory(std::string::size_type start, std::string const& dir,
                         GlobMessages* messages);
 
   //! Process last directory, but only when recurse flags is on. That is
   // effectively like saying: /path/to/file/**/file
-  bool RecurseDirectory(std::string::size_type start, const std::string& dir,
+  bool RecurseDirectory(std::string::size_type start, std::string const& dir,
                         GlobMessages* messages);
 
   //! Add regular expression
-  void AddExpression(const std::string& expr);
+  void AddExpression(std::string const& expr);
 
   //! Add a file to the list
-  void AddFile(std::vector<std::string>& files, const std::string& file);
+  void AddFile(std::vector<std::string>& files, std::string const& file);
 
   GlobInternals* Internals;
   bool Recurse;

+ 9 - 9
MD5.c

@@ -170,7 +170,7 @@ typedef struct md5_state_s
 #define T63 0x2ad7d2bb
 #define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
 
-static void md5_process(md5_state_t* pms, const md5_byte_t* data /*[64]*/)
+static void md5_process(md5_state_t* pms, md5_byte_t const* data /*[64]*/)
 {
   md5_word_t a = pms->abcd[0];
   md5_word_t b = pms->abcd[1];
@@ -183,7 +183,7 @@ static void md5_process(md5_state_t* pms, const md5_byte_t* data /*[64]*/)
 #else
   /* Define storage for little-endian or both types of CPUs. */
   md5_word_t xbuf[16];
-  const md5_word_t* X;
+  md5_word_t const* X;
 #endif
 
   {
@@ -193,9 +193,9 @@ static void md5_process(md5_state_t* pms, const md5_byte_t* data /*[64]*/)
      * little-endian machine, since we can use a more efficient
      * algorithm on the latter.
      */
-    static const int w = 1;
+    static int const w = 1;
 
-    if (*((const md5_byte_t*)&w)) /* dynamic little-endian */
+    if (*((md5_byte_t const*)&w)) /* dynamic little-endian */
 #endif
 #if BYTE_ORDER <= 0 /* little-endian */
     {
@@ -205,7 +205,7 @@ static void md5_process(md5_state_t* pms, const md5_byte_t* data /*[64]*/)
        */
       if (!((uintptr_t)data & 3)) {
         /* data are properly aligned */
-        X = (const md5_word_t*)data;
+        X = (md5_word_t const*)data;
       } else {
         /* not aligned */
         memcpy(xbuf, data, 64);
@@ -222,7 +222,7 @@ static void md5_process(md5_state_t* pms, const md5_byte_t* data /*[64]*/)
        * On big-endian machines, we must arrange the bytes in the
        * right order.
        */
-      const md5_byte_t* xp = data;
+      md5_byte_t const* xp = data;
       int i;
 
 #  if BYTE_ORDER == 0
@@ -364,9 +364,9 @@ static void md5_init(md5_state_t* pms)
 }
 
 /* Append a string to the message. */
-static void md5_append(md5_state_t* pms, const md5_byte_t* data, size_t nbytes)
+static void md5_append(md5_state_t* pms, md5_byte_t const* data, size_t nbytes)
 {
-  const md5_byte_t* p = data;
+  md5_byte_t const* p = data;
   size_t left = nbytes;
   size_t offset = (pms->count[0] >> 3) & 63;
   md5_word_t nbits = (md5_word_t)(nbytes << 3);
@@ -409,7 +409,7 @@ static void md5_append(md5_state_t* pms, const md5_byte_t* data, size_t nbytes)
 /* Finish the message and return the digest. */
 static void md5_finish(md5_state_t* pms, md5_byte_t digest[16])
 {
-  static const md5_byte_t pad[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+  static md5_byte_t const pad[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                       0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                       0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                       0,    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

+ 3 - 3
Process.h.in

@@ -145,14 +145,14 @@ kwsysEXPORT void kwsysProcess_SetTimeout(kwsysProcess* cp, double timeout);
  * Returns 1 for success and 0 for failure.
  */
 kwsysEXPORT int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp,
-                                                 const char* dir);
+                                                 char const* dir);
 
 /**
  * Set the name of a file to be attached to the given pipe.  Returns 1
  * for success and 0 for failure.
  */
 kwsysEXPORT int kwsysProcess_SetPipeFile(kwsysProcess* cp, int pipe,
-                                         const char* file);
+                                         char const* file);
 
 /**
  * Set whether the given pipe in the child is shared with the parent
@@ -181,7 +181,7 @@ kwsysEXPORT void kwsysProcess_SetPipeShared(kwsysProcess* cp, int pipe,
  * read end will be closed in the child process.
  */
 kwsysEXPORT void kwsysProcess_SetPipeNative(
-  kwsysProcess* cp, int pipe, const kwsysProcess_Pipe_Handle p[2]);
+  kwsysProcess* cp, int pipe, kwsysProcess_Pipe_Handle const p[2]);
 
 /**
  * Get/Set a possibly platform-specific option.  Possible options are:

+ 26 - 26
ProcessUNIX.c

@@ -155,7 +155,7 @@ typedef struct kwsysProcessCreateInformation_s
   int ErrorPipe[2];
 } kwsysProcessCreateInformation;
 
-static void kwsysProcessVolatileFree(volatile void* p);
+static void kwsysProcessVolatileFree(void volatile* p);
 static int kwsysProcessInitialize(kwsysProcess* cp);
 static void kwsysProcessCleanup(kwsysProcess* cp, int error);
 static void kwsysProcessCleanupDescriptor(int* pfd);
@@ -164,13 +164,13 @@ static int kwsysProcessSetNonBlocking(int fd);
 static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
                               kwsysProcessCreateInformation* si);
 static void kwsysProcessDestroy(kwsysProcess* cp);
-static int kwsysProcessSetupOutputPipeFile(int* p, const char* name);
+static int kwsysProcessSetupOutputPipeFile(int* p, char const* name);
 static int kwsysProcessSetupOutputPipeNative(int* p, int des[2]);
 static int kwsysProcessGetTimeoutTime(kwsysProcess* cp,
-                                      const double* userTimeout,
+                                      double const* userTimeout,
                                       kwsysProcessTime* timeoutTime);
 static int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime,
-                                      const double* userTimeout,
+                                      double const* userTimeout,
                                       kwsysProcessTimeNative* timeoutLength,
                                       int zeroIsExpired);
 static kwsysProcessTime kwsysProcessTimeGetCurrent(void);
@@ -189,7 +189,7 @@ static pid_t kwsysProcessFork(kwsysProcess* cp,
                               kwsysProcessCreateInformation* si);
 static void kwsysProcessKill(pid_t process_id);
 #if defined(__VMS)
-static int kwsysProcessSetVMSFeature(const char* name, int value);
+static int kwsysProcessSetVMSFeature(char const* name, int value);
 #endif
 static int kwsysProcessesAdd(kwsysProcess* cp);
 static void kwsysProcessesRemove(kwsysProcess* cp);
@@ -225,7 +225,7 @@ struct kwsysProcess_s
 {
   /* The command lines to execute.  */
   char*** Commands;
-  volatile int NumberOfCommands;
+  int volatile NumberOfCommands;
 
   /* Descriptors for the read ends of the child's output pipes and
      the signal pipe. */
@@ -244,7 +244,7 @@ struct kwsysProcess_s
   /* Process IDs returned by the calls to fork.  Everything is volatile
      because the signal handler accesses them.  You must be very careful
      when reaping PIDs or modifying this array to avoid race conditions.  */
-  volatile pid_t* volatile ForkPIDs;
+  pid_t volatile* volatile ForkPIDs;
 
   /* Flag for whether the children were terminated by a failed select.  */
   int SelectError;
@@ -268,7 +268,7 @@ struct kwsysProcess_s
   int MergeOutput;
 
   /* Whether to create the process in a new process group.  */
-  volatile sig_atomic_t CreateProcessGroup;
+  sig_atomic_t volatile CreateProcessGroup;
 
   /* Time at which the child started.  Negative for no timeout.  */
   kwsysProcessTime StartTime;
@@ -292,10 +292,10 @@ struct kwsysProcess_s
 
   /* The status of the process structure.  Must be atomic because
      the signal handler checks this to avoid a race.  */
-  volatile sig_atomic_t State;
+  sig_atomic_t volatile State;
 
   /* Whether the process was killed.  */
-  volatile sig_atomic_t Killed;
+  sig_atomic_t volatile Killed;
 
   /* Buffer for error message in case of failure.  */
   char ErrorMessage[KWSYSPE_PIPE_BUFFER_SIZE + 1];
@@ -495,7 +495,7 @@ void kwsysProcess_SetTimeout(kwsysProcess* cp, double timeout)
   cp->TimeoutTime.tv_sec = -1;
 }
 
-int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
+int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, char const* dir)
 {
   if (!cp) {
     return 0;
@@ -519,7 +519,7 @@ int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
   return 1;
 }
 
-int kwsysProcess_SetPipeFile(kwsysProcess* cp, int prPipe, const char* file)
+int kwsysProcess_SetPipeFile(kwsysProcess* cp, int prPipe, char const* file)
 {
   char** pfile;
   if (!cp) {
@@ -586,7 +586,7 @@ void kwsysProcess_SetPipeShared(kwsysProcess* cp, int prPipe, int shared)
   }
 }
 
-void kwsysProcess_SetPipeNative(kwsysProcess* cp, int prPipe, const int p[2])
+void kwsysProcess_SetPipeNative(kwsysProcess* cp, int prPipe, int const p[2])
 {
   int* pPipeNative = 0;
 
@@ -695,7 +695,7 @@ int kwsysProcess_GetExitValue(kwsysProcess* cp)
     : -1;
 }
 
-const char* kwsysProcess_GetErrorString(kwsysProcess* cp)
+char const* kwsysProcess_GetErrorString(kwsysProcess* cp)
 {
   if (!cp) {
     return "Process management structure could not be allocated";
@@ -706,7 +706,7 @@ const char* kwsysProcess_GetErrorString(kwsysProcess* cp)
   return "Success";
 }
 
-const char* kwsysProcess_GetExceptionString(kwsysProcess* cp)
+char const* kwsysProcess_GetExceptionString(kwsysProcess* cp)
 {
   if (!(cp && cp->ProcessResults && (cp->NumberOfCommands > 0))) {
     return "GetExceptionString called with NULL process management structure";
@@ -747,7 +747,7 @@ int kwsysProcess_GetExitCodeByIndex(kwsysProcess* cp, int idx)
   return cp->CommandExitCodes[idx];
 }
 
-const char* kwsysProcess_GetExceptionStringByIndex(kwsysProcess* cp, int idx)
+char const* kwsysProcess_GetExceptionStringByIndex(kwsysProcess* cp, int idx)
 {
   KWSYSPE_IDX_CHK("GetExceptionString called with NULL process management "
                   "structure or index out of bound")
@@ -1260,7 +1260,7 @@ static int kwsysProcessWaitForPipe(kwsysProcess* cp, char** data, int* length,
   /* Poll pipes for data since we do not have select.  */
   for (i = 0; i < KWSYSPE_PIPE_COUNT; ++i) {
     if (cp->PipeReadEnds[i] >= 0) {
-      const int fd = cp->PipeReadEnds[i];
+      int const fd = cp->PipeReadEnds[i];
       int n = read(fd, cp->PipeBuffer, KWSYSPE_PIPE_BUFFER_SIZE);
       if (n > 0) {
         /* We have data on this pipe.  */
@@ -1486,7 +1486,7 @@ void kwsysProcess_Kill(kwsysProcess* cp)
 
 /* Call the free() function with a pointer to volatile without causing
    compiler warnings.  */
-static void kwsysProcessVolatileFree(volatile void* p)
+static void kwsysProcessVolatileFree(void volatile* p)
 {
 /* clang has made it impossible to free memory that points to volatile
    without first using special pragmas to disable a warning...  */
@@ -1504,7 +1504,7 @@ static void kwsysProcessVolatileFree(volatile void* p)
 static int kwsysProcessInitialize(kwsysProcess* cp)
 {
   int i;
-  volatile pid_t* oldForkPIDs;
+  pid_t volatile* oldForkPIDs;
   for (i = 0; i < KWSYSPE_PIPE_COUNT; ++i) {
     cp->PipeReadEnds[i] = -1;
   }
@@ -1528,7 +1528,7 @@ static int kwsysProcessInitialize(kwsysProcess* cp)
   cp->ErrorMessage[0] = 0;
 
   oldForkPIDs = cp->ForkPIDs;
-  cp->ForkPIDs = (volatile pid_t*)malloc(sizeof(volatile pid_t) *
+  cp->ForkPIDs = (pid_t volatile*)malloc(sizeof(pid_t volatile) *
                                          (size_t)(cp->NumberOfCommands));
   kwsysProcessVolatileFree(oldForkPIDs);
   if (!cp->ForkPIDs) {
@@ -1935,7 +1935,7 @@ static void kwsysProcessDestroy(kwsysProcess* cp)
   sigprocmask(SIG_SETMASK, &old_mask, 0);
 }
 
-static int kwsysProcessSetupOutputPipeFile(int* p, const char* name)
+static int kwsysProcessSetupOutputPipeFile(int* p, char const* name)
 {
   int fout;
   if (!name) {
@@ -1982,7 +1982,7 @@ static int kwsysProcessSetupOutputPipeNative(int* p, int des[2])
 /* Get the time at which either the process or user timeout will
    expire.  Returns 1 if the user timeout is first, and 0 otherwise.  */
 static int kwsysProcessGetTimeoutTime(kwsysProcess* cp,
-                                      const double* userTimeout,
+                                      double const* userTimeout,
                                       kwsysProcessTime* timeoutTime)
 {
   /* The first time this is called, we need to calculate the time at
@@ -2022,7 +2022,7 @@ static int kwsysProcessGetTimeoutTime(kwsysProcess* cp,
 /* Get the length of time before the given timeout time arrives.
    Returns 1 if the time has already arrived, and 0 otherwise.  */
 static int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime,
-                                      const double* userTimeout,
+                                      double const* userTimeout,
                                       kwsysProcessTimeNative* timeoutLength,
                                       int zeroIsExpired)
 {
@@ -2572,7 +2572,7 @@ static void kwsysProcessKill(pid_t process_id)
             fclose(f);
             buffer[nread] = '\0';
             if (nread > 0) {
-              const char* rparen = strrchr(buffer, ')');
+              char const* rparen = strrchr(buffer, ')');
               int ppid;
               if (rparen && (sscanf(rparen + 1, "%*s %d", &ppid) == 1)) {
                 if (ppid == process_id) {
@@ -2628,9 +2628,9 @@ static void kwsysProcessKill(pid_t process_id)
 }
 
 #if defined(__VMS)
-int decc$feature_get_index(const char* name);
+int decc$feature_get_index(char const* name);
 int decc$feature_set_value(int index, int mode, int value);
-static int kwsysProcessSetVMSFeature(const char* name, int value)
+static int kwsysProcessSetVMSFeature(char const* name, int value)
 {
   int i;
   errno = 0;

+ 7 - 7
ProcessWin32.c

@@ -89,7 +89,7 @@ static int kwsysProcessInitialize(kwsysProcess* cp);
 static DWORD kwsysProcessCreate(kwsysProcess* cp, int index,
                                 kwsysProcessCreateInformation* si);
 static void kwsysProcessDestroy(kwsysProcess* cp, int event);
-static DWORD kwsysProcessSetupOutputPipeFile(PHANDLE handle, const char* name);
+static DWORD kwsysProcessSetupOutputPipeFile(PHANDLE handle, char const* name);
 static void kwsysProcessSetupSharedPipe(DWORD nStdHandle, PHANDLE handle);
 static void kwsysProcessSetupPipeNative(HANDLE native, PHANDLE handle);
 static void kwsysProcessCleanupHandle(PHANDLE h);
@@ -654,7 +654,7 @@ void kwsysProcess_SetTimeout(kwsysProcess* cp, double timeout)
   cp->TimeoutTime.QuadPart = -1;
 }
 
-int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
+int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, char const* dir)
 {
   if (!cp) {
     return 0;
@@ -685,7 +685,7 @@ int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
   return 1;
 }
 
-int kwsysProcess_SetPipeFile(kwsysProcess* cp, int pipe, const char* file)
+int kwsysProcess_SetPipeFile(kwsysProcess* cp, int pipe, char const* file)
 {
   char** pfile;
   if (!cp) {
@@ -867,7 +867,7 @@ int kwsysProcess_GetExitCode(kwsysProcess* cp)
     : 0;
 }
 
-const char* kwsysProcess_GetErrorString(kwsysProcess* cp)
+char const* kwsysProcess_GetErrorString(kwsysProcess* cp)
 {
   if (!cp) {
     return "Process management structure could not be allocated";
@@ -877,7 +877,7 @@ const char* kwsysProcess_GetErrorString(kwsysProcess* cp)
   return "Success";
 }
 
-const char* kwsysProcess_GetExceptionString(kwsysProcess* cp)
+char const* kwsysProcess_GetExceptionString(kwsysProcess* cp)
 {
   if (!(cp && cp->ProcessResults && (cp->NumberOfCommands > 0))) {
     return "GetExceptionString called with NULL process management structure";
@@ -918,7 +918,7 @@ int kwsysProcess_GetExitCodeByIndex(kwsysProcess* cp, int idx)
   return cp->CommandExitCodes[idx];
 }
 
-const char* kwsysProcess_GetExceptionStringByIndex(kwsysProcess* cp, int idx)
+char const* kwsysProcess_GetExceptionStringByIndex(kwsysProcess* cp, int idx)
 {
   KWSYSPE_IDX_CHK("GetExceptionString called with NULL process management "
                   "structure or index out of bound")
@@ -1796,7 +1796,7 @@ void kwsysProcessDestroy(kwsysProcess* cp, int event)
   }
 }
 
-DWORD kwsysProcessSetupOutputPipeFile(PHANDLE phandle, const char* name)
+DWORD kwsysProcessSetupOutputPipeFile(PHANDLE phandle, char const* name)
 {
   HANDLE fout;
   wchar_t* wname;

+ 39 - 39
RegularExpression.cxx

@@ -34,7 +34,7 @@
 namespace KWSYS_NAMESPACE {
 
 // RegularExpression -- Copies the given regular expression.
-RegularExpression::RegularExpression(const RegularExpression& rxp)
+RegularExpression::RegularExpression(RegularExpression const& rxp)
 {
   if (!rxp.program) {
     this->program = nullptr;
@@ -63,7 +63,7 @@ RegularExpression::RegularExpression(const RegularExpression& rxp)
 }
 
 // operator= -- Copies the given regular expression.
-RegularExpression& RegularExpression::operator=(const RegularExpression& rxp)
+RegularExpression& RegularExpression::operator=(RegularExpression const& rxp)
 {
   if (this == &rxp) {
     return *this;
@@ -99,7 +99,7 @@ RegularExpression& RegularExpression::operator=(const RegularExpression& rxp)
 
 // operator== -- Returns true if two regular expressions have the same
 // compiled program for pattern matching.
-bool RegularExpression::operator==(const RegularExpression& rxp) const
+bool RegularExpression::operator==(RegularExpression const& rxp) const
 {
   if (this != &rxp) {         // Same address?
     int ind = this->progsize; // Get regular expression size
@@ -115,7 +115,7 @@ bool RegularExpression::operator==(const RegularExpression& rxp) const
 // deep_equal -- Returns true if have the same compiled regular expressions
 // and the same start and end pointers.
 
-bool RegularExpression::deep_equal(const RegularExpression& rxp) const
+bool RegularExpression::deep_equal(RegularExpression const& rxp) const
 {
   int ind = this->progsize;                     // Get regular expression size
   if (ind != rxp.progsize)                      // If different size regexp
@@ -257,7 +257,7 @@ bool RegularExpression::deep_equal(const RegularExpression& rxp) const
 #define NEXT(p) (((*((p) + 1) & 0377) << 8) + (*((p) + 2) & 0377))
 #define OPERAND(p) ((p) + 3)
 
-const unsigned char MAGIC = 0234;
+unsigned char const MAGIC = 0234;
 /*
  * Utility definitions.
  */
@@ -293,7 +293,7 @@ static char* const regdummyptr = &regdummy;
 class RegExpCompile
 {
 public:
-  const char* regparse; // Input-scan pointer.
+  char const* regparse; // Input-scan pointer.
   int regnpar;          // () count.
   char* regcode;        // Code-emit pointer; regdummyptr = don't.
   long regsize;         // Code size.
@@ -305,11 +305,11 @@ public:
   char* regnode(char);
   void regc(char);
   void reginsert(char, char*);
-  static void regtail(char*, const char*);
-  static void regoptail(char*, const char*);
+  static void regtail(char*, char const*);
+  static void regoptail(char*, char const*);
 };
 
-static const char* regnext(const char*);
+static char const* regnext(char const*);
 static char* regnext(char*);
 
 #ifdef STRCSPN
@@ -333,10 +333,10 @@ static int strcspn();
 // compile -- compile a regular expression into internal code
 // for later pattern matching.
 
-bool RegularExpression::compile(const char* exp)
+bool RegularExpression::compile(char const* exp)
 {
-  const char* scan;
-  const char* longest;
+  char const* scan;
+  char const* longest;
   int flags;
 
   if (!exp) {
@@ -799,7 +799,7 @@ void RegExpCompile::reginsert(char op, char* opnd)
 /*
  - regtail - set the next-pointer at the end of a node chain
  */
-void RegExpCompile::regtail(char* p, const char* val)
+void RegExpCompile::regtail(char* p, char const* val)
 {
   char* scan;
   char* temp;
@@ -828,7 +828,7 @@ void RegExpCompile::regtail(char* p, const char* val)
 /*
  - regoptail - regtail on operand of first argument; nop if operandless
  */
-void RegExpCompile::regoptail(char* p, const char* val)
+void RegExpCompile::regoptail(char* p, char const* val)
 {
   // "Operandless" and "op != BRANCH" are synonymous in practice.
   if (!p || p == regdummyptr || OP(p) != BRANCH)
@@ -848,14 +848,14 @@ void RegExpCompile::regoptail(char* p, const char* val)
 class RegExpFind
 {
 public:
-  const char* reginput;   // String-input pointer.
-  const char* regbol;     // Beginning of input, for ^ check.
-  const char** regstartp; // Pointer to startp array.
-  const char** regendp;   // Ditto for endp.
-
-  int regtry(const char*, const char**, const char**, const char*);
-  int regmatch(const char*);
-  int regrepeat(const char*);
+  char const* reginput;   // String-input pointer.
+  char const* regbol;     // Beginning of input, for ^ check.
+  char const** regstartp; // Pointer to startp array.
+  char const** regendp;   // Ditto for endp.
+
+  int regtry(char const*, char const**, char const**, char const*);
+  int regmatch(char const*);
+  int regrepeat(char const*);
 };
 
 // find -- Matches the regular expression to the given string.
@@ -863,7 +863,7 @@ public:
 bool RegularExpression::find(char const* string,
                              RegularExpressionMatch& rmatch) const
 {
-  const char* s;
+  char const* s;
 
   rmatch.clear();
   rmatch.searchstring = string;
@@ -926,12 +926,12 @@ bool RegularExpression::find(char const* string,
  - regtry - try match at specific point
    0 failure, 1 success
  */
-int RegExpFind::regtry(const char* string, const char** start,
-                       const char** end, const char* prog)
+int RegExpFind::regtry(char const* string, char const** start,
+                       char const** end, char const* prog)
 {
   int i;
-  const char** sp1;
-  const char** ep;
+  char const** sp1;
+  char const** ep;
 
   reginput = string;
   regstartp = start;
@@ -962,10 +962,10 @@ int RegExpFind::regtry(const char* string, const char** start,
  * by recursion.
  * 0 failure, 1 success
  */
-int RegExpFind::regmatch(const char* prog)
+int RegExpFind::regmatch(char const* prog)
 {
-  const char* scan; // Current node.
-  const char* next; // Next node.
+  char const* scan; // Current node.
+  char const* next; // Next node.
 
   scan = prog;
 
@@ -989,7 +989,7 @@ int RegExpFind::regmatch(const char* prog)
         break;
       case EXACTLY: {
         size_t len;
-        const char* opnd;
+        char const* opnd;
 
         opnd = OPERAND(scan);
         // Inline the first character, for speed.
@@ -1047,7 +1047,7 @@ int RegExpFind::regmatch(const char* prog)
       case OPEN + 31:
       case OPEN + 32: {
         int no;
-        const char* save;
+        char const* save;
 
         no = OP(scan) - OPEN;
         save = reginput;
@@ -1098,7 +1098,7 @@ int RegExpFind::regmatch(const char* prog)
       case CLOSE + 31:
       case CLOSE + 32: {
         int no;
-        const char* save;
+        char const* save;
 
         no = OP(scan) - CLOSE;
         save = reginput;
@@ -1118,7 +1118,7 @@ int RegExpFind::regmatch(const char* prog)
       //              break;
       case BRANCH: {
 
-        const char* save;
+        char const* save;
 
         if (OP(next) != BRANCH) // No choice.
           next = OPERAND(scan); // Avoid recursion.
@@ -1138,7 +1138,7 @@ int RegExpFind::regmatch(const char* prog)
       case PLUS: {
         char nextch;
         int no;
-        const char* save;
+        char const* save;
         int min_no;
 
         //
@@ -1187,11 +1187,11 @@ int RegExpFind::regmatch(const char* prog)
 /*
  - regrepeat - repeatedly match something simple, report how many
  */
-int RegExpFind::regrepeat(const char* p)
+int RegExpFind::regrepeat(char const* p)
 {
   int count = 0;
-  const char* scan;
-  const char* opnd;
+  char const* scan;
+  char const* opnd;
 
   scan = reginput;
   opnd = OPERAND(p);
@@ -1230,7 +1230,7 @@ int RegExpFind::regrepeat(const char* p)
 /*
  - regnext - dig the "next" pointer out of a node
  */
-static const char* regnext(const char* p)
+static char const* regnext(char const* p)
 {
   int offset;
 

+ 9 - 9
RegularExpression.hxx.in

@@ -55,9 +55,9 @@ public:
 
 private:
   friend class RegularExpression;
-  const char* startp[NSUBEXP];
-  const char* endp[NSUBEXP];
-  const char* searchstring;
+  char const* startp[NSUBEXP];
+  char const* endp[NSUBEXP];
+  char const* searchstring;
 };
 
 #ifdef _MSC_VER
@@ -369,7 +369,7 @@ public:
   /**
    * Copy the given regular expression.
    */
-  RegularExpression& operator=(const RegularExpression& rxp);
+  RegularExpression& operator=(RegularExpression const& rxp);
 
   /**
    * Returns true if two regular expressions have the same
@@ -403,7 +403,7 @@ private:
   RegularExpressionMatch regmatch;
   char regstart;                  // Internal use only
   char reganch;                   // Internal use only
-  const char* regmust;            // Internal use only
+  char const* regmust;            // Internal use only
   std::string::size_type regmlen; // Internal use only
   char* program;
   int progsize;
@@ -425,7 +425,7 @@ inline RegularExpression::RegularExpression()
  * Creates a regular expression from string s, and
  * compiles s.
  */
-inline RegularExpression::RegularExpression(const char* s)
+inline RegularExpression::RegularExpression(char const* s)
   : regstart{}
   , reganch{}
   , regmust{}
@@ -441,7 +441,7 @@ inline RegularExpression::RegularExpression(const char* s)
  * Creates a regular expression from string s, and
  * compiles s.
  */
-inline RegularExpression::RegularExpression(const std::string& s)
+inline RegularExpression::RegularExpression(std::string const& s)
   : regstart{}
   , reganch{}
   , regmust{}
@@ -474,7 +474,7 @@ inline bool RegularExpression::compile(std::string const& s)
  * Matches the regular expression to the given std string.
  * Returns true if found, and sets start and end indexes accordingly.
  */
-inline bool RegularExpression::find(const char* s)
+inline bool RegularExpression::find(char const* s)
 {
   return this->find(s, this->regmatch);
 }
@@ -540,7 +540,7 @@ inline std::string RegularExpression::match(int n) const
  * Returns true if two regular expressions have different
  * compiled program for pattern matching.
  */
-inline bool RegularExpression::operator!=(const RegularExpression& r) const
+inline bool RegularExpression::operator!=(RegularExpression const& r) const
 {
   return (!(*this == r));
 }

+ 4 - 4
String.c

@@ -61,14 +61,14 @@ static char kwsysString_strcasecmp_tolower[] = {
 #  endif
 
 /*--------------------------------------------------------------------------*/
-int kwsysString_strcasecmp(const char* lhs, const char* rhs)
+int kwsysString_strcasecmp(char const* lhs, char const* rhs)
 {
 #  if defined(KWSYS_STRING_USE_STRICMP)
   return _stricmp(lhs, rhs);
 #  elif defined(KWSYS_STRING_USE_STRCASECMP)
   return strcasecmp(lhs, rhs);
 #  else
-  const char* const lower = kwsysString_strcasecmp_tolower;
+  char const* const lower = kwsysString_strcasecmp_tolower;
   unsigned char const* us1 = (unsigned char const*)lhs;
   unsigned char const* us2 = (unsigned char const*)rhs;
   int result;
@@ -79,14 +79,14 @@ int kwsysString_strcasecmp(const char* lhs, const char* rhs)
 }
 
 /*--------------------------------------------------------------------------*/
-int kwsysString_strncasecmp(const char* lhs, const char* rhs, size_t n)
+int kwsysString_strncasecmp(char const* lhs, char const* rhs, size_t n)
 {
 #  if defined(KWSYS_STRING_USE_STRICMP)
   return _strnicmp(lhs, rhs, n);
 #  elif defined(KWSYS_STRING_USE_STRCASECMP)
   return strncasecmp(lhs, rhs, n);
 #  else
-  const char* const lower = kwsysString_strcasecmp_tolower;
+  char const* const lower = kwsysString_strcasecmp_tolower;
   unsigned char const* us1 = (unsigned char const*)lhs;
   unsigned char const* us2 = (unsigned char const*)rhs;
   int result = 0;

+ 2 - 2
String.h.in

@@ -30,13 +30,13 @@ extern "C" {
  * is found to be less than, equal to, or greater than the second
  * string, respectively.
  */
-kwsysEXPORT int kwsysString_strcasecmp(const char* lhs, const char* rhs);
+kwsysEXPORT int kwsysString_strcasecmp(char const* lhs, char const* rhs);
 
 /**
  * Identical to String_strcasecmp except that only the first n
  * characters are considered.
  */
-kwsysEXPORT int kwsysString_strncasecmp(const char* lhs, const char* rhs,
+kwsysEXPORT int kwsysString_strncasecmp(char const* lhs, char const* rhs,
                                         size_t n);
 
 #if defined(__cplusplus)

+ 4 - 4
System.c

@@ -22,7 +22,7 @@ typedef ptrdiff_t kwsysSystem_ptrdiff_t;
 typedef int kwsysSystem_ptrdiff_t;
 #endif
 
-static int kwsysSystem__AppendByte(const char* local, char** begin, char** end,
+static int kwsysSystem__AppendByte(char const* local, char** begin, char** end,
                                    int* size, char c)
 {
   /* Allocate space for the character.  */
@@ -91,7 +91,7 @@ static int kwsysSystem__AppendArgument(char** local, char*** begin,
 
 #define KWSYSPE_LOCAL_BYTE_COUNT 1024
 #define KWSYSPE_LOCAL_ARGS_COUNT 32
-static char** kwsysSystem__ParseUnixCommand(const char* command, int flags)
+static char** kwsysSystem__ParseUnixCommand(char const* command, int flags)
 {
   /* Create a buffer for argument pointers during parsing.  */
   char* local_pointers[KWSYSPE_LOCAL_ARGS_COUNT];
@@ -107,7 +107,7 @@ static char** kwsysSystem__ParseUnixCommand(const char* command, int flags)
 
   /* Parse the command string.  Try to behave like a UNIX shell.  */
   char** newCommand = 0;
-  const char* c = command;
+  char const* c = command;
   int in_argument = 0;
   int in_escape = 0;
   int in_single = 0;
@@ -224,7 +224,7 @@ static char** kwsysSystem__ParseUnixCommand(const char* command, int flags)
   return newCommand;
 }
 
-char** kwsysSystem_Parse_CommandForUnix(const char* command, int flags)
+char** kwsysSystem_Parse_CommandForUnix(char const* command, int flags)
 {
   /* Validate the flags.  */
   if (flags != 0) {

+ 1 - 1
System.h.in

@@ -40,7 +40,7 @@ extern "C" {
  * any character may be escaped by a backslash.  The flags argument is
  * reserved for future use, and must be zero (or the call will fail).
  */
-kwsysEXPORT char** kwsysSystem_Parse_CommandForUnix(const char* command,
+kwsysEXPORT char** kwsysSystem_Parse_CommandForUnix(char const* command,
                                                     int flags);
 
 #if defined(__cplusplus)

+ 81 - 81
SystemInformation.cxx

@@ -272,15 +272,15 @@ public:
   SystemInformationImplementation();
   ~SystemInformationImplementation() = default;
 
-  const char* GetVendorString() const;
-  const char* GetVendorID();
+  char const* GetVendorString() const;
+  char const* GetVendorID();
   std::string GetTypeID() const;
   std::string GetFamilyID() const;
   std::string GetModelID() const;
   std::string GetModelName() const;
   std::string GetSteppingCode() const;
-  const char* GetExtendedProcessorName() const;
-  const char* GetProcessorSerialNumber() const;
+  char const* GetExtendedProcessorName() const;
+  char const* GetProcessorSerialNumber() const;
   int GetProcessorCacheSize() const;
   unsigned int GetLogicalProcessorsPerPhysical() const;
   float GetProcessorClockFrequency() const;
@@ -288,12 +288,12 @@ public:
   int GetProcessorCacheXSize(long int) const;
   bool DoesCPUSupportFeature(long int) const;
 
-  const char* GetOSName();
-  const char* GetHostname();
+  char const* GetOSName();
+  char const* GetHostname();
   int GetFullyQualifiedDomainName(std::string& fqdn);
-  const char* GetOSRelease();
-  const char* GetOSVersion();
-  const char* GetOSPlatform();
+  char const* GetOSRelease();
+  char const* GetOSVersion();
+  char const* GetOSPlatform();
 
   bool Is64Bits() const;
 
@@ -312,11 +312,11 @@ public:
 
   // Retrieve memory information in KiB.
   long long GetHostMemoryTotal();
-  long long GetHostMemoryAvailable(const char* hostLimitEnvVarName);
+  long long GetHostMemoryAvailable(char const* hostLimitEnvVarName);
   long long GetHostMemoryUsed();
 
-  long long GetProcMemoryAvailable(const char* hostLimitEnvVarName,
-                                   const char* procLimitEnvVarName);
+  long long GetProcMemoryAvailable(char const* hostLimitEnvVarName,
+                                   char const* procLimitEnvVarName);
   long long GetProcMemoryUsed();
 
   double GetLoadAverage();
@@ -440,7 +440,7 @@ protected:
 
   // For Linux and Cygwin, /proc/cpuinfo formats are slightly different
   bool RetrieveInformationFromCpuInfoFile();
-  std::string ExtractValueFromCpuInfoFile(std::string buffer, const char* word,
+  std::string ExtractValueFromCpuInfoFile(std::string buffer, char const* word,
                                           size_t init = 0);
 
   bool QueryLinuxMemory();
@@ -449,20 +449,20 @@ protected:
   static void Delay(unsigned int);
   static void DelayOverhead(unsigned int);
 
-  void FindManufacturer(const std::string& family = "");
+  void FindManufacturer(std::string const& family = "");
 
   // For Mac
   bool ParseSysCtl();
-  int CallSwVers(const char* arg, std::string& ver);
+  int CallSwVers(char const* arg, std::string& ver);
   void TrimNewline(std::string&);
-  std::string ExtractValueFromSysCtl(const char* word);
+  std::string ExtractValueFromSysCtl(char const* word);
   std::string SysCtlBuffer;
 
   // For Solaris
   bool QuerySolarisMemory();
   bool QuerySolarisProcessor();
-  std::string ParseValueFromKStat(const char* arguments);
-  std::string RunProcess(std::vector<const char*> args);
+  std::string ParseValueFromKStat(char const* arguments);
+  std::string RunProcess(std::vector<char const*> args);
 
   // For Haiku OS
   bool QueryHaikuInfo();
@@ -518,12 +518,12 @@ SystemInformation::~SystemInformation()
   delete this->Implementation;
 }
 
-const char* SystemInformation::GetVendorString()
+char const* SystemInformation::GetVendorString()
 {
   return this->Implementation->GetVendorString();
 }
 
-const char* SystemInformation::GetVendorID()
+char const* SystemInformation::GetVendorID()
 {
   return this->Implementation->GetVendorID();
 }
@@ -553,12 +553,12 @@ std::string SystemInformation::GetSteppingCode()
   return this->Implementation->GetSteppingCode();
 }
 
-const char* SystemInformation::GetExtendedProcessorName()
+char const* SystemInformation::GetExtendedProcessorName()
 {
   return this->Implementation->GetExtendedProcessorName();
 }
 
-const char* SystemInformation::GetProcessorSerialNumber()
+char const* SystemInformation::GetProcessorSerialNumber()
 {
   return this->Implementation->GetProcessorSerialNumber();
 }
@@ -614,12 +614,12 @@ std::string SystemInformation::GetCPUDescription()
   return tmp;
 }
 
-const char* SystemInformation::GetOSName()
+char const* SystemInformation::GetOSName()
 {
   return this->Implementation->GetOSName();
 }
 
-const char* SystemInformation::GetHostname()
+char const* SystemInformation::GetHostname()
 {
   return this->Implementation->GetHostname();
 }
@@ -631,17 +631,17 @@ std::string SystemInformation::GetFullyQualifiedDomainName()
   return fqdn;
 }
 
-const char* SystemInformation::GetOSRelease()
+char const* SystemInformation::GetOSRelease()
 {
   return this->Implementation->GetOSRelease();
 }
 
-const char* SystemInformation::GetOSVersion()
+char const* SystemInformation::GetOSVersion()
 {
   return this->Implementation->GetOSVersion();
 }
 
-const char* SystemInformation::GetOSPlatform()
+char const* SystemInformation::GetOSPlatform()
 {
   return this->Implementation->GetOSPlatform();
 }
@@ -724,7 +724,7 @@ size_t SystemInformation::GetAvailablePhysicalMemory()
 }
 
 std::string SystemInformation::GetMemoryDescription(
-  const char* hostLimitEnvVarName, const char* procLimitEnvVarName)
+  char const* hostLimitEnvVarName, char const* procLimitEnvVarName)
 {
   std::ostringstream oss;
   oss << "Host Total: " << this->GetHostMemoryTotal()
@@ -743,7 +743,7 @@ long long SystemInformation::GetHostMemoryTotal()
 }
 
 long long SystemInformation::GetHostMemoryAvailable(
-  const char* hostLimitEnvVarName)
+  char const* hostLimitEnvVarName)
 {
   return this->Implementation->GetHostMemoryAvailable(hostLimitEnvVarName);
 }
@@ -755,7 +755,7 @@ long long SystemInformation::GetHostMemoryUsed()
 
 // process memory info in units of KiB.
 long long SystemInformation::GetProcMemoryAvailable(
-  const char* hostLimitEnvVarName, const char* procLimitEnvVarName)
+  char const* hostLimitEnvVarName, char const* procLimitEnvVarName)
 {
   return this->Implementation->GetProcMemoryAvailable(hostLimitEnvVarName,
                                                       procLimitEnvVarName);
@@ -827,7 +827,7 @@ int LoadLines(FILE* file, std::vector<std::string>& lines)
 {
   // Load each line in the given file into a the vector.
   int nRead = 0;
-  const int bufSize = 1024;
+  int const bufSize = 1024;
   char buf[bufSize] = { '\0' };
   while (!feof(file) && !ferror(file)) {
     errno = 0;
@@ -854,7 +854,7 @@ int LoadLines(FILE* file, std::vector<std::string>& lines)
 
 #  if defined(__linux) || defined(__CYGWIN__)
 // *****************************************************************************
-int LoadLines(const char* fileName, std::vector<std::string>& lines)
+int LoadLines(char const* fileName, std::vector<std::string>& lines)
 {
   FILE* file = fopen(fileName, "r");
   if (!file) {
@@ -888,7 +888,7 @@ int NameValue(std::vector<std::string> const& lines, std::string const& name,
 #if defined(__linux) || defined(__CYGWIN__)
 // ****************************************************************************
 template <typename T>
-int GetFieldsFromFile(const char* fileName, const char** fieldNames, T* values)
+int GetFieldsFromFile(char const* fileName, char const** fieldNames, T* values)
 {
   std::vector<std::string> fields;
   if (!LoadLines(fileName, fields)) {
@@ -907,9 +907,9 @@ int GetFieldsFromFile(const char* fileName, const char** fieldNames, T* values)
 
 // ****************************************************************************
 template <typename T>
-int GetFieldFromFile(const char* fileName, const char* fieldName, T& value)
+int GetFieldFromFile(char const* fileName, char const* fieldName, T& value)
 {
-  const char* fieldNames[2] = { fieldName, nullptr };
+  char const* fieldNames[2] = { fieldName, nullptr };
   T values[1] = { T(0) };
   int ierr = GetFieldsFromFile(fileName, fieldNames, values);
   if (ierr) {
@@ -923,7 +923,7 @@ int GetFieldFromFile(const char* fileName, const char* fieldName, T& value)
 // ****************************************************************************
 #if defined(__APPLE__)
 template <typename T>
-int GetFieldsFromCommand(const char* command, const char** fieldNames,
+int GetFieldsFromCommand(char const* command, char const** fieldNames,
                          T* values)
 {
   FILE* file = popen(command, "r");
@@ -1181,14 +1181,14 @@ public:
   // Description:
   // Set/Get the name of the binary file that the symbol
   // is found in.
-  void SetBinary(const char* binary) { this->Binary = safes(binary); }
+  void SetBinary(char const* binary) { this->Binary = safes(binary); }
 
   std::string GetBinary() const;
 
   // Description:
   // Set the name of the function that the symbol is found in.
   // If c++ demangling is supported it will be demangled.
-  void SetFunction(const char* function)
+  void SetFunction(char const* function)
   {
     this->Function = this->Demangle(function);
   }
@@ -1198,7 +1198,7 @@ public:
   // Description:
   // Set/Get the name of the source file where the symbol
   // is defined.
-  void SetSourceFile(const char* sourcefile)
+  void SetSourceFile(char const* sourcefile)
   {
     this->SourceFile = safes(sourcefile);
   }
@@ -1228,8 +1228,8 @@ private:
                                static_cast<char*>(this->BinaryBaseAddress));
   }
 
-  std::string GetFileName(const std::string& path) const;
-  std::string Demangle(const char* symbol) const;
+  std::string GetFileName(std::string const& path) const;
+  std::string Demangle(char const* symbol) const;
 
 private:
   std::string Binary;
@@ -1241,7 +1241,7 @@ private:
   int ReportPath;
 };
 
-std::ostream& operator<<(std::ostream& os, const SymbolProperties& sp)
+std::ostream& operator<<(std::ostream& os, SymbolProperties const& sp)
 {
 #  if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP)
   os << std::hex << sp.GetAddress() << " : " << sp.GetFunction() << " [("
@@ -1277,7 +1277,7 @@ SymbolProperties::SymbolProperties()
   this->GetLineNumber();
 }
 
-std::string SymbolProperties::GetFileName(const std::string& path) const
+std::string SymbolProperties::GetFileName(std::string const& path) const
 {
   std::string file(path);
   if (!this->ReportPath) {
@@ -1309,7 +1309,7 @@ std::string SymbolProperties::GetBinary() const
   return this->GetFileName(this->Binary);
 }
 
-std::string SymbolProperties::Demangle(const char* symbol) const
+std::string SymbolProperties::Demangle(char const* symbol) const
 {
   std::string result = safes(symbol);
 #  if defined(KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE)
@@ -1517,19 +1517,19 @@ void SystemInformationImplementation::RunMemoryCheck()
 }
 
 /** Get the vendor string */
-const char* SystemInformationImplementation::GetVendorString() const
+char const* SystemInformationImplementation::GetVendorString() const
 {
   return this->ChipID.Vendor.c_str();
 }
 
 /** Get the OS Name */
-const char* SystemInformationImplementation::GetOSName()
+char const* SystemInformationImplementation::GetOSName()
 {
   return this->OSName.c_str();
 }
 
 /** Get the hostname */
-const char* SystemInformationImplementation::GetHostname()
+char const* SystemInformationImplementation::GetHostname()
 {
   if (this->Hostname.empty()) {
     this->Hostname = "localhost";
@@ -1623,7 +1623,7 @@ int SystemInformationImplementation::GetFullyQualifiedDomainName(
         !(ifa->ifa_flags & IFF_LOOPBACK)) {
       char host[NI_MAXHOST] = { '\0' };
 
-      const size_t addrlen = (fam == AF_INET ? sizeof(struct sockaddr_in)
+      size_t const addrlen = (fam == AF_INET ? sizeof(struct sockaddr_in)
                                              : sizeof(struct sockaddr_in6));
 
       ierr = getnameinfo(ifa->ifa_addr, static_cast<socklen_t>(addrlen), host,
@@ -1656,25 +1656,25 @@ int SystemInformationImplementation::GetFullyQualifiedDomainName(
 }
 
 /** Get the OS release */
-const char* SystemInformationImplementation::GetOSRelease()
+char const* SystemInformationImplementation::GetOSRelease()
 {
   return this->OSRelease.c_str();
 }
 
 /** Get the OS version */
-const char* SystemInformationImplementation::GetOSVersion()
+char const* SystemInformationImplementation::GetOSVersion()
 {
   return this->OSVersion.c_str();
 }
 
 /** Get the OS platform */
-const char* SystemInformationImplementation::GetOSPlatform()
+char const* SystemInformationImplementation::GetOSPlatform()
 {
   return this->OSPlatform.c_str();
 }
 
 /** Get the vendor ID */
-const char* SystemInformationImplementation::GetVendorID()
+char const* SystemInformationImplementation::GetVendorID()
 {
   // Return the vendor ID.
   switch (this->ChipManufacturer) {
@@ -1756,14 +1756,14 @@ std::string SystemInformationImplementation::GetSteppingCode() const
 }
 
 /** Return the stepping code of the CPU present. */
-const char* SystemInformationImplementation::GetExtendedProcessorName() const
+char const* SystemInformationImplementation::GetExtendedProcessorName() const
 {
   return this->ChipID.ProcessorName.c_str();
 }
 
 /** Return the serial number of the processor
  *  in hexadecimal: xxxx-xxxx-xxxx-xxxx-xxxx-xxxx. */
-const char* SystemInformationImplementation::GetProcessorSerialNumber() const
+char const* SystemInformationImplementation::GetProcessorSerialNumber() const
 {
   return this->ChipID.SerialNumber.c_str();
 }
@@ -2055,7 +2055,7 @@ bool SystemInformationImplementation::RetrieveCPUFeatures()
 
 /** Find the manufacturer given the vendor id */
 void SystemInformationImplementation::FindManufacturer(
-  const std::string& family)
+  std::string const& family)
 {
   if (this->ChipID.Vendor == "GenuineIntel")
     this->ChipManufacturer = Intel; // Intel Corp.
@@ -3363,7 +3363,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
 
 /** Extract a value from the CPUInfo file */
 std::string SystemInformationImplementation::ExtractValueFromCpuInfoFile(
-  std::string buffer, const char* word, size_t init)
+  std::string buffer, char const* word, size_t init)
 {
   size_t pos = buffer.find(word, init);
   if (pos != std::string::npos) {
@@ -3418,7 +3418,7 @@ bool SystemInformationImplementation::RetrieveInformationFromCpuInfoFile()
   buffer.resize(fileSize - 2);
   // Number of logical CPUs (combination of multiple processors, multi-core
   // and SMT)
-  const char* processor_string =
+  char const* processor_string =
 #ifdef __s390x__
     "cpu number";
 #else
@@ -3548,7 +3548,7 @@ bool SystemInformationImplementation::RetrieveInformationFromCpuInfoFile()
   // L1 Cache size
   // Different architectures may show different names for the caches.
   // Sum up everything we find.
-  std::vector<const char*> cachename;
+  std::vector<char const*> cachename;
   cachename.clear();
 
   cachename.push_back("cache size"); // e.g. x86
@@ -3676,7 +3676,7 @@ Get total system RAM in units of KiB. This may differ from the
 host total if a host-wide resource limit is applied.
 */
 long long SystemInformationImplementation::GetHostMemoryAvailable(
-  const char* hostLimitEnvVarName)
+  char const* hostLimitEnvVarName)
 {
   long long memTotal = this->GetHostMemoryTotal();
 
@@ -3687,7 +3687,7 @@ long long SystemInformationImplementation::GetHostMemoryAvailable(
   // access to it is severely restricted. The system will
   // apply a limit across a set of processes. Units are in KiB.
   if (hostLimitEnvVarName) {
-    const char* hostLimitEnvVarValue = getenv(hostLimitEnvVarName);
+    char const* hostLimitEnvVarValue = getenv(hostLimitEnvVarName);
     if (hostLimitEnvVarValue) {
       long long hostLimit = std::atoll(hostLimitEnvVarValue);
       if (hostLimit > 0) {
@@ -3704,14 +3704,14 @@ Get total system RAM in units of KiB. This may differ from the
 host total if a per-process resource limit is applied.
 */
 long long SystemInformationImplementation::GetProcMemoryAvailable(
-  const char* hostLimitEnvVarName, const char* procLimitEnvVarName)
+  char const* hostLimitEnvVarName, char const* procLimitEnvVarName)
 {
   long long memAvail = this->GetHostMemoryAvailable(hostLimitEnvVarName);
 
   // the following mechanism is provide for systems where rlimits
   // are not employed. Units are in KiB.
   if (procLimitEnvVarName) {
-    const char* procLimitEnvVarValue = getenv(procLimitEnvVarName);
+    char const* procLimitEnvVarValue = getenv(procLimitEnvVarName);
     if (procLimitEnvVarValue) {
       long long procLimit = std::atoll(procLimitEnvVarValue);
       if (procLimit > 0) {
@@ -3767,7 +3767,7 @@ long long SystemInformationImplementation::GetHostMemoryUsed()
   return (statex.ullTotalPhys - statex.ullAvailPhys) / 1024;
 #  endif
 #elif defined(__CYGWIN__)
-  const char* names[3] = { "MemTotal:", "MemFree:", nullptr };
+  char const* names[3] = { "MemTotal:", "MemFree:", nullptr };
   long long values[2] = { 0 };
   int ierr = GetFieldsFromFile("/proc/meminfo", names, values);
   if (ierr) {
@@ -3778,11 +3778,11 @@ long long SystemInformationImplementation::GetHostMemoryUsed()
   return memTotal - memFree;
 #elif defined(__linux)
   // First try to use MemAvailable, but it only works on newer kernels
-  const char* names2[3] = { "MemTotal:", "MemAvailable:", nullptr };
+  char const* names2[3] = { "MemTotal:", "MemAvailable:", nullptr };
   long long values2[2] = { 0 };
   int ierr = GetFieldsFromFile("/proc/meminfo", names2, values2);
   if (ierr) {
-    const char* names4[5] = { "MemTotal:", "MemFree:", "Buffers:", "Cached:",
+    char const* names4[5] = { "MemTotal:", "MemFree:", "Buffers:", "Cached:",
                               nullptr };
     long long values4[4] = { 0 };
     ierr = GetFieldsFromFile("/proc/meminfo", names4, values4);
@@ -3803,7 +3803,7 @@ long long SystemInformationImplementation::GetHostMemoryUsed()
   if (psz < 1) {
     return -1;
   }
-  const char* names[3] = { "Pages wired down:", "Pages active:", nullptr };
+  char const* names[3] = { "Pages wired down:", "Pages active:", nullptr };
   long long values[2] = { 0 };
   int ierr = GetFieldsFromCommand("vm_stat", names, values);
   if (ierr) {
@@ -4163,7 +4163,7 @@ bool SystemInformationImplementation::QueryLinuxMemory()
       mSwapTotal,
       mSwapFree
     };
-    const char* format[6] = { "MemTotal:%lu kB",  "MemFree:%lu kB",
+    char const* format[6] = { "MemTotal:%lu kB",  "MemFree:%lu kB",
                               "Buffers:%lu kB",   "Cached:%lu kB",
                               "SwapTotal:%lu kB", "SwapFree:%lu kB" };
     bool have[6] = { false, false, false, false, false, false };
@@ -4418,7 +4418,7 @@ unsigned char SystemInformationImplementation::GetAPICId()
 #if USE_CPUID
   if (!this->IsSMTSupported()) {
     return static_cast<unsigned char>(-1); // HT not supported
-  }                                        // Logical processor = 1
+  } // Logical processor = 1
   call_cpuid(1, Regs);
 #endif
 
@@ -4496,7 +4496,7 @@ unsigned int SystemInformationImplementation::GetNumberOfPhysicalCPU() const
 }
 
 #if defined(__APPLE__)
-static int kw_sysctlbyname_int32(const char* name, int32_t* value)
+static int kw_sysctlbyname_int32(char const* name, int32_t* value)
 {
   size_t len = sizeof(int32_t);
   int err = sysctlbyname(name, value, &len, nullptr, 0);
@@ -4506,7 +4506,7 @@ static int kw_sysctlbyname_int32(const char* name, int32_t* value)
   return err;
 }
 
-static int kw_sysctlbyname_int64(const char* name, int64_t* value)
+static int kw_sysctlbyname_int64(char const* name, int64_t* value)
 {
   size_t len = sizeof(int64_t);
   int err = sysctlbyname(name, value, &len, nullptr, 0);
@@ -4748,7 +4748,7 @@ bool SystemInformationImplementation::ParseSysCtl()
 
 /** Extract a value from sysctl command */
 std::string SystemInformationImplementation::ExtractValueFromSysCtl(
-  const char* word)
+  char const* word)
 {
   size_t pos = this->SysCtlBuffer.find(word);
   if (pos != std::string::npos) {
@@ -4763,7 +4763,7 @@ std::string SystemInformationImplementation::ExtractValueFromSysCtl(
 
 /** Run a given process */
 std::string SystemInformationImplementation::RunProcess(
-  std::vector<const char*> args)
+  std::vector<char const*> args)
 {
   std::string out;
 
@@ -4821,7 +4821,7 @@ std::string SystemInformationImplementation::RunProcess(
 }
 
 std::string SystemInformationImplementation::ParseValueFromKStat(
-  const char* arguments)
+  char const* arguments)
 {
   std::vector<std::string> args_string;
   std::string command = arguments;
@@ -4854,11 +4854,11 @@ std::string SystemInformationImplementation::ParseValueFromKStat(
   command.erase(0, start + 1);
   args_string.push_back(command);
 
-  std::vector<const char*> args;
+  std::vector<char const*> args;
   args.reserve(3 + args_string.size());
   args.push_back("kstat");
   args.push_back("-p");
-  for (const auto& i : args_string) {
+  for (auto const& i : args_string) {
     args.push_back(i.c_str());
   }
   args.push_back(nullptr);
@@ -5020,7 +5020,7 @@ bool SystemInformationImplementation::QueryQNXMemory()
 {
 #if defined(__QNX__)
   std::string buffer;
-  std::vector<const char*> args;
+  std::vector<char const*> args;
   args.clear();
 
   args.push_back("showmem");
@@ -5080,7 +5080,7 @@ bool SystemInformationImplementation::QueryQNXProcessor()
   // the output on my QNX 6.4.1 looks like this:
   // Processor1: 686 Pentium II Stepping 3 2175MHz FPU
   std::string buffer;
-  std::vector<const char*> args;
+  std::vector<char const*> args;
   args.clear();
 
   args.push_back("pidin");
@@ -5499,8 +5499,8 @@ bool SystemInformationImplementation::QueryOSInformation()
   }
   this->Hostname = name;
 
-  const char* arch = getenv("PROCESSOR_ARCHITECTURE");
-  const char* wow64 = getenv("PROCESSOR_ARCHITEW6432");
+  char const* arch = getenv("PROCESSOR_ARCHITECTURE");
+  char const* wow64 = getenv("PROCESSOR_ARCHITEW6432");
   if (arch) {
     this->OSPlatform = arch;
   }
@@ -5547,11 +5547,11 @@ bool SystemInformationImplementation::QueryOSInformation()
   return true;
 }
 
-int SystemInformationImplementation::CallSwVers(const char* arg,
+int SystemInformationImplementation::CallSwVers(char const* arg,
                                                 std::string& ver)
 {
 #ifdef __APPLE__
-  std::vector<const char*> args;
+  std::vector<char const*> args;
   args.push_back("sw_vers");
   args.push_back(arg);
   args.push_back(nullptr);

+ 40 - 40
SystemInformation.hxx.in

@@ -20,47 +20,47 @@ class @KWSYS_NAMESPACE@_EXPORT SystemInformation
 
 public:
   // possible parameter values for DoesCPUSupportFeature()
-  static const long int CPU_FEATURE_MMX = 1 << 0;
-  static const long int CPU_FEATURE_MMX_PLUS = 1 << 1;
-  static const long int CPU_FEATURE_SSE = 1 << 2;
-  static const long int CPU_FEATURE_SSE2 = 1 << 3;
-  static const long int CPU_FEATURE_AMD_3DNOW = 1 << 4;
-  static const long int CPU_FEATURE_AMD_3DNOW_PLUS = 1 << 5;
-  static const long int CPU_FEATURE_IA64 = 1 << 6;
-  static const long int CPU_FEATURE_MP_CAPABLE = 1 << 7;
-  static const long int CPU_FEATURE_HYPERTHREAD = 1 << 8;
-  static const long int CPU_FEATURE_SERIALNUMBER = 1 << 9;
-  static const long int CPU_FEATURE_APIC = 1 << 10;
-  static const long int CPU_FEATURE_SSE_FP = 1 << 11;
-  static const long int CPU_FEATURE_SSE_MMX = 1 << 12;
-  static const long int CPU_FEATURE_CMOV = 1 << 13;
-  static const long int CPU_FEATURE_MTRR = 1 << 14;
-  static const long int CPU_FEATURE_L1CACHE = 1 << 15;
-  static const long int CPU_FEATURE_L2CACHE = 1 << 16;
-  static const long int CPU_FEATURE_L3CACHE = 1 << 17;
-  static const long int CPU_FEATURE_ACPI = 1 << 18;
-  static const long int CPU_FEATURE_THERMALMONITOR = 1 << 19;
-  static const long int CPU_FEATURE_TEMPSENSEDIODE = 1 << 20;
-  static const long int CPU_FEATURE_FREQUENCYID = 1 << 21;
-  static const long int CPU_FEATURE_VOLTAGEID_FREQUENCY = 1 << 22;
-  static const long int CPU_FEATURE_FPU = 1 << 23;
+  static long int const CPU_FEATURE_MMX = 1 << 0;
+  static long int const CPU_FEATURE_MMX_PLUS = 1 << 1;
+  static long int const CPU_FEATURE_SSE = 1 << 2;
+  static long int const CPU_FEATURE_SSE2 = 1 << 3;
+  static long int const CPU_FEATURE_AMD_3DNOW = 1 << 4;
+  static long int const CPU_FEATURE_AMD_3DNOW_PLUS = 1 << 5;
+  static long int const CPU_FEATURE_IA64 = 1 << 6;
+  static long int const CPU_FEATURE_MP_CAPABLE = 1 << 7;
+  static long int const CPU_FEATURE_HYPERTHREAD = 1 << 8;
+  static long int const CPU_FEATURE_SERIALNUMBER = 1 << 9;
+  static long int const CPU_FEATURE_APIC = 1 << 10;
+  static long int const CPU_FEATURE_SSE_FP = 1 << 11;
+  static long int const CPU_FEATURE_SSE_MMX = 1 << 12;
+  static long int const CPU_FEATURE_CMOV = 1 << 13;
+  static long int const CPU_FEATURE_MTRR = 1 << 14;
+  static long int const CPU_FEATURE_L1CACHE = 1 << 15;
+  static long int const CPU_FEATURE_L2CACHE = 1 << 16;
+  static long int const CPU_FEATURE_L3CACHE = 1 << 17;
+  static long int const CPU_FEATURE_ACPI = 1 << 18;
+  static long int const CPU_FEATURE_THERMALMONITOR = 1 << 19;
+  static long int const CPU_FEATURE_TEMPSENSEDIODE = 1 << 20;
+  static long int const CPU_FEATURE_FREQUENCYID = 1 << 21;
+  static long int const CPU_FEATURE_VOLTAGEID_FREQUENCY = 1 << 22;
+  static long int const CPU_FEATURE_FPU = 1 << 23;
 
 public:
   SystemInformation();
   ~SystemInformation();
 
-  SystemInformation(const SystemInformation&) = delete;
-  SystemInformation& operator=(const SystemInformation&) = delete;
+  SystemInformation(SystemInformation const&) = delete;
+  SystemInformation& operator=(SystemInformation const&) = delete;
 
-  const char* GetVendorString();
-  const char* GetVendorID();
+  char const* GetVendorString();
+  char const* GetVendorID();
   std::string GetTypeID();
   std::string GetFamilyID();
   std::string GetModelID();
   std::string GetModelName();
   std::string GetSteppingCode();
-  const char* GetExtendedProcessorName();
-  const char* GetProcessorSerialNumber();
+  char const* GetExtendedProcessorName();
+  char const* GetProcessorSerialNumber();
   int GetProcessorCacheSize();
   unsigned int GetLogicalProcessorsPerPhysical();
   float GetProcessorClockFrequency();
@@ -72,13 +72,13 @@ public:
   // on this system.
   std::string GetCPUDescription();
 
-  const char* GetHostname();
+  char const* GetHostname();
   std::string GetFullyQualifiedDomainName();
 
-  const char* GetOSName();
-  const char* GetOSRelease();
-  const char* GetOSVersion();
-  const char* GetOSPlatform();
+  char const* GetOSName();
+  char const* GetOSRelease();
+  char const* GetOSVersion();
+  char const* GetOSPlatform();
 
   int GetOSIsWindows();
   int GetOSIsLinux();
@@ -108,8 +108,8 @@ public:
   // returns an informative general description if the installed and
   // available ram on this system. See the GetHostMemoryTotal, and
   // Get{Host,Proc}MemoryAvailable methods for more information.
-  std::string GetMemoryDescription(const char* hostLimitEnvVarName = nullptr,
-                                   const char* procLimitEnvVarName = nullptr);
+  std::string GetMemoryDescription(char const* hostLimitEnvVarName = nullptr,
+                                   char const* procLimitEnvVarName = nullptr);
 
   // Retrieve amount of physical memory installed on the system in KiB
   // units.
@@ -121,7 +121,7 @@ public:
   // parallel. The amount of memory reported may differ from the host
   // total if a host wide resource limit is applied. Such reource limits
   // are reported to us via an application specified environment variable.
-  long long GetHostMemoryAvailable(const char* hostLimitEnvVarName = nullptr);
+  long long GetHostMemoryAvailable(char const* hostLimitEnvVarName = nullptr);
 
   // Get total system RAM in units of KiB available to this process.
   // This may differ from the host available if a per-process resource
@@ -129,8 +129,8 @@ public:
   // system via rlimit API. Resource limits that are not imposed via
   // rlimit API may be reported to us via an application specified
   // environment variable.
-  long long GetProcMemoryAvailable(const char* hostLimitEnvVarName = nullptr,
-                                   const char* procLimitEnvVarName = nullptr);
+  long long GetProcMemoryAvailable(char const* hostLimitEnvVarName = nullptr,
+                                   char const* procLimitEnvVarName = nullptr);
 
   // Get the system RAM used by all processes on the host, in units of KiB.
   long long GetHostMemoryUsed();

Разлика између датотеке није приказан због своје велике величине
+ 135 - 135
SystemTools.cxx


+ 137 - 137
SystemTools.hxx.in

@@ -54,8 +54,8 @@ public:
   SystemToolsManager();
   ~SystemToolsManager();
 
-  SystemToolsManager(const SystemToolsManager&) = delete;
-  SystemToolsManager& operator=(const SystemToolsManager&) = delete;
+  SystemToolsManager(SystemToolsManager const&) = delete;
+  SystemToolsManager& operator=(SystemToolsManager const&) = delete;
 };
 
 // This instance will show up in any translation unit that uses
@@ -69,16 +69,16 @@ static SystemToolsManager SystemToolsManagerInstance;
 typedef int TestFilePermissions;
 #if defined(_WIN32) && !defined(__CYGWIN__)
 // On Windows (VC), no system header defines these constants...
-static const TestFilePermissions TEST_FILE_OK = 0;
-static const TestFilePermissions TEST_FILE_READ = 4;
-static const TestFilePermissions TEST_FILE_WRITE = 2;
-static const TestFilePermissions TEST_FILE_EXECUTE = 1;
+static TestFilePermissions const TEST_FILE_OK = 0;
+static TestFilePermissions const TEST_FILE_READ = 4;
+static TestFilePermissions const TEST_FILE_WRITE = 2;
+static TestFilePermissions const TEST_FILE_EXECUTE = 1;
 #else
 // Standard POSIX constants
-static const TestFilePermissions TEST_FILE_OK = F_OK;
-static const TestFilePermissions TEST_FILE_READ = R_OK;
-static const TestFilePermissions TEST_FILE_WRITE = W_OK;
-static const TestFilePermissions TEST_FILE_EXECUTE = X_OK;
+static TestFilePermissions const TEST_FILE_OK = F_OK;
+static TestFilePermissions const TEST_FILE_READ = R_OK;
+static TestFilePermissions const TEST_FILE_WRITE = W_OK;
+static TestFilePermissions const TEST_FILE_EXECUTE = X_OK;
 #endif
 
 /** \class SystemTools
@@ -99,9 +99,9 @@ public:
    * then an underscore is prepended.  Note that this can produce
    * identifiers that the standard reserves (_[A-Z].* and __.*).
    */
-  static std::string MakeCidentifier(const std::string& s);
+  static std::string MakeCidentifier(std::string const& s);
 
-  static std::string MakeCindentifier(const std::string& s)
+  static std::string MakeCindentifier(std::string const& s)
   {
     return MakeCidentifier(s);
   }
@@ -109,123 +109,123 @@ public:
   /**
    * Replace replace all occurrences of the string in the source string.
    */
-  static void ReplaceString(std::string& source, const char* replace,
-                            const char* with);
-  static void ReplaceString(std::string& source, const std::string& replace,
-                            const std::string& with);
+  static void ReplaceString(std::string& source, char const* replace,
+                            char const* with);
+  static void ReplaceString(std::string& source, std::string const& replace,
+                            std::string const& with);
 
   /**
    * Return a capitalized string (i.e the first letter is uppercased,
    * all other are lowercased).
    */
-  static std::string Capitalized(const std::string&);
+  static std::string Capitalized(std::string const&);
 
   /**
    * Return a 'capitalized words' string (i.e the first letter of each word
    * is uppercased all other are left untouched though).
    */
-  static std::string CapitalizedWords(const std::string&);
+  static std::string CapitalizedWords(std::string const&);
 
   /**
    * Return a 'uncapitalized words' string (i.e the first letter of each word
    * is lowercased all other are left untouched though).
    */
-  static std::string UnCapitalizedWords(const std::string&);
+  static std::string UnCapitalizedWords(std::string const&);
 
   /**
    * Return a lower case string
    */
-  static std::string LowerCase(const std::string&);
+  static std::string LowerCase(std::string const&);
 
   /**
    * Return a lower case string
    */
-  static std::string UpperCase(const std::string&);
+  static std::string UpperCase(std::string const&);
 
   /**
    * Count char in string
    */
-  static size_t CountChar(const char* str, char c);
+  static size_t CountChar(char const* str, char c);
 
   /**
    * Remove some characters from a string.
    * Return a pointer to the new resulting string (allocated with 'new')
    */
-  static char* RemoveChars(const char* str, const char* toremove);
+  static char* RemoveChars(char const* str, char const* toremove);
 
   /**
    * Remove remove all but 0->9, A->F characters from a string.
    * Return a pointer to the new resulting string (allocated with 'new')
    */
-  static char* RemoveCharsButUpperHex(const char* str);
+  static char* RemoveCharsButUpperHex(char const* str);
 
   /**
    * Replace some characters by another character in a string (in-place)
    * Return a pointer to string
    */
-  static char* ReplaceChars(char* str, const char* toreplace,
+  static char* ReplaceChars(char* str, char const* toreplace,
                             char replacement);
 
   /**
    * Returns true if str1 starts (respectively ends) with str2
    */
-  static bool StringStartsWith(const char* str1, const char* str2);
-  static bool StringStartsWith(const std::string& str1, const char* str2);
-  static bool StringEndsWith(const char* str1, const char* str2);
-  static bool StringEndsWith(const std::string& str1, const char* str2);
+  static bool StringStartsWith(char const* str1, char const* str2);
+  static bool StringStartsWith(std::string const& str1, char const* str2);
+  static bool StringEndsWith(char const* str1, char const* str2);
+  static bool StringEndsWith(std::string const& str1, char const* str2);
 
   /**
    * Returns a pointer to the last occurrence of str2 in str1
    */
-  static const char* FindLastString(const char* str1, const char* str2);
+  static char const* FindLastString(char const* str1, char const* str2);
 
   /**
    * Make a duplicate of the string similar to the strdup C function
    * but use new to create the 'new' string, so one can use
    * 'delete' to remove it. Returns 0 if the input is empty.
    */
-  static char* DuplicateString(const char* str);
+  static char* DuplicateString(char const* str);
 
   /**
    * Return the string cropped to a given length by removing chars in the
    * center of the string and replacing them with an ellipsis (...)
    */
-  static std::string CropString(const std::string&, size_t max_len);
+  static std::string CropString(std::string const&, size_t max_len);
 
   /** split a path by separator into an array of strings, default is /.
       If isPath is true then the string is treated like a path and if
       s starts with a / then the first element of the returned array will
       be /, so /foo/bar will be [/, foo, bar]
   */
-  static std::vector<std::string> SplitString(const std::string& s,
+  static std::vector<std::string> SplitString(std::string const& s,
                                               char separator = '/',
                                               bool isPath = false);
   /**
    * Perform a case-independent string comparison
    */
-  static int Strucmp(const char* s1, const char* s2);
+  static int Strucmp(char const* s1, char const* s2);
 
   /**
    * Split a string on its newlines into multiple lines
    * Return false only if the last line stored had no newline
    */
-  static bool Split(const std::string& s, std::vector<std::string>& l);
-  static bool Split(const std::string& s, std::vector<std::string>& l,
+  static bool Split(std::string const& s, std::vector<std::string>& l);
+  static bool Split(std::string const& s, std::vector<std::string>& l,
                     char separator);
 
   /**
    * Joins a vector of strings into a single string, with separator in between
    * each string.
    */
-  static std::string Join(const std::vector<std::string>& list,
-                          const std::string& separator);
+  static std::string Join(std::vector<std::string> const& list,
+                          std::string const& separator);
 
   /**
    * Return string with space added between capitalized words
    * (i.e. EatMyShorts becomes Eat My Shorts )
    * (note that IEatShorts becomes IEat Shorts)
    */
-  static std::string AddSpaceBetweenCapitalizedWords(const std::string&);
+  static std::string AddSpaceBetweenCapitalizedWords(std::string const&);
 
   /**
    * Append two or more strings and produce new one.
@@ -233,9 +233,9 @@ public:
    * with 'new'.
    * Return 0 if inputs are empty or there was an error
    */
-  static char* AppendStrings(const char* str1, const char* str2);
-  static char* AppendStrings(const char* str1, const char* str2,
-                             const char* str3);
+  static char* AppendStrings(char const* str1, char const* str2);
+  static char* AppendStrings(char const* str1, char const* str2,
+                             char const* str3);
 
   /**
    * Estimate the length of the string that will be produced
@@ -246,12 +246,12 @@ public:
    * you will not be able to use this 'ap' anymore from the beginning.
    * It's up to you to call va_end though.
    */
-  static int EstimateFormatLength(const char* format, va_list ap);
+  static int EstimateFormatLength(char const* format, va_list ap);
 
   /**
    * Escape specific characters in 'str'.
    */
-  static std::string EscapeChars(const char* str, const char* chars_to_escape,
+  static std::string EscapeChars(char const* str, char const* chars_to_escape,
                                  char escape_char = '\\');
 
   /** -----------------------------------------------------------------
@@ -266,20 +266,20 @@ public:
 
 #ifdef _WIN32
   /** Calls Encoding::ToWindowsExtendedPath.  */
-  static std::wstring ConvertToWindowsExtendedPath(const std::string&);
+  static std::wstring ConvertToWindowsExtendedPath(std::string const&);
 #endif
 
   /**
    * For windows this calls ConvertToWindowsOutputPath and for unix
    * it calls ConvertToUnixOutputPath
    */
-  static std::string ConvertToOutputPath(const std::string&);
+  static std::string ConvertToOutputPath(std::string const&);
 
   /**
    * Convert the path to a string that can be used in a unix makefile.
    * double slashes are removed, and spaces are escaped.
    */
-  static std::string ConvertToUnixOutputPath(const std::string&);
+  static std::string ConvertToUnixOutputPath(std::string const&);
 
   /**
    * Convert the path to string that can be used in a windows project or
@@ -287,12 +287,12 @@ public:
    * the string, the slashes are converted to windows style backslashes, and
    * if there are spaces in the string it is double quoted.
    */
-  static std::string ConvertToWindowsOutputPath(const std::string&);
+  static std::string ConvertToWindowsOutputPath(std::string const&);
 
   /**
    * Return true if a path with the given name exists in the current directory.
    */
-  static bool PathExists(const std::string& path);
+  static bool PathExists(std::string const& path);
 
   /**
    * Return true if a file exists in the current directory.
@@ -302,10 +302,10 @@ public:
    * also be checked for read access.  (Currently, this check
    * for read access is only done on POSIX systems.)
    */
-  static bool FileExists(const char* filename, bool isFile);
-  static bool FileExists(const std::string& filename, bool isFile);
-  static bool FileExists(const char* filename);
-  static bool FileExists(const std::string& filename);
+  static bool FileExists(char const* filename, bool isFile);
+  static bool FileExists(std::string const& filename, bool isFile);
+  static bool FileExists(char const* filename);
+  static bool FileExists(std::string const& filename);
 
   /**
    * Test if a file exists and can be accessed with the requested
@@ -317,9 +317,9 @@ public:
    * considered readable, and writable files are considered to
    * have the read-only file attribute cleared.
    */
-  static bool TestFileAccess(const char* filename,
+  static bool TestFileAccess(char const* filename,
                              TestFilePermissions permissions);
-  static bool TestFileAccess(const std::string& filename,
+  static bool TestFileAccess(std::string const& filename,
                              TestFilePermissions permissions);
 /**
  * Cross platform wrapper for stat struct
@@ -336,13 +336,13 @@ public:
    * On Windows this may not work for paths longer than 250 characters
    * due to limitations of the underlying '_wstat64' call.
    */
-  static int Stat(const char* path, Stat_t* buf);
-  static int Stat(const std::string& path, Stat_t* buf);
+  static int Stat(char const* path, Stat_t* buf);
+  static int Stat(std::string const& path, Stat_t* buf);
 
   /**
    * Return file length
    */
-  static unsigned long FileLength(const std::string& filename);
+  static unsigned long FileLength(std::string const& filename);
 
   /**
      Change the modification time or create a file
@@ -362,7 +362,7 @@ public:
    *  Get the file extension (including ".") needed for an executable
    *  on the current platform ("" for unix, ".exe" for Windows).
    */
-  static const char* GetExecutableExtension();
+  static char const* GetExecutableExtension();
 
   /**
    * Given a path on a Windows machine, return the actual case of
@@ -371,15 +371,15 @@ public:
    * returned unchanged.  Drive letters are always made upper case.
    * This does nothing on non-Windows systems but return the path.
    */
-  static std::string GetActualCaseForPath(const std::string& path);
+  static std::string GetActualCaseForPath(std::string const& path);
 
   /**
    * Given the path to a program executable, get the directory part of
    * the path with the file stripped off.  If there is no directory
    * part, the empty string is returned.
    */
-  static std::string GetProgramPath(const std::string&);
-  static bool SplitProgramPath(const std::string& in_name, std::string& dir,
+  static std::string GetProgramPath(std::string const&);
+  static bool SplitProgramPath(std::string const& in_name, std::string& dir,
                                std::string& file, bool errorReport = true);
 
   /**
@@ -394,7 +394,7 @@ public:
    *  buildDir is a possibly null path to the build directory.
    *  installPrefix is a possibly null pointer to the install directory.
    */
-  static bool FindProgramPath(const char* argv0, std::string& pathOut,
+  static bool FindProgramPath(char const* argv0, std::string& pathOut,
                               std::string& errorMsg);
 
   /**
@@ -405,7 +405,7 @@ public:
    */
   static std::string CollapseFullPath(std::string const& in_path);
   static std::string CollapseFullPath(std::string const& in_path,
-                                      const char* in_base);
+                                      char const* in_base);
   static std::string CollapseFullPath(std::string const& in_path,
                                       std::string const& in_base);
 
@@ -416,7 +416,7 @@ public:
    * nullptr.  Otherwise empty string is returned and errorMessage
    * contains error description.
    */
-  static std::string GetRealPath(const std::string& path,
+  static std::string GetRealPath(std::string const& path,
                                  std::string* errorMessage = nullptr);
 
   /**
@@ -434,7 +434,7 @@ public:
    * returned.  The root component is stored in the "root" string if
    * given.
    */
-  static const char* SplitPathRootComponent(const std::string& p,
+  static char const* SplitPathRootComponent(std::string const& p,
                                             std::string* root = nullptr);
 
   /**
@@ -451,7 +451,7 @@ public:
    * preserved, including empty ones.  Typically callers should use
    * this only on paths that have already been normalized.
    */
-  static void SplitPath(const std::string& p,
+  static void SplitPath(std::string const& p,
                         std::vector<std::string>& components,
                         bool expand_home_dir = true);
 
@@ -463,50 +463,50 @@ public:
    * preserved, including empty ones.  Typically callers should use
    * this only on paths that have already been normalized.
    */
-  static std::string JoinPath(const std::vector<std::string>& components);
+  static std::string JoinPath(std::vector<std::string> const& components);
   static std::string JoinPath(std::vector<std::string>::const_iterator first,
                               std::vector<std::string>::const_iterator last);
 
   /**
    * Compare a path or components of a path.
    */
-  static bool ComparePath(const std::string& c1, const std::string& c2);
+  static bool ComparePath(std::string const& c1, std::string const& c2);
 
   /**
    * Return path of a full filename (no trailing slashes)
    */
-  static std::string GetFilenamePath(const std::string&);
+  static std::string GetFilenamePath(std::string const&);
 
   /**
    * Return file name of a full filename (i.e. file name without path)
    */
-  static std::string GetFilenameName(const std::string&);
+  static std::string GetFilenameName(std::string const&);
 
   /**
    * Return longest file extension of a full filename (dot included)
    */
-  static std::string GetFilenameExtension(const std::string&);
+  static std::string GetFilenameExtension(std::string const&);
 
   /**
    * Return shortest file extension of a full filename (dot included)
    */
-  static std::string GetFilenameLastExtension(const std::string& filename);
+  static std::string GetFilenameLastExtension(std::string const& filename);
 
   /**
    * Return file name without extension of a full filename
    */
-  static std::string GetFilenameWithoutExtension(const std::string&);
+  static std::string GetFilenameWithoutExtension(std::string const&);
 
   /**
    * Return file name without its last (shortest) extension
    */
-  static std::string GetFilenameWithoutLastExtension(const std::string&);
+  static std::string GetFilenameWithoutLastExtension(std::string const&);
 
   /**
    * Return whether the path represents a full path (not relative)
    */
-  static bool FileIsFullPath(const std::string&);
-  static bool FileIsFullPath(const char*);
+  static bool FileIsFullPath(std::string const&);
+  static bool FileIsFullPath(char const*);
 
   /**
    * For windows return the short path for the given path,
@@ -527,13 +527,13 @@ public:
   /**
    * Get the parent directory of the directory or file
    */
-  static std::string GetParentDirectory(const std::string& fileOrDir);
+  static std::string GetParentDirectory(std::string const& fileOrDir);
 
   /**
    * Check if the given file or directory is in subdirectory of dir
    */
-  static bool IsSubDirectory(const std::string& fileOrDir,
-                             const std::string& dir);
+  static bool IsSubDirectory(std::string const& fileOrDir,
+                             std::string const& dir);
 
   /** -----------------------------------------------------------------
    *               File Manipulation Routines
@@ -544,7 +544,7 @@ public:
    * Open a file considering unicode. On Windows, if 'e' is present in
    * mode it is first discarded.
    */
-  static FILE* Fopen(const std::string& file, const char* mode);
+  static FILE* Fopen(std::string const& file, char const* mode);
 
 /**
  * Visual C++ does not define mode_t.
@@ -558,9 +558,9 @@ public:
    * can make a full path even if none of the directories existed
    * prior to calling this function.
    */
-  static Status MakeDirectory(const char* path, const mode_t* mode = nullptr);
+  static Status MakeDirectory(char const* path, mode_t const* mode = nullptr);
   static Status MakeDirectory(std::string const& path,
-                              const mode_t* mode = nullptr);
+                              mode_t const* mode = nullptr);
 
   /**
    * Represent the result of a file copy operation.
@@ -595,15 +595,15 @@ public:
   /**
    * Compare the contents of two files.  Return true if different
    */
-  static bool FilesDiffer(const std::string& source,
-                          const std::string& destination);
+  static bool FilesDiffer(std::string const& source,
+                          std::string const& destination);
 
   /**
    * Compare the contents of two files, ignoring line ending differences.
    * Return true if different
    */
-  static bool TextFilesDiffer(const std::string& path1,
-                              const std::string& path2);
+  static bool TextFilesDiffer(std::string const& path1,
+                              std::string const& path2);
 
   /**
    * Blockwise copy source to destination file
@@ -628,8 +628,8 @@ public:
     WindowsFileId(unsigned long volumeSerialNumber,
                   unsigned long fileIndexHigh, unsigned long fileIndexLow);
 
-    bool operator==(const WindowsFileId& o) const;
-    bool operator!=(const WindowsFileId& o) const;
+    bool operator==(WindowsFileId const& o) const;
+    bool operator!=(WindowsFileId const& o) const;
 
   private:
     unsigned long m_volumeSerialNumber;
@@ -645,8 +645,8 @@ public:
     UnixFileId(dev_t volumeSerialNumber, ino_t fileSerialNumber,
                off_t fileSize);
 
-    bool operator==(const UnixFileId& o) const;
-    bool operator!=(const UnixFileId& o) const;
+    bool operator==(UnixFileId const& o) const;
+    bool operator!=(UnixFileId const& o) const;
 
   private:
     dev_t m_volumeSerialNumber;
@@ -660,12 +660,12 @@ public:
    * Outputs a FileId for the given file or directory.
    * Returns true on success, false on failure
    */
-  static bool GetFileId(const std::string& file, FileId& id);
+  static bool GetFileId(std::string const& file, FileId& id);
 
   /**
    * Return true if the two files are the same file
    */
-  static bool SameFile(const std::string& file1, const std::string& file2);
+  static bool SameFile(std::string const& file1, std::string const& file2);
 
   /**
    * Copy a file.
@@ -711,49 +711,49 @@ public:
    * Find a file in the system PATH, with optional extra paths
    */
   static std::string FindFile(
-    const std::string& name,
-    const std::vector<std::string>& path = std::vector<std::string>(),
+    std::string const& name,
+    std::vector<std::string> const& path = std::vector<std::string>(),
     bool no_system_path = false);
 
   /**
    * Find a directory in the system PATH, with optional extra paths
    */
   static std::string FindDirectory(
-    const std::string& name,
-    const std::vector<std::string>& path = std::vector<std::string>(),
+    std::string const& name,
+    std::vector<std::string> const& path = std::vector<std::string>(),
     bool no_system_path = false);
 
   /**
    * Find an executable in the system PATH, with optional extra paths
    */
   static std::string FindProgram(
-    const char* name,
-    const std::vector<std::string>& path = std::vector<std::string>(),
+    char const* name,
+    std::vector<std::string> const& path = std::vector<std::string>(),
     bool no_system_path = false);
   static std::string FindProgram(
-    const std::string& name,
-    const std::vector<std::string>& path = std::vector<std::string>(),
+    std::string const& name,
+    std::vector<std::string> const& path = std::vector<std::string>(),
     bool no_system_path = false);
   static std::string FindProgram(
-    const std::vector<std::string>& names,
-    const std::vector<std::string>& path = std::vector<std::string>(),
+    std::vector<std::string> const& names,
+    std::vector<std::string> const& path = std::vector<std::string>(),
     bool no_system_path = false);
 
   /**
    * Find a library in the system PATH, with optional extra paths
    */
-  static std::string FindLibrary(const std::string& name,
-                                 const std::vector<std::string>& path);
+  static std::string FindLibrary(std::string const& name,
+                                 std::vector<std::string> const& path);
 
   /**
    * Return true if the file is a directory
    */
-  static bool FileIsDirectory(const std::string& name);
+  static bool FileIsDirectory(std::string const& name);
 
   /**
    * Return true if the file is an executable
    */
-  static bool FileIsExecutable(const std::string& name);
+  static bool FileIsExecutable(std::string const& name);
 
 #if defined(_WIN32)
   /**
@@ -761,24 +761,24 @@ public:
    * Only available on Windows. This avoids an expensive `GetFileAttributesW`
    * call.
    */
-  static bool FileIsSymlinkWithAttr(const std::wstring& path,
+  static bool FileIsSymlinkWithAttr(std::wstring const& path,
                                     unsigned long attr);
 #endif
 
   /**
    * Return true if the file is a symlink
    */
-  static bool FileIsSymlink(const std::string& name);
+  static bool FileIsSymlink(std::string const& name);
 
   /**
    * Return true if the file is a FIFO
    */
-  static bool FileIsFIFO(const std::string& name);
+  static bool FileIsFIFO(std::string const& name);
 
   /**
    * Return true if the file has a given signature (first set of bytes)
    */
-  static bool FileHasSignature(const char* filename, const char* signature,
+  static bool FileHasSignature(char const* filename, char const* signature,
                                long offset = 0);
 
   /**
@@ -796,7 +796,7 @@ public:
     FileTypeBinary,
     FileTypeText
   };
-  static SystemTools::FileTypeEnum DetectFileType(const char* filename,
+  static SystemTools::FileTypeEnum DetectFileType(char const* filename,
                                                   unsigned long length = 256,
                                                   double percent_bin = 0.05);
 
@@ -828,7 +828,7 @@ public:
    * etc.
    * Return true if the file was found, false otherwise.
    */
-  static bool LocateFileInDir(const char* filename, const char* dir,
+  static bool LocateFileInDir(char const* filename, char const* dir,
                               std::string& filename_found,
                               int try_filename_dirs = 0);
 
@@ -840,18 +840,18 @@ public:
       /a/b/c/d to /a/b/c1/d1 -> ../../c1/d1
       from /usr/src to /usr/src/test/blah/foo.cpp -> test/blah/foo.cpp
   */
-  static std::string RelativePath(const std::string& local,
-                                  const std::string& remote);
+  static std::string RelativePath(std::string const& local,
+                                  std::string const& remote);
 
   /**
    * Return file's modified time
    */
-  static long int ModifiedTime(const std::string& filename);
+  static long int ModifiedTime(std::string const& filename);
 
   /**
    * Return file's creation time (Win32: works only for NTFS, not FAT)
    */
-  static long int CreationTime(const std::string& filename);
+  static long int CreationTime(std::string const& filename);
 
   /**
    * Get and set permissions of the file.  If honor_umask is set, the umask
@@ -861,9 +861,9 @@ public:
    * WARNING:  A non-thread-safe method is currently used to get the umask
    * if a honor_umask parameter is set to true.
    */
-  static Status GetPermissions(const char* file, mode_t& mode);
+  static Status GetPermissions(char const* file, mode_t& mode);
   static Status GetPermissions(std::string const& file, mode_t& mode);
-  static Status SetPermissions(const char* file, mode_t mode,
+  static Status SetPermissions(char const* file, mode_t mode,
                                bool honor_umask = false);
   static Status SetPermissions(std::string const& file, mode_t mode,
                                bool honor_umask = false);
@@ -879,7 +879,7 @@ public:
   /**
    * Get current date/time
    */
-  static std::string GetCurrentDateTime(const char* format);
+  static std::string GetCurrentDateTime(char const* format);
 
   /** -----------------------------------------------------------------
    *               Registry Manipulation Routines
@@ -901,27 +901,27 @@ public:
   /**
    * Get a list of subkeys.
    */
-  static bool GetRegistrySubKeys(const std::string& key,
+  static bool GetRegistrySubKeys(std::string const& key,
                                  std::vector<std::string>& subkeys,
                                  KeyWOW64 view = KeyWOW64_Default);
 
   /**
    * Read a registry value
    */
-  static bool ReadRegistryValue(const std::string& key, std::string& value,
+  static bool ReadRegistryValue(std::string const& key, std::string& value,
                                 KeyWOW64 view = KeyWOW64_Default);
 
   /**
    * Write a registry value
    */
-  static bool WriteRegistryValue(const std::string& key,
-                                 const std::string& value,
+  static bool WriteRegistryValue(std::string const& key,
+                                 std::string const& value,
                                  KeyWOW64 view = KeyWOW64_Default);
 
   /**
    * Delete a registry value
    */
-  static bool DeleteRegistryValue(const std::string& key,
+  static bool DeleteRegistryValue(std::string const& key,
                                   KeyWOW64 view = KeyWOW64_Default);
 
   /** -----------------------------------------------------------------
@@ -935,25 +935,25 @@ public:
    *  of env will be used instead of PATH.
    */
   static void GetPath(std::vector<std::string>& path,
-                      const char* env = nullptr);
+                      char const* env = nullptr);
 
   /**
    * Read an environment variable
    */
-  static const char* GetEnv(const char* key);
-  static const char* GetEnv(const std::string& key);
-  static bool GetEnv(const char* key, std::string& result);
-  static bool GetEnv(const std::string& key, std::string& result);
-  static bool HasEnv(const char* key);
-  static bool HasEnv(const std::string& key);
+  static char const* GetEnv(char const* key);
+  static char const* GetEnv(std::string const& key);
+  static bool GetEnv(char const* key, std::string& result);
+  static bool GetEnv(std::string const& key, std::string& result);
+  static bool HasEnv(char const* key);
+  static bool HasEnv(std::string const& key);
 
   /** Put a string into the environment
       of the form var=value */
-  static bool PutEnv(const std::string& env);
+  static bool PutEnv(std::string const& env);
 
   /** Remove a string from the environment.
       Input is of the form "var" or "var=value" (value is ignored). */
-  static bool UnPutEnv(const std::string& env);
+  static bool UnPutEnv(std::string const& env);
 
   /**
    * Get current working directory CWD
@@ -1008,7 +1008,7 @@ public:
    * decode the dataglom using DecodeURL if set to true.
    * Return false if the URL does not have the required form, true otherwise.
    */
-  static bool ParseURLProtocol(const std::string& URL, std::string& protocol,
+  static bool ParseURLProtocol(std::string const& URL, std::string& protocol,
                                std::string& dataglom, bool decode = false);
 
   /**
@@ -1019,7 +1019,7 @@ public:
    * decode all string except the protocol using DecodeUrl if set to true.
    * Return true if the string matches the format; false otherwise.
    */
-  static bool ParseURL(const std::string& URL, std::string& protocol,
+  static bool ParseURL(std::string const& URL, std::string& protocol,
                        std::string& username, std::string& password,
                        std::string& hostname, std::string& dataport,
                        std::string& datapath, bool decode = false);
@@ -1030,7 +1030,7 @@ public:
    * Does not perform any other sort of validation.
    * Return the decoded string
    */
-  static std::string DecodeURL(const std::string& url);
+  static std::string DecodeURL(std::string const& url);
 
 private:
   static void ClassInitialize();

+ 8 - 8
Terminal.c

@@ -48,7 +48,7 @@ static void kwsysTerminalSetConsoleColor(HANDLE hOut,
                                          FILE* stream, int color);
 #endif
 
-void kwsysTerminal_cfprintf(int color, FILE* stream, const char* format, ...)
+void kwsysTerminal_cfprintf(int color, FILE* stream, char const* format, ...)
 {
   /* Setup the stream with the given color if possible.  */
   int pipeIsConsole = 0;
@@ -106,7 +106,7 @@ static int kwsysTerminalStreamIsNotInteractive(FILE* stream)
 #endif
 
 /* List of terminal names known to support VT100 color escape sequences.  */
-static const char* kwsysTerminalVT100Names[] = { "Eterm",
+static char const* kwsysTerminalVT100Names[] = { "Eterm",
                                                  "alacritty",
                                                  "alacritty-direct",
                                                  "ansi",
@@ -170,7 +170,7 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
 {
   /* Force color according to https://bixense.com/clicolors/ convention.  */
   {
-    const char* clicolor_force = getenv("CLICOLOR_FORCE");
+    char const* clicolor_force = getenv("CLICOLOR_FORCE");
     if (clicolor_force && *clicolor_force &&
         strcmp(clicolor_force, "0") != 0) {
       return 1;
@@ -179,7 +179,7 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
 
   /* Disable color according to https://bixense.com/clicolors/ convention. */
   {
-    const char* clicolor = getenv("CLICOLOR");
+    char const* clicolor = getenv("CLICOLOR");
     if (clicolor && strcmp(clicolor, "0") == 0) {
       return 0;
     }
@@ -187,7 +187,7 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
 
   /* GNU make 4.1+ may tell us that its output is destined for a TTY. */
   {
-    const char* termout = getenv("MAKE_TERMOUT");
+    char const* termout = getenv("MAKE_TERMOUT");
     if (termout && *termout != '\0') {
       return 1;
     }
@@ -197,7 +197,7 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
      seem to claim the TERM is xterm even though they do not support
      VT100 escapes.  */
   {
-    const char* emacs = getenv("EMACS");
+    char const* emacs = getenv("EMACS");
     if (emacs && *emacs == 't') {
       return 0;
     }
@@ -205,8 +205,8 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
 
   /* Check for a valid terminal.  */
   if (!default_vt100) {
-    const char** t = 0;
-    const char* term = getenv("TERM");
+    char const** t = 0;
+    char const* term = getenv("TERM");
     if (term) {
       for (t = kwsysTerminalVT100Names; *t && strcmp(term, *t) != 0; ++t) {
       }

+ 1 - 1
Terminal.h.in

@@ -92,7 +92,7 @@ extern "C" {
  *   color specification.
  */
 kwsysEXPORT void kwsysTerminal_cfprintf(int color, FILE* stream,
-                                        const char* format, ...);
+                                        char const* format, ...);
 enum kwsysTerminal_Color_e
 {
   /* Normal Text */

+ 1 - 1
kwsysPlatformTestsCXX.cxx

@@ -147,7 +147,7 @@ int main()
   int status = 0;
   size_t bufferLen = 512;
   char buffer[512] = { '\0' };
-  const char* function = "_ZN5kwsys17SystemInformation15GetProgramStackEii";
+  char const* function = "_ZN5kwsys17SystemInformation15GetProgramStackEii";
   char* demangledFunction =
     abi::__cxa_demangle(function, buffer, &bufferLen, &status);
   return status;

+ 5 - 5
testCommandLineArguments.cxx

@@ -17,7 +17,7 @@
 
 static void* random_ptr = reinterpret_cast<void*>(0x123);
 
-static int argument(const char* arg, const char* value, void* call_data)
+static int argument(char const* arg, char const* value, void* call_data)
 {
   std::cout << "Got argument: \"" << arg << "\" value: \""
             << (value ? value : "(null)") << "\"" << std::endl;
@@ -28,7 +28,7 @@ static int argument(const char* arg, const char* value, void* call_data)
   return 1;
 }
 
-static int unknown_argument(const char* argument, void* call_data)
+static int unknown_argument(char const* argument, void* call_data)
 {
   std::cout << "Got unknown argument: \"" << argument << "\"" << std::endl;
   if (call_data != random_ptr) {
@@ -50,11 +50,11 @@ static bool CompareTwoItemsOnList(double i1, double i2)
 {
   return i1 == i2;
 }
-static bool CompareTwoItemsOnList(const char* i1, const char* i2)
+static bool CompareTwoItemsOnList(char const* i1, char const* i2)
 {
   return strcmp(i1, i2) == 0;
 }
-static bool CompareTwoItemsOnList(const std::string& i1, const std::string& i2)
+static bool CompareTwoItemsOnList(std::string const& i1, std::string const& i2)
 {
   return i1 == i2;
 }
@@ -93,7 +93,7 @@ int testCommandLineArguments(int argc, char* argv[])
   bool valid_bools[] = { true, true, false };
 
   std::vector<char*> strings_argument;
-  const char* valid_strings[] = { "andy", "bill", "brad", "ken" };
+  char const* valid_strings[] = { "andy", "bill", "brad", "ken" };
 
   std::vector<std::string> stl_strings_argument;
   std::string valid_stl_strings[] = { "ken", "brad", "bill", "andy" };

+ 1 - 1
testCommandLineArguments1.cxx

@@ -57,7 +57,7 @@ int testCommandLineArguments1(int argc, char* argv[])
   int newArgc = 0;
   arg.GetUnusedArguments(&newArgc, &newArgv);
   int cc;
-  const char* valid_unused_args[9] = { nullptr,
+  char const* valid_unused_args[9] = { nullptr,
                                        "--ignored",
                                        "--second-ignored",
                                        "third-ignored",

+ 9 - 9
testConsoleBuf.cxx

@@ -62,20 +62,20 @@ static void displayError(DWORD errorCode)
   std::cerr.unsetf(std::ios::hex);
 }
 
-std::basic_streambuf<char>* errstream(const char* unused)
+std::basic_streambuf<char>* errstream(char const* unused)
 {
   static_cast<void>(unused);
   return std::cerr.rdbuf();
 }
 
-std::basic_streambuf<wchar_t>* errstream(const wchar_t* unused)
+std::basic_streambuf<wchar_t>* errstream(wchar_t const* unused)
 {
   static_cast<void>(unused);
   return std::wcerr.rdbuf();
 }
 
 template <typename T>
-static void dumpBuffers(const T* expected, const T* received, size_t size)
+static void dumpBuffers(T const* expected, T const* received, size_t size)
 {
   std::basic_ostream<T> err(errstream(expected));
   err << "Expected output: '" << std::basic_string<T>(expected, size) << "'"
@@ -346,7 +346,7 @@ static int testPipe()
           dumpBuffers<char>(encodedTestString.c_str(), buffer2,
                             encodedTestString.size());
         }
-      } catch (const std::runtime_error& ex) {
+      } catch (std::runtime_error const& ex) {
         DWORD lastError = GetLastError();
         std::cerr << "In function testPipe, line " << __LINE__ << ": "
                   << ex.what() << std::endl;
@@ -354,7 +354,7 @@ static int testPipe()
       }
       finishProcess(didFail == 0);
     }
-  } catch (const std::runtime_error& ex) {
+  } catch (std::runtime_error const& ex) {
     DWORD lastError = GetLastError();
     std::cerr << "In function testPipe, line " << __LINE__ << ": " << ex.what()
               << std::endl;
@@ -452,7 +452,7 @@ static int testFile()
           dumpBuffers<char>(encodedTestString.c_str(), buffer2,
                             encodedTestString.size());
         }
-      } catch (const std::runtime_error& ex) {
+      } catch (std::runtime_error const& ex) {
         DWORD lastError = GetLastError();
         std::cerr << "In function testFile, line " << __LINE__ << ": "
                   << ex.what() << std::endl;
@@ -460,7 +460,7 @@ static int testFile()
       }
       finishProcess(didFail == 0);
     }
-  } catch (const std::runtime_error& ex) {
+  } catch (std::runtime_error const& ex) {
     DWORD lastError = GetLastError();
     std::cerr << "In function testFile, line " << __LINE__ << ": " << ex.what()
               << std::endl;
@@ -524,7 +524,7 @@ static int testConsole()
 #      pragma warning(disable : 4996)
 #    endif
 #  endif
-  const bool isVistaOrGreater =
+  bool const isVistaOrGreater =
     LOBYTE(LOWORD(GetVersion())) >= HIBYTE(_WIN32_WINNT_VISTA);
 #  ifdef KWSYS_WINDOWS_DEPRECATED_GetVersion
 #    ifdef __clang__
@@ -746,7 +746,7 @@ static int testConsole()
                              wideInputTestString.size() - 1);
       }
       delete[] outputBuffer;
-    } catch (const std::runtime_error& ex) {
+    } catch (std::runtime_error const& ex) {
       DWORD lastError = GetLastError();
       std::cerr << "In function testConsole, line " << __LINE__ << ": "
                 << ex.what() << std::endl;

+ 4 - 4
testConsoleBuf.hxx

@@ -3,13 +3,13 @@
 #ifndef testConsoleBuf_hxx
 #define testConsoleBuf_hxx
 
-static const wchar_t cmdConsoleBufChild[] = L"testConsoleBufChild";
+static wchar_t const cmdConsoleBufChild[] = L"testConsoleBufChild";
 
-static const wchar_t BeforeInputEventName[] = L"BeforeInputEvent";
-static const wchar_t AfterOutputEventName[] = L"AfterOutputEvent";
+static wchar_t const BeforeInputEventName[] = L"BeforeInputEvent";
+static wchar_t const AfterOutputEventName[] = L"AfterOutputEvent";
 
 // यूनिकोड είναι здорово!
-static const wchar_t UnicodeTestString[] =
+static wchar_t const UnicodeTestString[] =
   L"\u092F\u0942\u0928\u093F\u0915\u094B\u0921 "
   L"\u03B5\u03AF\u03BD\0\u03B1\u03B9 "
   L"\u0437\u0434\u043E\u0440\u043E\u0432\u043E!";

+ 1 - 1
testConsoleBufChild.cxx

@@ -16,7 +16,7 @@
 
 #include "testConsoleBuf.hxx"
 
-int main(int argc, const char* argv[])
+int main(int argc, char const* argv[])
 {
 #if defined(_WIN32)
   kwsys::ConsoleBuf::Manager out(std::cout);

+ 5 - 5
testDirectory.cxx

@@ -22,7 +22,7 @@ file Copyright.txt or https://cmake.org/licensing#kwsys for details.  */
 static int doLongPathTest()
 {
   using namespace kwsys;
-  static const int LONG_PATH_THRESHOLD = 512;
+  static int const LONG_PATH_THRESHOLD = 512;
   int res = 0;
   std::string topdir(TEST_SYSTEMTOOLS_BINARY_DIR "/directory_testing/");
   std::stringstream testpathstrm;
@@ -108,20 +108,20 @@ static int nonExistentDirectoryTest()
 static int copyDirectoryTest()
 {
   using namespace kwsys;
-  const std::string source(TEST_SYSTEMTOOLS_BINARY_DIR
+  std::string const source(TEST_SYSTEMTOOLS_BINARY_DIR
                            "/directory_testing/copyDirectoryTestSrc");
   if (SystemTools::PathExists(source)) {
     std::cerr << source << " shouldn't exist before test" << std::endl;
     return 1;
   }
-  const std::string destination(TEST_SYSTEMTOOLS_BINARY_DIR
+  std::string const destination(TEST_SYSTEMTOOLS_BINARY_DIR
                                 "/directory_testing/copyDirectoryTestDst");
   if (SystemTools::PathExists(destination)) {
     std::cerr << destination << " shouldn't exist before test" << std::endl;
     return 2;
   }
-  const Status copysuccess = SystemTools::CopyADirectory(source, destination);
-  const bool destinationexists = SystemTools::PathExists(destination);
+  Status const copysuccess = SystemTools::CopyADirectory(source, destination);
+  bool const destinationexists = SystemTools::PathExists(destination);
   if (copysuccess.IsSuccess()) {
     std::cerr << "CopyADirectory should have returned false" << std::endl;
     SystemTools::RemoveADirectory(destination);

+ 2 - 2
testDynamicLoader.cxx

@@ -44,7 +44,7 @@
 // is referenced semantically.
 #include "testDynload.h"
 
-static std::string GetLibName(const char* lname, const char* subdir = nullptr)
+static std::string GetLibName(char const* lname, char const* subdir = nullptr)
 {
   // Construct proper name of lib
   std::string slname;
@@ -71,7 +71,7 @@ static std::string GetLibName(const char* lname, const char* subdir = nullptr)
  * r2: should GetSymbolAddress succeed ?
  * r3: should CloseLibrary succeed ?
  */
-static int TestDynamicLoader(const char* libname, const char* symbol, int r1,
+static int TestDynamicLoader(char const* libname, char const* symbol, int r1,
                              int r2, int r3, int flags = 0)
 {
   std::cerr << "Testing: " << libname << std::endl;

+ 5 - 5
testEncode.c

@@ -12,14 +12,14 @@
 #include <stdio.h>
 #include <string.h>
 
-static const unsigned char testMD5input1[] =
+static unsigned char const testMD5input1[] =
   "  A quick brown fox jumps over the lazy dog.\n"
   "  This is sample text for MD5 sum input.\n";
-static const char testMD5output1[] = "8f146af46ed4f267921bb937d4d3500c";
+static char const testMD5output1[] = "8f146af46ed4f267921bb937d4d3500c";
 
-static const int testMD5input2len = 28;
-static const unsigned char testMD5input2[] = "the cow jumped over the moon";
-static const char testMD5output2[] = "a2ad137b746138fae4e5adca9c85d3ae";
+static int const testMD5input2len = 28;
+static unsigned char const testMD5input2[] = "the cow jumped over the moon";
+static char const testMD5output2[] = "a2ad137b746138fae4e5adca9c85d3ae";
 
 static int testMD5_1(kwsysMD5* md5)
 {

+ 5 - 5
testEncoding.cxx

@@ -22,7 +22,7 @@
 #  include "Encoding.hxx.in"
 #endif
 
-static const unsigned char helloWorldStrings[][32] = {
+static unsigned char const helloWorldStrings[][32] = {
   // English
   { 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', 0 },
   // Japanese
@@ -53,7 +53,7 @@ static int testHelloWorldEncoding()
 {
   int ret = 0;
   for (int i = 0; helloWorldStrings[i][0] != 0; i++) {
-    std::string str = reinterpret_cast<const char*>(helloWorldStrings[i]);
+    std::string str = reinterpret_cast<char const*>(helloWorldStrings[i]);
     std::cout << str << std::endl;
     std::wstring wstr = kwsys::Encoding::ToWide(str);
     std::string str2 = kwsys::Encoding::ToNarrow(wstr);
@@ -86,7 +86,7 @@ static int testRobustEncoding()
 
   wstr = kwsys::Encoding::ToWide(nullptr);
   if (!wstr.empty()) {
-    const wchar_t* wcstr = wstr.c_str();
+    wchar_t const* wcstr = wstr.c_str();
     std::cout << "ToWide(NULL) returned";
     for (size_t i = 0; i < wstr.size(); i++) {
       std::cout << " " << std::hex << static_cast<int>(wcstr[i]);
@@ -96,7 +96,7 @@ static int testRobustEncoding()
   }
   wstr = kwsys::Encoding::ToWide("");
   if (!wstr.empty()) {
-    const wchar_t* wcstr = wstr.c_str();
+    wchar_t const* wcstr = wstr.c_str();
     std::cout << "ToWide(\"\") returned";
     for (size_t i = 0; i < wstr.size(); i++) {
       std::cout << " " << std::hex << static_cast<int>(wcstr[i]);
@@ -268,7 +268,7 @@ static int testToWindowsExtendedPath()
 
 int testEncoding(int, char*[])
 {
-  const char* loc = setlocale(LC_ALL, "");
+  char const* loc = setlocale(LC_ALL, "");
   if (loc) {
     std::cout << "Locale: " << loc << std::endl;
   } else {

+ 6 - 6
testFStream.cxx

@@ -27,8 +27,8 @@ static int testNoFile()
   return 0;
 }
 
-static const int num_test_files = 7;
-static const int max_test_file_size = 45;
+static int const num_test_files = 7;
+static int const max_test_file_size = 45;
 
 static kwsys::FStream::BOM expected_bom[num_test_files] = {
   kwsys::FStream::BOM_None,    kwsys::FStream::BOM_None,
@@ -71,9 +71,9 @@ static int testBOM()
   for (int i = 0; i < num_test_files; i++) {
     {
       kwsys::ofstream out("bom.txt", kwsys::ofstream::binary);
-      out.write(reinterpret_cast<const char*>(expected_bom_data[i] + 1),
+      out.write(reinterpret_cast<char const*>(expected_bom_data[i] + 1),
                 *expected_bom_data[i]);
-      out.write(reinterpret_cast<const char*>(file_data[i] + 1),
+      out.write(reinterpret_cast<char const*>(file_data[i] + 1),
                 file_data[i][0]);
     }
 
@@ -106,9 +106,9 @@ static int testBOMIO()
     kwsys::fstream f("bomio.txt",
                      kwsys::fstream::in | kwsys::fstream::out |
                        kwsys::fstream::binary | kwsys::fstream::trunc);
-    f.write(reinterpret_cast<const char*>(expected_bom_data[i] + 1),
+    f.write(reinterpret_cast<char const*>(expected_bom_data[i] + 1),
             *expected_bom_data[i]);
-    f.write(reinterpret_cast<const char*>(file_data[i] + 1), file_data[i][0]);
+    f.write(reinterpret_cast<char const*>(file_data[i] + 1), file_data[i][0]);
     if (!f.good()) {
       std::cout << "Unable to write data " << i << std::endl;
       return 1;

+ 24 - 24
testProcess.c

@@ -59,11 +59,11 @@ static void testProcess_sleep(unsigned int sec)
 }
 #endif
 
-int runChild(const char* cmd[], int state, int exception, int value, int share,
+int runChild(char const* cmd[], int state, int exception, int value, int share,
              int output, int delay, double timeout, int poll, int repeat,
              int disown, int createNewGroup, unsigned int interruptDelay);
 
-static int test1(int argc, const char* argv[])
+static int test1(int argc, char const* argv[])
 {
   /* This is a very basic functional test of kwsysProcess.  It is repeated
      numerous times to verify that there are no resource leaks in kwsysProcess
@@ -82,7 +82,7 @@ static int test1(int argc, const char* argv[])
   return 0;
 }
 
-static int test2(int argc, const char* argv[])
+static int test2(int argc, char const* argv[])
 {
   (void)argc;
   (void)argv;
@@ -91,7 +91,7 @@ static int test2(int argc, const char* argv[])
   return 123;
 }
 
-static int test3(int argc, const char* argv[])
+static int test3(int argc, char const* argv[])
 {
   (void)argc;
   (void)argv;
@@ -105,7 +105,7 @@ static int test3(int argc, const char* argv[])
   return 0;
 }
 
-static int test4(int argc, const char* argv[])
+static int test4(int argc, char const* argv[])
 {
 #ifndef CRASH_USING_ABORT
   /* Prepare a pointer to an invalid address.  Don't use null, because
@@ -113,7 +113,7 @@ static int test4(int argc, const char* argv[])
   do whatever they want. ex: Clang will warn at compile time, or even
   optimize away the write. We hope to 'outsmart' them by using
   'volatile' and a slightly larger address, based on a runtime value. */
-  volatile int* invalidAddress = 0;
+  int volatile* invalidAddress = 0;
   invalidAddress += argc ? 1 : 2;
 #endif
 
@@ -142,10 +142,10 @@ static int test4(int argc, const char* argv[])
   return 0;
 }
 
-static int test5(int argc, const char* argv[])
+static int test5(int argc, char const* argv[])
 {
   int r;
-  const char* cmd[4];
+  char const* cmd[4];
   (void)argc;
   cmd[0] = argv[0];
   cmd[1] = "run";
@@ -170,7 +170,7 @@ static int test5(int argc, const char* argv[])
 }
 
 #define TEST6_SIZE (4096 * 2)
-static void test6(int argc, const char* argv[])
+static void test6(int argc, char const* argv[])
 {
   int i;
   char runaway[TEST6_SIZE + 1];
@@ -193,7 +193,7 @@ static void test6(int argc, const char* argv[])
    delaying 1/10th of a second should ever have to poll.  */
 #define MINPOLL 5
 #define MAXPOLL 20
-static int test7(int argc, const char* argv[])
+static int test7(int argc, char const* argv[])
 {
   (void)argc;
   (void)argv;
@@ -210,12 +210,12 @@ static int test7(int argc, const char* argv[])
   return 0;
 }
 
-static int test8(int argc, const char* argv[])
+static int test8(int argc, char const* argv[])
 {
   /* Create a disowned grandchild to test handling of processes
      that exit before their children.  */
   int r;
-  const char* cmd[4];
+  char const* cmd[4];
   (void)argc;
   cmd[0] = argv[0];
   cmd[1] = "run";
@@ -234,7 +234,7 @@ static int test8(int argc, const char* argv[])
   return r;
 }
 
-static int test8_grandchild(int argc, const char* argv[])
+static int test8_grandchild(int argc, char const* argv[])
 {
   (void)argc;
   (void)argv;
@@ -252,7 +252,7 @@ static int test8_grandchild(int argc, const char* argv[])
   return 0;
 }
 
-static int test9(int argc, const char* argv[])
+static int test9(int argc, char const* argv[])
 {
   /* Test Ctrl+C behavior: the root test program will send a Ctrl+C to this
      process.  Here, we start a child process that sleeps for a long time
@@ -262,7 +262,7 @@ static int test9(int argc, const char* argv[])
      WARNING:  This test will falsely pass if the share parameter of runChild
      was set to 0 when invoking the test9 process.  */
   int r;
-  const char* cmd[4];
+  char const* cmd[4];
   (void)argc;
   cmd[0] = argv[0];
   cmd[1] = "run";
@@ -296,7 +296,7 @@ static BOOL WINAPI test9_grandchild_handler(DWORD dwCtrlType)
 }
 #endif
 
-static int test9_grandchild(int argc, const char* argv[])
+static int test9_grandchild(int argc, char const* argv[])
 {
   /* The grandchild just sleeps for a few seconds while ignoring signals.  */
   (void)argc;
@@ -327,7 +327,7 @@ static int test9_grandchild(int argc, const char* argv[])
   return 0;
 }
 
-static int test10(int argc, const char* argv[])
+static int test10(int argc, char const* argv[])
 {
   /* Test Ctrl+C behavior: the root test program will send a Ctrl+C to this
      process.  Here, we start a child process that sleeps for a long time and
@@ -335,7 +335,7 @@ static int test10(int argc, const char* argv[])
      process group - ensuring that Ctrl+C we receive is sent to our process
      groups.  We make sure it exits anyway.  */
   int r;
-  const char* cmd[4];
+  char const* cmd[4];
   (void)argc;
   cmd[0] = argv[0];
   cmd[1] = "run";
@@ -355,7 +355,7 @@ static int test10(int argc, const char* argv[])
   return r;
 }
 
-static int test10_grandchild(int argc, const char* argv[])
+static int test10_grandchild(int argc, char const* argv[])
 {
   /* The grandchild just sleeps for a few seconds and handles signals.  */
   (void)argc;
@@ -373,7 +373,7 @@ static int test10_grandchild(int argc, const char* argv[])
   return 0;
 }
 
-static int runChild2(kwsysProcess* kp, const char* cmd[], int state,
+static int runChild2(kwsysProcess* kp, char const* cmd[], int state,
                      int exception, int value, int share, int output,
                      int delay, double timeout, int poll, int disown,
                      int createNewGroup, unsigned int interruptDelay)
@@ -541,7 +541,7 @@ static int runChild2(kwsysProcess* kp, const char* cmd[], int state,
  *                  BEFORE any reading/polling of pipes occurs and before any
  *                  detachment occurs.
  */
-int runChild(const char* cmd[], int state, int exception, int value, int share,
+int runChild(char const* cmd[], int state, int exception, int value, int share,
              int output, int delay, double timeout, int poll, int repeat,
              int disown, int createNewGroup, unsigned int interruptDelay)
 {
@@ -562,7 +562,7 @@ int runChild(const char* cmd[], int state, int exception, int value, int share,
   return result;
 }
 
-int main(int argc, const char* argv[])
+int main(int argc, char const* argv[])
 {
   int n = 0;
 
@@ -665,7 +665,7 @@ int main(int argc, const char* argv[])
     int createNewGroups[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 };
     unsigned int interruptDelays[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 3, 2 };
     int r;
-    const char* cmd[4];
+    char const* cmd[4];
 #ifdef _WIN32
     char* argv0 = 0;
 #endif
@@ -715,7 +715,7 @@ int main(int argc, const char* argv[])
   if (argc > 2 && strcmp(argv[1], "0") == 0) {
     /* This is the special debugging test to run a given command
        line.  */
-    const char** cmd = argv + 2;
+    char const** cmd = argv + 2;
     int state = kwsysProcess_State_Exited;
     int exception = kwsysProcess_Exception_None;
     int value = 0;

+ 39 - 39
testSystemTools.cxx

@@ -37,7 +37,7 @@
 typedef unsigned short mode_t;
 #endif
 
-static const char* toUnixPaths[][2] = {
+static char const* toUnixPaths[][2] = {
   { "/usr/local/bin/passwd", "/usr/local/bin/passwd" },
   { "/usr/lo cal/bin/pa sswd", "/usr/lo cal/bin/pa sswd" },
   { "/usr/lo\\ cal/bin/pa\\ sswd", "/usr/lo/ cal/bin/pa/ sswd" },
@@ -69,14 +69,14 @@ static bool CheckConvertToUnixSlashes(std::string const& input,
   return true;
 }
 
-static const char* checkEscapeChars[][4] = {
+static char const* checkEscapeChars[][4] = {
   { "1 foo 2 bar 2", "12", "\\", "\\1 foo \\2 bar \\2" },
   { " {} ", "{}", "#", " #{#} " },
   { nullptr, nullptr, nullptr, nullptr }
 };
 
 static bool CheckEscapeChars(std::string const& input,
-                             const char* chars_to_escape, char escape_char,
+                             char const* chars_to_escape, char escape_char,
                              std::string const& output)
 {
   std::string result = kwsys::SystemTools::EscapeChars(
@@ -92,16 +92,16 @@ static bool CheckEscapeChars(std::string const& input,
 static bool CheckFileOperations()
 {
   bool res = true;
-  const std::string testNonExistingFile(TEST_SYSTEMTOOLS_SOURCE_DIR
+  std::string const testNonExistingFile(TEST_SYSTEMTOOLS_SOURCE_DIR
                                         "/testSystemToolsNonExistingFile");
-  const std::string testDotFile(TEST_SYSTEMTOOLS_SOURCE_DIR "/.");
-  const std::string testBinFile(TEST_SYSTEMTOOLS_SOURCE_DIR
+  std::string const testDotFile(TEST_SYSTEMTOOLS_SOURCE_DIR "/.");
+  std::string const testBinFile(TEST_SYSTEMTOOLS_SOURCE_DIR
                                 "/testSystemTools.bin");
-  const std::string testTxtFile(TEST_SYSTEMTOOLS_SOURCE_DIR
+  std::string const testTxtFile(TEST_SYSTEMTOOLS_SOURCE_DIR
                                 "/testSystemTools.cxx");
-  const std::string testNewDir(TEST_SYSTEMTOOLS_BINARY_DIR
+  std::string const testNewDir(TEST_SYSTEMTOOLS_BINARY_DIR
                                "/testSystemToolsNewDir");
-  const std::string testNewFile(testNewDir + "/testNewFile.txt");
+  std::string const testNewFile(testNewDir + "/testNewFile.txt");
 
   if (kwsys::SystemTools::DetectFileType(testNonExistingFile.c_str()) !=
       kwsys::SystemTools::FileTypeUnknown) {
@@ -470,7 +470,7 @@ static bool CheckFileOperations()
   // Perform the same file and directory creation and deletion tests but
   // with paths > 256 characters in length.
 
-  const std::string testNewLongDir(
+  std::string const testNewLongDir(
     TEST_SYSTEMTOOLS_BINARY_DIR
     "/"
     "012345678901234567890123456789012345678901234567890123456789"
@@ -478,7 +478,7 @@ static bool CheckFileOperations()
     "012345678901234567890123456789012345678901234567890123456789"
     "012345678901234567890123456789012345678901234567890123456789"
     "01234567890123");
-  const std::string testNewLongFile(
+  std::string const testNewLongFile(
     testNewLongDir +
     "/"
     "012345678901234567890123456789012345678901234567890123456789"
@@ -667,8 +667,8 @@ static bool CheckStringOperations()
   return res;
 }
 
-static bool CheckPutEnv(const std::string& env, const char* name,
-                        const char* value)
+static bool CheckPutEnv(std::string const& env, char const* name,
+                        char const* value)
 {
   if (!kwsys::SystemTools::PutEnv(env)) {
     std::cerr << "PutEnv(\"" << env << "\") failed!" << std::endl;
@@ -684,7 +684,7 @@ static bool CheckPutEnv(const std::string& env, const char* name,
   return true;
 }
 
-static bool CheckUnPutEnv(const char* env, const char* name)
+static bool CheckUnPutEnv(char const* env, char const* name)
 {
   if (!kwsys::SystemTools::UnPutEnv(env)) {
     std::cerr << "UnPutEnv(\"" << env << "\") failed!" << std::endl;
@@ -713,9 +713,9 @@ static bool CheckEnvironmentOperations()
   return res;
 }
 
-static bool CheckRelativePath(const std::string& local,
-                              const std::string& remote,
-                              const std::string& expected)
+static bool CheckRelativePath(std::string const& local,
+                              std::string const& remote,
+                              std::string const& expected)
 {
   std::string result = kwsys::SystemTools::RelativePath(local, remote);
   if (!kwsys::SystemTools::ComparePath(expected, result)) {
@@ -738,9 +738,9 @@ static bool CheckRelativePaths()
   return res;
 }
 
-static bool CheckCollapsePath(const std::string& path,
-                              const std::string& expected,
-                              const char* base = nullptr)
+static bool CheckCollapsePath(std::string const& path,
+                              std::string const& expected,
+                              char const* base = nullptr)
 {
   std::string result = kwsys::SystemTools::CollapseFullPath(path, base);
   if (!kwsys::SystemTools::ComparePath(expected, result)) {
@@ -772,7 +772,7 @@ static bool CheckCollapsePath()
   return res;
 }
 
-static std::string StringVectorToString(const std::vector<std::string>& vec)
+static std::string StringVectorToString(std::vector<std::string> const& vec)
 {
   std::stringstream ss;
   ss << "vector(";
@@ -788,13 +788,13 @@ static std::string StringVectorToString(const std::vector<std::string>& vec)
 
 static bool CheckGetPath()
 {
-  const char* envName = "S";
+  char const* envName = "S";
 #ifdef _WIN32
-  const char* envValue = "C:\\Somewhere\\something;D:\\Temp";
+  char const* envValue = "C:\\Somewhere\\something;D:\\Temp";
 #else
-  const char* envValue = "/Somewhere/something:/tmp";
+  char const* envValue = "/Somewhere/something:/tmp";
 #endif
-  const char* registryPath = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MyApp; MyKey]";
+  char const* registryPath = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MyApp; MyKey]";
 
   std::vector<std::string> originalPaths;
   originalPaths.emplace_back(registryPath);
@@ -829,8 +829,8 @@ static bool CheckGetPath()
 
 static bool CheckGetFilenameName()
 {
-  const char* windowsFilepath = "C:\\somewhere\\something";
-  const char* unixFilepath = "/somewhere/something";
+  char const* windowsFilepath = "C:\\somewhere\\something";
+  char const* unixFilepath = "/somewhere/something";
 
 #if defined(_WIN32) || defined(KWSYS_SYSTEMTOOLS_SUPPORT_WINDOWS_SLASHES)
   std::string expectedWindowsFilename = "something";
@@ -860,8 +860,8 @@ static bool CheckGetFilenameName()
 static bool CheckFind()
 {
   bool res = true;
-  const std::string testFindFileName("testFindFile.txt");
-  const std::string testFindFile(TEST_SYSTEMTOOLS_BINARY_DIR "/" +
+  std::string const testFindFileName("testFindFile.txt");
+  std::string const testFindFile(TEST_SYSTEMTOOLS_BINARY_DIR "/" +
                                  testFindFileName);
 
   if (!kwsys::SystemTools::Touch(testFindFile, true)) {
@@ -923,7 +923,7 @@ static bool CheckIsSubDirectory()
 
 static bool CheckGetLineFromStream()
 {
-  const std::string fileWithFiveCharsOnFirstLine(TEST_SYSTEMTOOLS_SOURCE_DIR
+  std::string const fileWithFiveCharsOnFirstLine(TEST_SYSTEMTOOLS_SOURCE_DIR
                                                  "/README.rst");
 
   kwsys::ifstream file(fileWithFiveCharsOnFirstLine.c_str(), std::ios::in);
@@ -974,7 +974,7 @@ static bool CheckGetLineFromStream()
 
 static bool CheckGetLineFromStreamLongLine()
 {
-  const std::string fileWithLongLine("longlines.txt");
+  std::string const fileWithLongLine("longlines.txt");
   std::string firstLine, secondLine;
   // First line: large buffer, containing a carriage return for some reason.
   firstLine.assign(2050, ' ');
@@ -1047,7 +1047,7 @@ static bool CheckGetLineFromStreamLongLine()
   return true;
 }
 
-static bool writeFile(const char* fileName, const char* data)
+static bool writeFile(char const* fileName, char const* data)
 {
   kwsys::ofstream out(fileName, std::ios::binary);
   out << data;
@@ -1058,7 +1058,7 @@ static bool writeFile(const char* fileName, const char* data)
   return true;
 }
 
-static std::string readFile(const char* fileName)
+static std::string readFile(char const* fileName)
 {
   kwsys::ifstream in(fileName, std::ios::binary);
   std::stringstream sstr;
@@ -1073,8 +1073,8 @@ static std::string readFile(const char* fileName)
 
 struct
 {
-  const char* a;
-  const char* b;
+  char const* a;
+  char const* b;
   bool differ;
 } diff_test_cases[] = { { "one", "one", false },
                         { "one", "two", true },
@@ -1088,7 +1088,7 @@ struct
 
 static bool CheckTextFilesDiffer()
 {
-  const int num_test_cases =
+  int const num_test_cases =
     sizeof(diff_test_cases) / sizeof(diff_test_cases[0]);
   for (int i = 0; i < num_test_cases; ++i) {
     if (!writeFile("file_a", diff_test_cases[i].a) ||
@@ -1109,14 +1109,14 @@ static bool CheckTextFilesDiffer()
 static bool CheckCopyFileIfDifferent()
 {
   bool ret = true;
-  const int num_test_cases =
+  int const num_test_cases =
     sizeof(diff_test_cases) / sizeof(diff_test_cases[0]);
   for (int i = 0; i < num_test_cases; ++i) {
     if (!writeFile("file_a", diff_test_cases[i].a) ||
         !writeFile("file_b", diff_test_cases[i].b)) {
       return false;
     }
-    const char* cptarget =
+    char const* cptarget =
       i < 4 ? TEST_SYSTEMTOOLS_BINARY_DIR "/file_b" : "file_b";
     if (!kwsys::SystemTools::CopyFileIfDifferent("file_a", cptarget)) {
       std::cerr << "CopyFileIfDifferent() returned false for test case "
@@ -1178,7 +1178,7 @@ static bool CheckSplitString()
   bool ret = true;
 
   auto check_split = [](std::string const& input,
-                        std::initializer_list<const char*> expected) -> bool {
+                        std::initializer_list<char const*> expected) -> bool {
     auto const components = kwsys::SystemTools::SplitString(input, '/');
     if (components.size() != expected.size()) {
       std::cerr << "Incorrect split count for " << input << ": "

Неке датотеке нису приказане због велике количине промена