[Libreoffice-commits] .: 3 commits - registry/source sal/qa

Caolán McNamara caolan at kemper.freedesktop.org
Mon Apr 4 08:57:42 PDT 2011


 registry/source/regimpl.cxx                 |   32 +++++++++++++++-------------
 sal/qa/osl/file/osl_old_test_file.cxx       |   11 +++++++--
 sal/qa/rtl/doublelock/rtl_doublelocking.cxx |    6 ++---
 3 files changed, 30 insertions(+), 19 deletions(-)

New commits:
commit 784641a19811c22208e7db8efa150e744348d8bf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 4 16:57:36 2011 +0100

    the SAL_ALLOW_LINKOO_SYMLINKS hack breaks this test

diff --git a/sal/qa/osl/file/osl_old_test_file.cxx b/sal/qa/osl/file/osl_old_test_file.cxx
index b68bb7a..e1d8e87 100644
--- a/sal/qa/osl/file/osl_old_test_file.cxx
+++ b/sal/qa/osl/file/osl_old_test_file.cxx
@@ -61,6 +61,13 @@ namespace osl_test_file
 class oldtestfile : public CppUnit::TestFixture
 {
 public:
+    oldtestfile()
+    {
+        //SAL_ALLOW_LINKOO_SYMLINKS for the make dev-install hack breaks this test
+        rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("SAL_ALLOW_LINKOO_SYMLINKS"));
+        osl_clearEnvironment(envVar.pData);
+    }
+
     void test_file_001();
     void test_file_002();
     void test_file_003();
@@ -126,7 +133,7 @@ void oldtestfile::test_file_001()
         OUString target;
         OUString rel = OUString::createFromAscii( aSource1[i] );
         oslFileError e = osl_getAbsoluteFileURL( base1.pData, rel.pData , &target.pData );
-        // printf("%d : %s -- %s -- %s\n", i, aSource1[i], aSource1[i+1], OUStringToOString(target , RTL_TEXTENCODING_ASCII_US ).getStr() );
+        //fprintf(stderr, "%d : %s -- %s -- %s\n", i, aSource1[i], aSource1[i+1], OUStringToOString(target , RTL_TEXTENCODING_ASCII_US ).getStr() );
         CPPUNIT_ASSERT_MESSAGE("failure #1",  osl_File_E_None == e );
         if( osl_File_E_None == e )
         {
@@ -156,7 +163,7 @@ void oldtestfile::test_file_002()
         OUString target;
         OUString rel = OUString::createFromAscii( aSource2[i] );
         oslFileError e = osl_getAbsoluteFileURL( base2.pData, rel.pData , &target.pData );
-        // printf("%d : %s -- %s -- %s\n", i, aSource2[i], aSource2[i+1], OUStringToOString(target , RTL_TEXTENCODING_ASCII_US ).getStr() );
+        //fprintf(stderr, "%d : %s -- %s -- %s\n", i, aSource2[i], aSource2[i+1], OUStringToOString(target , RTL_TEXTENCODING_ASCII_US ).getStr() );
         CPPUNIT_ASSERT_MESSAGE("failure #2",  osl_File_E_None == e );
         if( osl_File_E_None == e )
         {
commit 8db8a48bc7725fb5061c43d3c06b6ca96ca30c90
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 4 16:01:51 2011 +0100

    WaE: rework to avoid warnings

diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index fdb0caa..3b49101 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -468,6 +468,7 @@ ORegistry::~ORegistry()
 //
 RegError ORegistry::initRegistry(const OUString& regName, RegAccessMode accessMode)
 {
+    RegError eRet = REG_INVALID_REGISTRY;
     OStoreFile      rRegFile;
     storeAccessMode sAccessMode = REG_MODE_OPEN;
     storeError      errCode;
@@ -475,8 +476,8 @@ RegError ORegistry::initRegistry(const OUString& regName, RegAccessMode accessMo
     if (accessMode & REG_CREATE)
     {
         sAccessMode = REG_MODE_CREATE;
-    } else
-    if (accessMode & REG_READONLY)
+    }
+    else if (accessMode & REG_READONLY)
     {
         sAccessMode = REG_MODE_OPENREAD;
         m_readOnly = sal_True;
@@ -496,17 +497,21 @@ RegError ORegistry::initRegistry(const OUString& regName, RegAccessMode accessMo
     {
         switch (errCode)
         {
-            case  store_E_NotExists:
-                return REG_REGISTRY_NOT_EXISTS;
+            case store_E_NotExists:
+                eRet = REG_REGISTRY_NOT_EXISTS;
+                break;
             case store_E_LockingViolation:
-                return REG_CANNOT_OPEN_FOR_READWRITE;
+                eRet = REG_CANNOT_OPEN_FOR_READWRITE;
+                break;
             default:
-                return REG_INVALID_REGISTRY;
+                eRet = REG_INVALID_REGISTRY;
+                break;
         }
-    } else
+    }
+    else
     {
         OStoreDirectory rStoreDir;
-        storeError      _err = rStoreDir.create(rRegFile, OUString(), OUString(), sAccessMode);
+        storeError _err = rStoreDir.create(rRegFile, OUString(), OUString(), sAccessMode);
 
         if ( _err == store_E_None )
         {
@@ -515,14 +520,13 @@ RegError ORegistry::initRegistry(const OUString& regName, RegAccessMode accessMo
             m_isOpen = sal_True;
 
             m_openKeyTable[ROOT] = new ORegKey(ROOT, this);
-            return REG_NO_ERROR;
-        } else
-            return REG_INVALID_REGISTRY;
+            eRet = REG_NO_ERROR;
+        }
+        else
+            eRet = REG_INVALID_REGISTRY;
     }
 
-    // this line is never accessed
-    // just workaround to avoid warning: control reaches end of non-void function
-    return REG_INVALID_REGISTRY;
+    return eRet;
 }
 
 
commit f5762eacda90cc4937bdf4e31c7c178e2f578909
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 4 15:46:27 2011 +0100

    helgrind: join threads before reading values

diff --git a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
index bfb7ec3..eb678d1 100644
--- a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
+++ b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
@@ -208,6 +208,9 @@ namespace rtl_DoubleLocking
                 pThread->terminate();
                 p2Thread->terminate();
 
+                pThread->join();
+                p2Thread->join();
+
                 sal_Int32 nValueOK = 0;
                 nValueOK = pThread->getOK();
 
@@ -232,9 +235,6 @@ namespace rtl_DoubleLocking
                 printf("Fails in Thread #2 is %d\n", nValueFails2);
 #endif
 
-                pThread->join();
-                p2Thread->join();
-
                 delete pThread;
                 delete p2Thread;
 


More information about the Libreoffice-commits mailing list