[Libreoffice-commits] .: 2 commits - registry/tools

Stephan Bergmann sbergman at redhat.com
Sun Feb 3 01:32:27 PST 2013


 registry/tools/reg2bin.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 8517b6162e5531e733a0b2ffe8106873d8e0d082
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sun Feb 3 10:31:33 2013 +0100

    Typo
    
    Change-Id: I8e4f7c5a44bc300913efb68f901b794d8fb385fe

diff --git a/registry/tools/reg2bin.cxx b/registry/tools/reg2bin.cxx
index 862289a..7e5001e 100644
--- a/registry/tools/reg2bin.cxx
+++ b/registry/tools/reg2bin.cxx
@@ -975,7 +975,7 @@ sal_uInt64 writeNameNul(osl::File & file, rtl::OUString const & name) {
 
 void writeNameLen(osl::File & file, rtl::OUString const & name) {
     rtl::OString ascii(toAscii(name));
-    write32(file, name.getLength());
+    write32(file, ascii.getLength());
     write(file, ascii.getStr(), ascii.getLength());
 }
 
commit 027b5e48329b508bd88616fe9dee8646e354480f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sun Feb 3 10:29:51 2013 +0100

    reg2bin: truncate pre-existing output files
    
    Change-Id: If74cccf8657c1b81467ee9c0dea29a749ca07455

diff --git a/registry/tools/reg2bin.cxx b/registry/tools/reg2bin.cxx
index 959f25d..862289a 100644
--- a/registry/tools/reg2bin.cxx
+++ b/registry/tools/reg2bin.cxx
@@ -1395,6 +1395,14 @@ SAL_IMPLEMENT_MAIN() {
     write32(f, 0); // root map offset
     write32(f, 0); // root map size
     sal_uInt64 off = writeMap(f, map, true);
+    e2 = f.setSize(getOffset(f)); // truncate in case it already existed
+    if (e2 != osl::FileBase::E_None) {
+        std::cerr
+            << "Cannot set size of \"" << f.getURL() << "\", error code "
+            << +e2 << "\n";
+        std::exit(EXIT_FAILURE);
+    }
+
     e2 = f.setPos(osl_Pos_Absolut, 8);
     if (e2 != osl::FileBase::E_None) {
         std::cerr


More information about the Libreoffice-commits mailing list