浏览代码

Use the empty method to check for emptiness

Daniel Pfeifer 9 年之前
父节点
当前提交
c58c739da7
共有 2 个文件被更改,包括 4 次插入3 次删除
  1. 1 1
      Source/cmExportInstallAndroidMKGenerator.cxx
  2. 3 2
      Source/cmTryRunCommand.cxx

+ 1 - 1
Source/cmExportInstallAndroidMKGenerator.cxx

@@ -26,7 +26,7 @@ void cmExportInstallAndroidMKGenerator::GenerateImportHeaderCode(
   std::string installDir = this->IEGen->GetDestination();
   std::string installDir = this->IEGen->GetDestination();
   os << "LOCAL_PATH := $(call my-dir)\n";
   os << "LOCAL_PATH := $(call my-dir)\n";
   size_t numDotDot = cmSystemTools::CountChar(installDir.c_str(), '/');
   size_t numDotDot = cmSystemTools::CountChar(installDir.c_str(), '/');
-  numDotDot += (installDir.size() > 0) ? 1 : 0;
+  numDotDot += installDir.empty() ? 0 : 1;
   std::string path;
   std::string path;
   for (size_t n = 0; n < numDotDot; n++) {
   for (size_t n = 0; n < numDotDot; n++) {
     path += "/..";
     path += "/..";

+ 3 - 2
Source/cmTryRunCommand.cxx

@@ -86,8 +86,9 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv,
 
 
   // although they could be used together, don't allow it, because
   // although they could be used together, don't allow it, because
   // using OUTPUT_VARIABLE makes crosscompiling harder
   // using OUTPUT_VARIABLE makes crosscompiling harder
-  if (this->OutputVariable.size() && (!this->RunOutputVariable.empty() ||
-                                      !this->CompileOutputVariable.empty())) {
+  if (!this->OutputVariable.empty() &&
+      (!this->RunOutputVariable.empty() ||
+       !this->CompileOutputVariable.empty())) {
     cmSystemTools::Error(
     cmSystemTools::Error(
       "You cannot use OUTPUT_VARIABLE together with COMPILE_OUTPUT_VARIABLE "
       "You cannot use OUTPUT_VARIABLE together with COMPILE_OUTPUT_VARIABLE "
       "or RUN_OUTPUT_VARIABLE. Please use only COMPILE_OUTPUT_VARIABLE and/or "
       "or RUN_OUTPUT_VARIABLE. Please use only COMPILE_OUTPUT_VARIABLE and/or "