summaryrefslogtreecommitdiff
path: root/Source/CPack/cmCPackSTGZGenerator.cxx
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2016-05-16 10:34:04 -0400
committerBrad King <brad.king@kitware.com>2016-05-16 16:05:19 -0400
commitd9fd2f5402eeaa345691313658e02b51038f570b (patch)
treedca71b9a7e267f4c6300da3eb770415381726785 /Source/CPack/cmCPackSTGZGenerator.cxx
parent82df6deaafb36cbbfd450202bb20b320f637751a (diff)
downloadcmake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
Diffstat (limited to 'Source/CPack/cmCPackSTGZGenerator.cxx')
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.cxx61
1 files changed, 27 insertions, 34 deletions
diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx
index 41e67c78f8..4d07a7e654 100644
--- a/Source/CPack/cmCPackSTGZGenerator.cxx
+++ b/Source/CPack/cmCPackSTGZGenerator.cxx
@@ -37,12 +37,11 @@ int cmCPackSTGZGenerator::InitializeInternal()
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
std::string inFile = this->FindTemplate("CPack.STGZ_Header.sh.in");
- if ( inFile.empty() )
- {
- cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find template file: "
- << inFile << std::endl);
+ if (inFile.empty()) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Cannot find template file: " << inFile << std::endl);
return 0;
- }
+ }
this->SetOptionIfNotSet("CPACK_STGZ_HEADER_FILE", inFile.c_str());
this->SetOptionIfNotSet("CPACK_AT_SIGN", "@");
@@ -51,28 +50,26 @@ int cmCPackSTGZGenerator::InitializeInternal()
int cmCPackSTGZGenerator::PackageFiles()
{
- bool retval = true;
- if ( !this->Superclass::PackageFiles() )
- {
+ bool retval = true;
+ if (!this->Superclass::PackageFiles()) {
return 0;
- }
+ }
/* TGZ generator (our Superclass) may
* have generated several packages (component packaging)
* so we must iterate over generated packages.
*/
- for (std::vector<std::string>::iterator it=packageFileNames.begin();
- it != packageFileNames.end(); ++it)
- {
+ for (std::vector<std::string>::iterator it = packageFileNames.begin();
+ it != packageFileNames.end(); ++it) {
retval &= cmSystemTools::SetPermissions((*it).c_str(),
-#if defined( _MSC_VER ) || defined( __MINGW32__ )
- S_IREAD | S_IWRITE | S_IEXEC
+#if defined(_MSC_VER) || defined(__MINGW32__)
+ S_IREAD | S_IWRITE | S_IEXEC
#else
- S_IRUSR | S_IWUSR | S_IXUSR |
- S_IRGRP | S_IWGRP | S_IXGRP |
- S_IROTH | S_IWOTH | S_IXOTH
+ S_IRUSR | S_IWUSR | S_IXUSR |
+ S_IRGRP | S_IWGRP | S_IXGRP |
+ S_IROTH | S_IWOTH | S_IXOTH
#endif
- );
+ );
}
return retval;
}
@@ -87,10 +84,9 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
std::string line;
cmsys::ifstream ilfs(inLicFile.c_str());
std::string licenseText;
- while ( cmSystemTools::GetLineFromStream(ilfs, line) )
- {
+ while (cmSystemTools::GetLineFromStream(ilfs, line)) {
licenseText += line + "\n";
- }
+ }
this->SetOptionIfNotSet("CPACK_RESOURCE_FILE_LICENSE_CONTENT",
licenseText.c_str());
@@ -100,10 +96,9 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
std::string inFile = this->GetOption("CPACK_STGZ_HEADER_FILE");
cmsys::ifstream ifs(inFile.c_str());
std::string packageHeaderText;
- while ( cmSystemTools::GetLineFromStream(ifs, line) )
- {
+ while (cmSystemTools::GetLineFromStream(ifs, line)) {
packageHeaderText += line + "\n";
- }
+ }
// Configure in the values
std::string res;
@@ -111,17 +106,15 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
// Count the lines
const char* ptr = res.c_str();
- while ( *ptr )
- {
- if ( *ptr == '\n' )
- {
- counter ++;
- }
- ++ptr;
+ while (*ptr) {
+ if (*ptr == '\n') {
+ counter++;
}
- counter ++;
- cmCPackLogger(cmCPackLog::LOG_DEBUG,
- "Number of lines: " << counter << std::endl);
+ ++ptr;
+ }
+ counter++;
+ cmCPackLogger(cmCPackLog::LOG_DEBUG, "Number of lines: " << counter
+ << std::endl);
char buffer[1024];
sprintf(buffer, "%d", counter);
cmSystemTools::ReplaceString(res, headerLengthTag, buffer);