[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - 3 commits - librelogo/source xmlhelp/source

László Németh nemeth at numbertext.org
Fri Oct 25 07:50:54 PDT 2013


 librelogo/source/LibreLogo/LibreLogo.py       |    8 ++++----
 xmlhelp/source/cxxhelp/provider/databases.cxx |    8 +++-----
 2 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 4d576a2cbc6cdadea578ba3c2f408ba6676bf101
Author: László Németh <nemeth at numbertext.org>
Date:   Fri Oct 25 08:30:30 2013 +0200

    librelogo: fix division with measurements
    
    Change-Id: I2204002533bbb3e7c801b3228b0310a42b19a882
    (cherry picked from commit 7744c4a0016be338c6c14b14f620d8af7d76111e)

diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py
index b524a8c..5076c7c 100644
--- a/librelogo/source/LibreLogo/LibreLogo.py
+++ b/librelogo/source/LibreLogo/LibreLogo.py
@@ -1359,7 +1359,7 @@ def __loadlang__(lang, a):
     [r"(?<=\n)__repeat__([^\n]*\w[^\n]*):(?=\n)", "for %s in range(1, 1+int(\\1)):" % repcount], # repeat block
     [r"(?<=\d)[%s](?=\d)" % a['DECIMAL'], "."], # decimal sign
     [r"(?<!/)/(?!/)", "*1.0/"], # fix division: /1 -> /1.0, but not with //
-    [r"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['HOUR'], "\\1*30"], # 12h = 12*30°
+    [r"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['HOUR'], lambda r: str(float(r.group(1).replace(",", "."))*30)], # 12h = 12*30°
     [r"(?<=\d)(%s)" % a['DEG'], ""], # 1° -> 1
     [r"(?<!:)\b(?:__def__)[ \t]+(\w+)\b[ \t]*([:]?\w[^\n]*)", "\ndef \\1(\\2):\n["],
     [r"(?<!:)\b(?:__def__)\s+(\w+)", "\ndef \\1():\n["],
@@ -1431,9 +1431,9 @@ def __loadlang__(lang, a):
     [r"(?<!:)\b(?:%s)\b" % a['PRINT'], "\n)Print("],
     [r"(?<!:)\b(?:%s)\b" % a['TURNLEFT'], "\n)turnleft("],
     [r"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['PT'], "\\1"],
-    [r"\b([0-9]+([,.][0-9]+)?)(%s)(?!\w)" % a['INCH'], "\\1*72"],
-    [r"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['MM'], "\\1*%s" % __MM_TO_PT__],
-    [r"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['CM'], "\\1*%s*10" % __MM_TO_PT__],
+    [r"\b([0-9]+([,.][0-9]+)?)(%s)(?!\w)" % a['INCH'], lambda r: str(float(r.group(1).replace(",", "."))*72)],
+    [r"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['MM'], lambda r: str(float(r.group(1).replace(",", "."))*__MM_TO_PT__)],
+    [r"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['CM'], lambda r: str(float(r.group(1).replace(",", "."))*__MM_TO_PT__*10)],
     [r"\b(__(?:int|float|string)__len|round|abs|sin|cos|sqrt|set|list|tuple|sorted)\b ((?:\w|\d+([,.]\d+)?|0[xX][0-9a-fA-F]+|[-+*/]| )+)\)" , "\\1(\\2))" ], # fix parsing: (1 + sqrt x) -> (1 + sqrt(x))
     [r"(?<=[-*/=+,]) ?\n\)(\w+)\(", "\\1()"], # read attributes, eg. x = fillcolor
     [r"(?<=return) ?\n\)(\w+)\(", "\\1()"], # return + user function
commit 929dc54a1bb034d787a5a90d7c2d9d603ecfbfa3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 24 16:20:08 2013 +0100

    valgrind: on success aHDFData is out of scope
    
    and pData points to data belonging to it
    
    (cherry picked from commit b7efab3a9841a9f01c5da07db870a22866b65b04)
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>
    
    Change-Id: I2a3c1f73e4cdcb07d21ef14cb410d351f39cdba8

diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 331aa20..0c4bdab 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -767,12 +767,12 @@ void KeywordInfo::KeywordElement::init( Databases *pDatabases,helpdatafileproxy:
         listId[i] = id[i];
         listAnchor[i] = anchor[i];
 
+        helpdatafileproxy::HDFData aHDFData;
         const sal_Char* pData = NULL;
 
         if( pHdf )
         {
             OString idi( id[i].getStr(),id[i].getLength(),RTL_TEXTENCODING_UTF8 );
-            helpdatafileproxy::HDFData aHDFData;
             bool bSuccess = pHdf->getValueForKey( idi, aHDFData );
             if( bSuccess )
                 pData = aHDFData.getData();
commit a3d62a83a834c788d16c520cbf7f9c3dd03aacb3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 24 16:18:41 2013 +0100

    pEmpty is completely insane to use
    
    DbtToStringConverter protects against a NULL pointer, but not a
    pointer to the too short data that pEmpty provides
    
    Change-Id: I5d21e852ce0373eff7d3627e266b9cbc77f5dd09
    (cherry picked from commit d94f3a68f77de906abd576c7e2f31e0a8586d154)
    Reviewed-on: https://gerrit.libreoffice.org/6421
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 447d1e0..331aa20 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -762,15 +762,13 @@ void KeywordInfo::KeywordElement::init( Databases *pDatabases,helpdatafileproxy:
     listAnchor.realloc( id.size() );
     listTitle.realloc( id.size() );
 
-    const sal_Char* pData = NULL;
-    const sal_Char pEmpty[] = "";
-
     for( sal_uInt32 i = 0; i < id.size(); ++i )
     {
         listId[i] = id[i];
         listAnchor[i] = anchor[i];
 
-        pData = pEmpty;
+        const sal_Char* pData = NULL;
+
         if( pHdf )
         {
             OString idi( id[i].getStr(),id[i].getLength(),RTL_TEXTENCODING_UTF8 );


More information about the Libreoffice-commits mailing list