summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx84
1 files changed, 51 insertions, 33 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index a71ff71..c2e37c1 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -9,9 +9,9 @@
#include "cmGlobalGenerator.h"
#include "cmHexFileConverter.h"
#include "cmInstallType.h"
-#include "cmake.h"
-
+#include "cmMakefile.h"
#include "cmTimestamp.h"
+#include "cmake.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmCurl.h"
@@ -20,6 +20,7 @@
#undef GetCurrentDirectory
#include <assert.h>
+#include <stdlib.h>
#include <sys/types.h>
// include sys/stat.h after sys/types.h
@@ -59,7 +60,7 @@ static mode_t mode_setuid = S_ISUID;
static mode_t mode_setgid = S_ISGID;
#endif
-#if defined(_WIN32) && defined(CMAKE_ENCODING_UTF8)
+#if defined(_WIN32)
// libcurl doesn't support file:// urls for unicode filenames on Windows.
// Convert string from UTF-8 to ACP if this is a file:// URL.
static std::string fix_file_url_windows(const std::string& url)
@@ -110,46 +111,66 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args,
}
if (subCommand == "MD5" || subCommand == "SHA1" || subCommand == "SHA224" ||
subCommand == "SHA256" || subCommand == "SHA384" ||
- subCommand == "SHA512") {
+ subCommand == "SHA512" || subCommand == "SHA3_224" ||
+ subCommand == "SHA3_256" || subCommand == "SHA3_384" ||
+ subCommand == "SHA3_512") {
return this->HandleHashCommand(args);
}
if (subCommand == "STRINGS") {
return this->HandleStringsCommand(args);
- } else if (subCommand == "GLOB") {
+ }
+ if (subCommand == "GLOB") {
return this->HandleGlobCommand(args, false);
- } else if (subCommand == "GLOB_RECURSE") {
+ }
+ if (subCommand == "GLOB_RECURSE") {
return this->HandleGlobCommand(args, true);
- } else if (subCommand == "MAKE_DIRECTORY") {
+ }
+ if (subCommand == "MAKE_DIRECTORY") {
return this->HandleMakeDirectoryCommand(args);
- } else if (subCommand == "RENAME") {
+ }
+ if (subCommand == "RENAME") {
return this->HandleRename(args);
- } else if (subCommand == "REMOVE") {
+ }
+ if (subCommand == "REMOVE") {
return this->HandleRemove(args, false);
- } else if (subCommand == "REMOVE_RECURSE") {
+ }
+ if (subCommand == "REMOVE_RECURSE") {
return this->HandleRemove(args, true);
- } else if (subCommand == "COPY") {
+ }
+ if (subCommand == "COPY") {
return this->HandleCopyCommand(args);
- } else if (subCommand == "INSTALL") {
+ }
+ if (subCommand == "INSTALL") {
return this->HandleInstallCommand(args);
- } else if (subCommand == "DIFFERENT") {
+ }
+ if (subCommand == "DIFFERENT") {
return this->HandleDifferentCommand(args);
- } else if (subCommand == "RPATH_CHANGE" || subCommand == "CHRPATH") {
+ }
+ if (subCommand == "RPATH_CHANGE" || subCommand == "CHRPATH") {
return this->HandleRPathChangeCommand(args);
- } else if (subCommand == "RPATH_CHECK") {
+ }
+ if (subCommand == "RPATH_CHECK") {
return this->HandleRPathCheckCommand(args);
- } else if (subCommand == "RPATH_REMOVE") {
+ }
+ if (subCommand == "RPATH_REMOVE") {
return this->HandleRPathRemoveCommand(args);
- } else if (subCommand == "RELATIVE_PATH") {
+ }
+ if (subCommand == "RELATIVE_PATH") {
return this->HandleRelativePathCommand(args);
- } else if (subCommand == "TO_CMAKE_PATH") {
+ }
+ if (subCommand == "TO_CMAKE_PATH") {
return this->HandleCMakePathCommand(args, false);
- } else if (subCommand == "TO_NATIVE_PATH") {
+ }
+ if (subCommand == "TO_NATIVE_PATH") {
return this->HandleCMakePathCommand(args, true);
- } else if (subCommand == "TIMESTAMP") {
+ }
+ if (subCommand == "TIMESTAMP") {
return this->HandleTimestampCommand(args);
- } else if (subCommand == "GENERATE") {
+ }
+ if (subCommand == "GENERATE") {
return this->HandleGenerateCommand(args);
- } else if (subCommand == "LOCK") {
+ }
+ if (subCommand == "LOCK") {
return this->HandleLockCommand(args);
}
@@ -2431,18 +2452,14 @@ public:
{
}
- ~cURLEasyGuard(void)
+ ~cURLEasyGuard()
{
if (this->Easy) {
::curl_easy_cleanup(this->Easy);
}
}
- inline void release(void)
- {
- this->Easy = CM_NULLPTR;
- return;
- }
+ void release() { this->Easy = CM_NULLPTR; }
private:
::CURL* Easy;
@@ -2539,7 +2556,8 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
this->SetError("DOWNLOAD missing sum value for EXPECTED_MD5.");
return false;
}
- hash = CM_AUTO_PTR<cmCryptoHash>(cmCryptoHash::New("MD5"));
+ hash =
+ CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHash(cmCryptoHash::AlgoMD5));
hashMatchMSG = "MD5 sum";
expectedHash = cmSystemTools::LowerCase(*i);
} else if (*i == "SHOW_PROGRESS") {
@@ -2586,7 +2604,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
// Do not return error for compatibility reason.
std::string err = "Unexpected argument: ";
err += *i;
- this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err.c_str());
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err);
}
++i;
}
@@ -2628,7 +2646,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
return false;
}
-#if defined(_WIN32) && defined(CMAKE_ENCODING_UTF8)
+#if defined(_WIN32)
url = fix_file_url_windows(url);
#endif
@@ -2870,7 +2888,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
// Do not return error for compatibility reason.
std::string err = "Unexpected argument: ";
err += *i;
- this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err.c_str());
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err);
}
++i;
@@ -2888,7 +2906,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
unsigned long file_size = cmsys::SystemTools::FileLength(filename);
-#if defined(_WIN32) && defined(CMAKE_ENCODING_UTF8)
+#if defined(_WIN32)
url = fix_file_url_windows(url);
#endif