[cmake-developers] [PATCH] Avoid bad alloc for large files

2014-12-20 Thread Justin Borodinsky
I received a bad alloc when uploading a large file with CTest. The patch
below resolved this.



---
 Source/cmCTest.cxx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 2bf7b77..52bf651 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);
+  std::size_t len =
static_caststd::size_t(cmSystemTools::FileLength(file));
   cmsys::ifstream ifs(file.c_str(), std::ios::in
 #ifdef _WIN32
 | std::ios::binary
@@ -1699,7 +1699,7 @@ std::string cmCTest::Base64EncodeFile(std::string
file)
   ifs.close();

   unsigned char *encoded_buffer
-= new unsigned char [ static_castint(
+= new unsigned char [ static_caststd::size_t(
 static_castdouble(len) * 1.5 + 5.0) ];

   unsigned long rlen
-- 

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

Re: [cmake-developers] [PATCH] Avoid bad alloc for large files

2014-12-20 Thread Rolf Eike Beer
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_castint(
-static_castdouble(len) * 1.5 + 5.0) ];
+= new unsigned char [ (len * 3) / 2 + 5 ];
 
   unsigned long rlen
 = cmsysBase64_Encode(file_buffer, len, encoded_buffer, 1);



Eike
-- 

signature.asc
Description: This is a digitally signed message part.
-- 

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

Re: [cmake-developers] [PATCH] Avoid bad alloc for large files

2014-12-20 Thread Justin Borodinsky
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_castint(
 -static_castdouble(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

[cmake-developers] [CMake 0015321]: Generation of the ninja, ignore escape

2014-12-20 Thread Mantis Bug Tracker

The following issue has been SUBMITTED. 
== 
http://public.kitware.com/Bug/view.php?id=15321 
== 
Reported By:Denis Denisov
Assigned To:
== 
Project:CMake
Issue ID:   15321
Category:   CMake
Reproducibility:always
Severity:   minor
Priority:   normal
Status: new
== 
Date Submitted: 2014-12-20 19:12 EST
Last Modified:  2014-12-20 19:12 EST
== 
Summary:Generation of the ninja, ignore escape
Description: 
`ninja: error: build.ninja:3194: bad $-escape (literal $ must be written as
$$)``



Additional Information: 
before code:
```
  # Xcode/Ninja generators undefined MAKE
  if(NOT MAKE)
set(MAKE make)
  endif()

  add_custom_target(
hack
ALL
COMMAND
  env OPTBIN=${OCAMLC_OPT_SUFFIX}
  $(MAKE) EXTRA_INCLUDE_PATHS=${extra_include_paths}
  EXTRA_LIB_PATHS=${extra_lib_paths}
  EXTRA_CC_FLAGS=${extra_cc_flags}
  EXTRA_NATIVE_LIBRARIES=${extra_native_libraries}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src
  )
```


code build.ninja:3194:
```
#
# Custom command for hphp/hack/CMakeFiles/hack

build hphp/hack/CMakeFiles/hack: CUSTOM_COMMAND || third-party/lz4/liblz4.a
  COMMAND = cd /home/denji/Desktop/hhvm/hphp/hack/src  env OPTBIN=.opt
$(MAKE) EXTRA_INCLUDE_PATHS=/usr/include
/home/denji/Desktop/hhvm/third-party/lz4
EXTRA_LIB_PATHS=/usr/lib/x86_64-linux-gnu
/home/denji/Desktop/hhvm/third-party/lz4
EXTRA_CC_FLAGS=-DHAVE_ELF_GETSHDRSTRNDX -pthread EXTRA_NATIVE_LIBRARIES=lz4
``
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2014-12-20 19:12 Denis Denisov  New Issue
==

-- 

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


[cmake-developers] patch to fix installed size for cpack PackageMaker generator

2014-12-20 Thread Calin Cascaval
Hi,
The cpack PackageMaker generator reports all packages as having a size of 1 
because it does not use the CPACK_PACKAGING_INSTALL_PREFIX when looking for 
files in a component. Attached is a patch that fixes this issue.

--
Thanks, Calin





0001-fixes-installed-sizes-for-cpack-PackageMaker-generat.patch
Description: Binary data



smime.p7s
Description: S/MIME cryptographic signature
-- 

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