Commit 607b0ac2 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'minor-cleanups'

acda926a Replace some uses of sprintf with std::to_string
41854103 cmCTestCurl: Fix UploadFile declared parameter names
1519628e cmVisualStudio10TargetGenerator: Make NsightTegraVersion unsigned
2f87d008 cmMacroCommand: Fix format string to match type of argument
b0676cc5 Add in-class initialization of some members
966dba5b cmAlgorithms: Remove unnecessary typename keyword
12a14553

 gitignore: Ignore a .vs directory in the source tree
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !1932
parents 5454b41e acda926a
......@@ -5,3 +5,6 @@
*.pyc
Testing
# Visual Studio work directory
.vs/
......@@ -16,7 +16,7 @@ class cmCTestCurl
public:
cmCTestCurl(cmCTest*);
~cmCTestCurl();
bool UploadFile(std::string const& url, std::string const& file,
bool UploadFile(std::string const& local_file, std::string const& url,
std::string const& fields, std::string& response);
bool HttpRequest(std::string const& url, std::string const& fields,
std::string& response);
......
......@@ -311,7 +311,7 @@ struct RemoveDuplicatesAPI<Range, T*>
template <typename Range>
typename Range::const_iterator cmRemoveDuplicates(Range& r)
{
typedef typename ContainerAlgorithms::RemoveDuplicatesAPI<Range> API;
typedef ContainerAlgorithms::RemoveDuplicatesAPI<Range> API;
typedef typename API::value_type T;
std::vector<T> unique;
unique.reserve(r.size());
......
......@@ -8,6 +8,7 @@
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <string>
#include "cmGeneratedFileStream.h"
#include "cmMessenger.h"
......@@ -243,19 +244,18 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger)
}
// before writing the cache, update the version numbers
// to the
char temp[1024];
sprintf(temp, "%d", cmVersion::GetMinorVersion());
this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", temp,
"Minor version of cmake used to create the "
this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION",
std::to_string(cmVersion::GetMajorVersion()).c_str(),
"Major version of cmake used to create the "
"current loaded cache",
cmStateEnums::INTERNAL);
sprintf(temp, "%d", cmVersion::GetMajorVersion());
this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", temp,
"Major version of cmake used to create the "
this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION",
std::to_string(cmVersion::GetMinorVersion()).c_str(),
"Minor version of cmake used to create the "
"current loaded cache",
cmStateEnums::INTERNAL);
sprintf(temp, "%d", cmVersion::GetPatchVersion());
this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION", temp,
this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION",
std::to_string(cmVersion::GetPatchVersion()).c_str(),
"Patch version of cmake used to create the "
"current loaded cache",
cmStateEnums::INTERNAL);
......
......@@ -32,9 +32,9 @@ private:
std::string InputFile;
std::string OutputFile;
bool CopyOnly;
bool EscapeQuotes;
bool AtOnly;
bool CopyOnly = false;
bool EscapeQuotes = false;
bool AtOnly = false;
};
#endif
......@@ -46,7 +46,7 @@ protected:
std::string BinaryDirectory;
std::string OutputFile;
std::string FindErrorMessage;
bool SrcFileSignature;
bool SrcFileSignature = false;
private:
std::vector<std::string> WarnCMP0067;
......
......@@ -27,7 +27,7 @@ public:
private:
std::string Filename;
bool Append;
bool Append = false;
void ConstFinalPass() const;
};
......
......@@ -62,7 +62,7 @@ protected:
///! Contains the names of the global generators support by this generator.
std::vector<std::string> SupportedGlobalGenerators;
///! the global generator which creates the makefiles
const cmGlobalGenerator* GlobalGenerator;
const cmGlobalGenerator* GlobalGenerator = nullptr;
std::string Name;
};
......
......@@ -48,7 +48,7 @@ protected:
private:
std::vector<std::string> FinalArgs;
bool IsFilesForm;
bool IsFilesForm = false;
std::string Destination;
std::vector<std::string> Files;
};
......
......@@ -93,7 +93,7 @@ bool cmMacroHelperCommand::InvokeInitialPass(
argVs.reserve(expandedArgs.size());
char argvName[60];
for (unsigned int j = 0; j < expandedArgs.size(); ++j) {
sprintf(argvName, "${ARGV%i}", j);
sprintf(argvName, "${ARGV%u}", j);
argVs.push_back(argvName);
}
// Invoke all the functions that were collected in the block.
......
......@@ -6,7 +6,7 @@
#include <algorithm>
#include <assert.h>
#include <iterator>
#include <stdio.h>
#include <string>
#include "cmAlgorithms.h"
#include "cmDefinitions.h"
......@@ -328,15 +328,14 @@ void cmStateSnapshot::SetDefaultDefinitions()
this->SetDefinition("CMAKE_HOST_SOLARIS", "1");
#endif
char temp[1024];
sprintf(temp, "%d", cmVersion::GetMinorVersion());
this->SetDefinition("CMAKE_MINOR_VERSION", temp);
sprintf(temp, "%d", cmVersion::GetMajorVersion());
this->SetDefinition("CMAKE_MAJOR_VERSION", temp);
sprintf(temp, "%d", cmVersion::GetPatchVersion());
this->SetDefinition("CMAKE_PATCH_VERSION", temp);
sprintf(temp, "%d", cmVersion::GetTweakVersion());
this->SetDefinition("CMAKE_TWEAK_VERSION", temp);
this->SetDefinition("CMAKE_MAJOR_VERSION",
std::to_string(cmVersion::GetMajorVersion()));
this->SetDefinition("CMAKE_MINOR_VERSION",
std::to_string(cmVersion::GetMinorVersion()));
this->SetDefinition("CMAKE_PATCH_VERSION",
std::to_string(cmVersion::GetPatchVersion()));
this->SetDefinition("CMAKE_TWEAK_VERSION",
std::to_string(cmVersion::GetTweakVersion()));
this->SetDefinition("CMAKE_VERSION", cmVersion::GetCMakeVersion());
this->SetDefinition("CMAKE_FILES_DIRECTORY",
......
......@@ -43,7 +43,7 @@ private:
void LinkLibraryTypeSpecifierWarning(int left, int right);
static const char* LinkLibraryTypeNames[3];
cmTarget* Target;
cmTarget* Target = nullptr;
enum ProcessingState
{
ProcessingLinkLibraries,
......@@ -55,7 +55,7 @@ private:
ProcessingKeywordPrivateInterface
};
ProcessingState CurrentProcessingState;
ProcessingState CurrentProcessingState = ProcessingLinkLibraries;
bool HandleLibrary(const std::string& lib, cmTargetLinkLibraryType llt);
};
......
......@@ -28,7 +28,7 @@ public:
protected:
std::string Property;
cmTarget* Target;
cmTarget* Target = nullptr;
virtual void HandleInterfaceContent(cmTarget* tgt,
const std::vector<std::string>& content,
......
......@@ -368,8 +368,8 @@ void cmVisualStudio10TargetGenerator::Generate()
if (this->NsightTegra) {
this->WriteString("<PropertyGroup Label=\"NsightTegraProject\">\n", 1);
const int nsightTegraMajorVersion = this->NsightTegraVersion[0];
const int nsightTegraMinorVersion = this->NsightTegraVersion[1];
const unsigned int nsightTegraMajorVersion = this->NsightTegraVersion[0];
const unsigned int nsightTegraMinorVersion = this->NsightTegraVersion[1];
if (nsightTegraMajorVersion >= 2) {
this->WriteString("<NsightTegraProjectRevisionNumber>", 2);
if (nsightTegraMajorVersion > 3 ||
......
......@@ -204,7 +204,7 @@ private:
bool MSTools;
bool Managed;
bool NsightTegra;
int NsightTegraVersion[4];
unsigned int NsightTegraVersion[4];
bool TargetCompileAsWinRT;
cmGlobalVisualStudio10Generator* const GlobalGenerator;
cmGeneratedFileStream* BuildFileStream;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment