[Libreoffice-commits] core.git: Branch 'aoo/trunk' - l10ntools/source

Herbert Dürr hdu at apache.org
Tue Jun 24 03:08:47 PDT 2014


 l10ntools/source/export2.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit cb8f2e44c2772af90e7be12dfc8bbf167f31f56b
Author: Herbert Dürr <hdu at apache.org>
Date:   Tue Jun 24 09:48:21 2014 +0000

    #i125143# reduce helpex stack usage to prevent intermittent failures
    
    moving the 1MB copy buffer from the stack to the heap solves the problem
    that was first observed on the Windows buildbot.

diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx
index 1608a09..fb9df40 100644
--- a/l10ntools/source/export2.cxx
+++ b/l10ntools/source/export2.cxx
@@ -36,6 +36,7 @@
 #include <tools/urlobj.hxx>
 #include <time.h>
 #include <stdlib.h>
+#include <boost/shared_ptr.hpp>
 
 using namespace std;
 //
@@ -339,9 +340,6 @@ void Export::RemoveUTF8ByteOrderMarkerFromFile( const ByteString &rFilename ){
 bool Export::CopyFile( const ByteString& source , const ByteString& dest )
 {
 //    cout << "CopyFile( " << source.GetBuffer() << " , " << dest.GetBuffer() << " )\n";
-    static const int BUFFERSIZE = 0x100000;
-    char buf[ BUFFERSIZE ];
-
     FILE* IN_FILE = fopen( source.GetBuffer() , "r" );
     if( IN_FILE == NULL )
     {
@@ -357,6 +355,10 @@ bool Export::CopyFile( const ByteString& source , const ByteString& dest )
         return false;
     }
 
+    static const int BUFFERSIZE = 0x100000;
+    boost::shared_ptr<char> aScopedBuffer( new char[BUFFERSIZE] );
+    char* buf = aScopedBuffer.get();
+
     bool bOk = true;
     while( bOk )
     {


More information about the Libreoffice-commits mailing list