[Libreoffice-commits] .: l10ntools/source
Andras Timar
timar at kemper.freedesktop.org
Fri Oct 28 06:54:37 PDT 2011
l10ntools/source/xrmmerge.cxx | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
New commits:
commit e1ef3ad57dfa59c3c97e811f76351f7982f77020
Author: Andras Timar <atimar at suse.com>
Date: Fri Oct 28 15:52:42 2011 +0200
char array should be null terminated
diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx
index e30a3e1..b158b35 100644
--- a/l10ntools/source/xrmmerge.cxx
+++ b/l10ntools/source/xrmmerge.cxx
@@ -532,15 +532,16 @@ void XRMResExport::WorkOnDesc(
ByteString sDescFileName( aEntry.GetFull(), RTL_TEXTENCODING_ASCII_US );
sDescFileName.SearchAndReplaceAll( "description.xml", "" );
sDescFileName += GetAttribute( rOpenTag, "xlink:href" );
- ifstream::pos_type size;
+ int size;
char * memblock;
ifstream file (sDescFileName.GetBuffer(), ios::in|ios::binary|ios::ate);
if (file.is_open()) {
- size = file.tellg();
- memblock = new char [size];
+ size = static_cast<int>(file.tellg());
+ memblock = new char [size+1];
file.seekg (0, ios::beg);
file.read (memblock, size);
file.close();
+ memblock[size] = '\0';
rText = ByteString(memblock);
rText.SearchAndReplaceAll( "\n", "\\n" );
delete[] memblock;
More information about the Libreoffice-commits
mailing list