[Libreoffice-commits] .: Branch 'feature/killsdf' - l10ntools/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Aug 31 11:00:30 PDT 2012


 l10ntools/source/po.cxx |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit dd83185b004e08fe0b291ede225d0e93be27c819
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date:   Fri Aug 31 18:19:32 2012 +0200

    Correct KeyId generator
    
    Use integer aritmetic and less cast
    
    Change-Id: I6fc0667fcbcee5f1a2dc964e2653c042338afa0c
    Reviewed-on: https://gerrit.libreoffice.org/523
    Reviewed-by: Andras Timar <atimar at suse.com>
    Tested-by: Andras Timar <atimar at suse.com>

diff --git a/l10ntools/source/po.cxx b/l10ntools/source/po.cxx
index a82a88b..59199c2 100644
--- a/l10ntools/source/po.cxx
+++ b/l10ntools/source/po.cxx
@@ -32,14 +32,15 @@ OString ImplGenKeyId(const OString& rGenerator)
     boost::crc_32_type aCRC32;
     aCRC32.process_bytes(rGenerator.getStr(), rGenerator.getLength());
     sal_uInt32 nCRC = aCRC32.checksum();
-    OString sKeyId = "";
-    while ( sKeyId.getLength() < 4 )
+    char sKeyId[5];
+    for(int nIndex = 0; nIndex < 4; ++nIndex)
     {
-        //Concat a char from the [33,126] interval of ASCII
-        sKeyId += OString(char(int(double(nCRC & 255)/255*93)+33));
+        //Get a char from the [33,126] interval of ASCII
+        sKeyId[nIndex] = static_cast<char>((nCRC & 255) % 93 + 33);
         nCRC >>= 8;
     }
-    return sKeyId;
+    sKeyId[4] = 0;
+    return OString(sKeyId);
 }
 
 //Escape text


More information about the Libreoffice-commits mailing list