This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, next has been updated via bff33bd91319ca7bccb42830968cd8bd884fce73 (commit) via e63dcb1378bb6bd6b0a76c1760c4c24c27f221e5 (commit) via d5a373a10d530c797a00b3f7b815fa68cca24510 (commit) from 4f111cd25372b15b7e9f6373d08559edcd7c3792 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bff33bd91319ca7bccb42830968cd8bd884fce73 commit bff33bd91319ca7bccb42830968cd8bd884fce73 Merge: 4f111cd e63dcb1 Author: Clinton Stimpson <clin...@elemtech.com> AuthorDate: Wed Nov 5 09:28:12 2014 -0500 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Wed Nov 5 09:28:12 2014 -0500 Merge topic 'encoding-curl' into next e63dcb13 Encoding: Use encoding libcurl expects with file: urls. d5a373a1 CMake Nightly Date Stamp http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e63dcb1378bb6bd6b0a76c1760c4c24c27f221e5 commit e63dcb1378bb6bd6b0a76c1760c4c24c27f221e5 Author: Clinton Stimpson <clin...@elemtech.com> AuthorDate: Wed Nov 5 07:16:29 2014 -0700 Commit: Clinton Stimpson <clin...@elemtech.com> CommitDate: Wed Nov 5 07:20:21 2014 -0700 Encoding: Use encoding libcurl expects with file: urls. For unescaped file: URLs on Windows, libcurl expects the ANSI code page. This fixes the CMake.FileUpload test when CMake is configured to use UTF-8 internally with a non-ascii build directory name. diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 7ebd750..b0ddff4 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -33,6 +33,7 @@ #include <cmsys/Glob.hxx> #include <cmsys/RegularExpression.hxx> #include <cmsys/FStream.hxx> +#include <cmsys/Encoding.hxx> // Table of permissions flags. #if defined(_WIN32) && !defined(__CYGWIN__) @@ -61,6 +62,35 @@ static mode_t mode_setuid = S_ISUID; static mode_t mode_setgid = S_ISGID; #endif +#if defined(WIN32) && defined(CMAKE_ENCODING_UTF8) +// 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) +{ + std::string ret = url; + if(strncmp(url.c_str(), "file://", 7) == 0) + { + cmsys_stl::wstring wurl = cmsys::Encoding::ToWide(url); + if(!wurl.empty()) + { + int mblen = WideCharToMultiByte(CP_ACP, 0, wurl.c_str(), -1, + NULL, 0, NULL, NULL); + if(mblen > 0) + { + std::vector<char> chars(mblen); + mblen = WideCharToMultiByte(CP_ACP, 0, wurl.c_str(), -1, + &chars[0], mblen, NULL, NULL); + if(mblen > 0) + { + ret = &chars[0]; + } + } + } + } + return ret; +} +#endif + // cmLibraryCommand bool cmFileCommand ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) @@ -2988,6 +3018,10 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) return false; } +#if defined(WIN32) && defined(CMAKE_ENCODING_UTF8) + url = fix_file_url_windows(url); +#endif + ::CURL *curl; ::curl_global_init(CURL_GLOBAL_DEFAULT); curl = ::curl_easy_init(); @@ -3250,6 +3284,10 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) unsigned long file_size = cmsys::SystemTools::FileLength(filename.c_str()); +#if defined(WIN32) && defined(CMAKE_ENCODING_UTF8) + url = fix_file_url_windows(url); +#endif + ::CURL *curl; ::curl_global_init(CURL_GLOBAL_DEFAULT); curl = ::curl_easy_init(); ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- Source/cmFileCommand.cxx | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits