summaryrefslogtreecommitdiffstats
path: root/Source/CPack
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-06-10 16:36:24 (GMT)
committerDaniel Pfeifer <daniel@pfeifer-mail.de>2016-06-10 16:36:24 (GMT)
commita16bf141bc5d393b27d13d8235d95a1b034052c2 (patch)
tree59ecd625114f6e98065e7901f418a28fc540cd45 /Source/CPack
parentbd9e551c1a13f566e6ffe8cdd1262b7628ed5330 (diff)
downloadCMake-a16bf141bc5d393b27d13d8235d95a1b034052c2.zip
CMake-a16bf141bc5d393b27d13d8235d95a1b034052c2.tar.gz
CMake-a16bf141bc5d393b27d13d8235d95a1b034052c2.tar.bz2
Add missing braces around statements.
Apply fixits of clang-tidy's readability-braces-around-statements checker.
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx24
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx3
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.cxx15
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.cxx13
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx25
5 files changed, 53 insertions, 27 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index c1ff526..b47d46e 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -345,18 +345,21 @@ cmCPackComponent* cmCPackIFWGenerator::GetComponent(
const std::string& projectName, const std::string& componentName)
{
ComponentsMap::iterator cit = Components.find(componentName);
- if (cit != Components.end())
+ if (cit != Components.end()) {
return &(cit->second);
+ }
cmCPackComponent* component =
cmCPackGenerator::GetComponent(projectName, componentName);
- if (!component)
+ if (!component) {
return component;
+ }
std::string name = GetComponentPackageName(component);
PackagesMap::iterator pit = Packages.find(name);
- if (pit != Packages.end())
+ if (pit != Packages.end()) {
return component;
+ }
cmCPackIFWPackage* package = &Packages[name];
package->Name = name;
@@ -387,13 +390,15 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(
{
cmCPackComponentGroup* group =
cmCPackGenerator::GetComponentGroup(projectName, groupName);
- if (!group)
+ if (!group) {
return group;
+ }
std::string name = GetGroupPackageName(group);
PackagesMap::iterator pit = Packages.find(name);
- if (pit != Packages.end())
+ if (pit != Packages.end()) {
return group;
+ }
cmCPackIFWPackage* package = &Packages[name];
package->Name = name;
@@ -462,8 +467,9 @@ std::string cmCPackIFWGenerator::GetGroupPackageName(
cmCPackComponentGroup* group) const
{
std::string name;
- if (!group)
+ if (!group) {
return name;
+ }
if (cmCPackIFWPackage* package = GetGroupPackage(group)) {
return package->Name;
}
@@ -488,8 +494,9 @@ std::string cmCPackIFWGenerator::GetComponentPackageName(
cmCPackComponent* component) const
{
std::string name;
- if (!component)
+ if (!component) {
return name;
+ }
if (cmCPackIFWPackage* package = GetComponentPackage(component)) {
return package->Name;
}
@@ -534,8 +541,9 @@ cmCPackIFWRepository* cmCPackIFWGenerator::GetRepository(
const std::string& repositoryName)
{
RepositoriesMap::iterator rit = Repositories.find(repositoryName);
- if (rit != Repositories.end())
+ if (rit != Repositories.end()) {
return &(rit->second);
+ }
cmCPackIFWRepository* repository = &Repositories[repositoryName];
repository->Name = repositoryName;
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index dfc509b..74f6da6 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -343,6 +343,7 @@ void cmCPackIFWInstaller::GeneratePackageFiles()
void cmCPackIFWInstaller::WriteGeneratedByToStrim(cmXMLWriter& xout)
{
- if (Generator)
+ if (Generator) {
Generator->WriteGeneratedByToStrim(xout);
+ }
}
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index ad153d1..c44e389 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -71,8 +71,9 @@ cmCPackIFWPackage::DependenceStruct::DependenceStruct(
std::string cmCPackIFWPackage::DependenceStruct::NameWithCompare() const
{
- if (Compare.Type == CompareNone)
+ if (Compare.Type == CompareNone) {
return Name;
+ }
std::string result = Name;
@@ -128,8 +129,9 @@ bool cmCPackIFWPackage::IsVersionEqual(const char* version)
std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent* component)
{
- if (!component)
+ if (!component) {
return "";
+ }
const char* option =
GetOption("CPACK_IFW_COMPONENT_" +
cmsys::SystemTools::UpperCase(component->Name) + "_NAME");
@@ -189,8 +191,9 @@ int cmCPackIFWPackage::ConfigureFromOptions()
int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
{
- if (!component)
+ if (!component) {
return 0;
+ }
// Restore defaul configuration
DefaultConfiguration();
@@ -284,8 +287,9 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
{
- if (!group)
+ if (!group) {
return 0;
+ }
// Restore defaul configuration
DefaultConfiguration();
@@ -474,6 +478,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
void cmCPackIFWPackage::WriteGeneratedByToStrim(cmXMLWriter& xout)
{
- if (Generator)
+ if (Generator) {
Generator->WriteGeneratedByToStrim(xout);
+ }
}
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx
index 1838005..b8a10c6 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.cxx
+++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx
@@ -89,8 +89,9 @@ bool cmCPackIFWRepository::IsVersionEqual(const char* version)
bool cmCPackIFWRepository::ConfigureFromOptions()
{
// Name;
- if (Name.empty())
+ if (Name.empty()) {
return false;
+ }
std::string prefix =
"CPACK_IFW_REPOSITORY_" + cmsys::SystemTools::UpperCase(Name) + "_";
@@ -198,8 +199,9 @@ protected:
patched = true;
}
xout.EndElement();
- if (patched)
+ if (patched) {
return;
+ }
if (name == "Checksum") {
repository->WriteRepositoryUpdates(xout);
patched = true;
@@ -209,8 +211,10 @@ protected:
virtual void CharacterDataHandler(const char* data, int length)
{
std::string content(data, data + length);
- if (content == "" || content == " " || content == " " || content == "\n")
+ if (content == "" || content == " " || content == " " ||
+ content == "\n") {
return;
+ }
xout.Content(content);
}
};
@@ -332,6 +336,7 @@ void cmCPackIFWRepository::WriteRepositoryUpdates(cmXMLWriter& xout)
void cmCPackIFWRepository::WriteGeneratedByToStrim(cmXMLWriter& xout)
{
- if (Generator)
+ if (Generator) {
Generator->WriteGeneratedByToStrim(xout);
+ }
}
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index bef0fb4..b659359 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -826,8 +826,9 @@ static int copy_ar(CF* cfp, off_t size)
size_t nr, nw;
char buf[8 * 1024];
- if (sz == 0)
+ if (sz == 0) {
return 0;
+ }
FILE* from = cfp->rFile;
FILE* to = cfp->wFile;
@@ -837,16 +838,20 @@ static int copy_ar(CF* cfp, off_t size)
: sizeof(buf),
from)) > 0) {
sz -= nr;
- for (size_t off = 0; off < nr; nr -= off, off += nw)
- if ((nw = fwrite(buf + off, 1, nr, to)) < nr)
+ for (size_t off = 0; off < nr; nr -= off, off += nw) {
+ if ((nw = fwrite(buf + off, 1, nr, to)) < nr) {
return -1;
+ }
+ }
}
- if (sz)
+ if (sz) {
return -2;
+ }
if (cfp->flags & WPAD && (size + ar_already_written) & 1 &&
- fwrite(&pad, 1, 1, to) != 1)
+ fwrite(&pad, 1, 1, to) != 1) {
return -4;
+ }
return 0;
}
@@ -874,11 +879,11 @@ static int put_arobj(CF* cfp, struct stat* sb)
if (gid > USHRT_MAX) {
gid = USHRT_MAX;
}
- if (lname > sizeof(hdr->ar_name) || strchr(name, ' '))
+ if (lname > sizeof(hdr->ar_name) || strchr(name, ' ')) {
(void)sprintf(ar_hb, HDR1, AR_EFMT1, (int)lname, (long int)sb->st_mtime,
(unsigned)uid, (unsigned)gid, (unsigned)sb->st_mode,
(long long)sb->st_size + lname, ARFMAG);
- else {
+ } else {
lname = 0;
(void)sprintf(ar_hb, HDR2, name, (long int)sb->st_mtime, (unsigned)uid,
(unsigned)gid, (unsigned)sb->st_mode, (long long)sb->st_size,
@@ -886,12 +891,14 @@ static int put_arobj(CF* cfp, struct stat* sb)
}
off_t size = sb->st_size;
- if (fwrite(ar_hb, 1, sizeof(HDR), cfp->wFile) != sizeof(HDR))
+ if (fwrite(ar_hb, 1, sizeof(HDR), cfp->wFile) != sizeof(HDR)) {
return -1;
+ }
if (lname) {
- if (fwrite(name, 1, lname, cfp->wFile) != lname)
+ if (fwrite(name, 1, lname, cfp->wFile) != lname) {
return -2;
+ }
ar_already_written = lname;
}
result = copy_ar(cfp, size);