Yes, thank you. On Saturday, December 20, 2014, Rolf Eike Beer <e...@sf-mail.de> wrote:
> Justin Borodinsky wrote: > > I received a bad alloc when uploading a large file with CTest. The patch > > below resolved this. > > Your patch is line-wrapped and can't be applied. However, I did this by > hand. > This is basically the same, but it avoids the needless floating point > arithmetic. Does it work for you? > > diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx > index 2bf7b77..1a7bf45 100644 > --- a/Source/cmCTest.cxx > +++ b/Source/cmCTest.cxx > @@ -1688,7 +1688,7 @@ std::string > cmCTest::Base64GzipEncodeFile(std::string file) > //---------------------------------------------------------------------- > std::string cmCTest::Base64EncodeFile(std::string file) > { > - long len = cmSystemTools::FileLength(file); > + const size_t len = cmSystemTools::FileLength(file); > cmsys::ifstream ifs(file.c_str(), std::ios::in > #ifdef _WIN32 > | std::ios::binary > @@ -1699,8 +1699,7 @@ std::string cmCTest::Base64EncodeFile(std::string > file) > ifs.close(); > > unsigned char *encoded_buffer > - = new unsigned char [ static_cast<int>( > - static_cast<double>(len) * 1.5 + 5.0) ]; > + = new unsigned char [ (len * 3) / 2 + 5 ]; > > unsigned long rlen > = cmsysBase64_Encode(file_buffer, len, encoded_buffer, 1); > > > > Eike > --
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers