Merge topic 'encoding-ctest-fixes'
09b2ac38
Encoding: Fix a few encoding problems with ctest.
This commit is contained in:
commit
0aa7d9dc10
|
@ -225,8 +225,8 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix,
|
||||||
std::string upload_as
|
std::string upload_as
|
||||||
= url + "/" + remoteprefix + cmSystemTools::GetFilenameName(*file);
|
= url + "/" + remoteprefix + cmSystemTools::GetFilenameName(*file);
|
||||||
|
|
||||||
struct stat st;
|
|
||||||
if ( ::stat(local_file.c_str(), &st) )
|
if ( !cmSystemTools::FileExists(local_file.c_str()) )
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: "
|
cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: "
|
||||||
<< local_file << std::endl);
|
<< local_file << std::endl);
|
||||||
|
@ -234,6 +234,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix,
|
||||||
::curl_global_cleanup();
|
::curl_global_cleanup();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
unsigned long filelen = cmSystemTools::FileLength(local_file.c_str());
|
||||||
|
|
||||||
ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb");
|
ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb");
|
||||||
*this->LogFile << "\tUpload file: " << local_file << " to "
|
*this->LogFile << "\tUpload file: " << local_file << " to "
|
||||||
|
@ -252,7 +253,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix,
|
||||||
|
|
||||||
// and give the size of the upload (optional)
|
// and give the size of the upload (optional)
|
||||||
::curl_easy_setopt(curl, CURLOPT_INFILESIZE,
|
::curl_easy_setopt(curl, CURLOPT_INFILESIZE,
|
||||||
static_cast<long>(st.st_size));
|
static_cast<long>(filelen));
|
||||||
|
|
||||||
// and give curl the buffer for errors
|
// and give curl the buffer for errors
|
||||||
::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer);
|
::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer);
|
||||||
|
@ -466,8 +467,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
|
||||||
upload_as += md5;
|
upload_as += md5;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct stat st;
|
if( !cmSystemTools::FileExists(local_file.c_str()) )
|
||||||
if ( ::stat(local_file.c_str(), &st) )
|
|
||||||
{
|
{
|
||||||
cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: "
|
cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: "
|
||||||
<< local_file << std::endl);
|
<< local_file << std::endl);
|
||||||
|
@ -475,11 +475,12 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
|
||||||
::curl_global_cleanup();
|
::curl_global_cleanup();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
unsigned long filelen = cmSystemTools::FileLength(local_file.c_str());
|
||||||
|
|
||||||
ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb");
|
ftpfile = cmsys::SystemTools::Fopen(local_file.c_str(), "rb");
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: "
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Upload file: "
|
||||||
<< local_file << " to "
|
<< local_file << " to "
|
||||||
<< upload_as << " Size: " << st.st_size << std::endl);
|
<< upload_as << " Size: " << filelen << std::endl);
|
||||||
|
|
||||||
// specify target
|
// specify target
|
||||||
::curl_easy_setopt(curl,CURLOPT_URL, upload_as.c_str());
|
::curl_easy_setopt(curl,CURLOPT_URL, upload_as.c_str());
|
||||||
|
@ -489,7 +490,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
|
||||||
|
|
||||||
// and give the size of the upload (optional)
|
// and give the size of the upload (optional)
|
||||||
::curl_easy_setopt(curl, CURLOPT_INFILESIZE,
|
::curl_easy_setopt(curl, CURLOPT_INFILESIZE,
|
||||||
static_cast<long>(st.st_size));
|
static_cast<long>(filelen));
|
||||||
|
|
||||||
// and give curl the buffer for errors
|
// and give curl the buffer for errors
|
||||||
::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer);
|
::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer);
|
||||||
|
|
|
@ -1,11 +1,19 @@
|
||||||
#include <cmSystemTools.h>
|
#include <cmSystemTools.h>
|
||||||
|
#include <cmsys/Encoding.hxx>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
#define RETVAL @_retval@
|
#define RETVAL @_retval@
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int ac, char **av)
|
||||||
{
|
{
|
||||||
|
setlocale(LC_CTYPE, "");
|
||||||
|
cmsys::Encoding::CommandLineArguments args =
|
||||||
|
cmsys::Encoding::CommandLineArguments::Main(ac, av);
|
||||||
|
int argc = args.argc();
|
||||||
|
const char* const* argv = args.argv();
|
||||||
|
|
||||||
std::string exename = argv[0];
|
std::string exename = argv[0];
|
||||||
std::string logarg;
|
std::string logarg;
|
||||||
bool nextarg = false;
|
bool nextarg = false;
|
||||||
|
|
Loading…
Reference in New Issue