[Libreoffice-commits] core.git: 8 commits - cui/source desktop/source include/jvmfwk jvmfwk/inc jvmfwk/plugins jvmfwk/source stoc/source svtools/source

Stephan Bergmann sbergman at redhat.com
Thu Mar 10 20:43:50 UTC 2016


 cui/source/options/optjava.cxx                      |   12 +-
 desktop/source/migration/services/jvmfwk.cxx        |    2 
 include/jvmfwk/framework.hxx                        |  101 ++++++++++----------
 jvmfwk/inc/vendorplugin.hxx                         |    7 -
 jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx    |   15 +-
 jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx |   25 +---
 jvmfwk/source/elements.cxx                          |   16 ---
 jvmfwk/source/framework.cxx                         |   98 ++++++-------------
 stoc/source/javavm/javavm.cxx                       |   29 -----
 svtools/source/java/javainteractionhandler.cxx      |    2 
 10 files changed, 123 insertions(+), 184 deletions(-)

New commits:
commit eee4dd746ea3fc09d51d008446ec82e3de456eed
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 10 21:40:45 2016 +0100

    Fix memory leaks
    
    Change-Id: If9f7dc4a28d5e005959f0d4a0a2ed317b699f292

diff --git a/include/jvmfwk/framework.hxx b/include/jvmfwk/framework.hxx
index e88ae4b..9a3b884 100644
--- a/include/jvmfwk/framework.hxx
+++ b/include/jvmfwk/framework.hxx
@@ -255,6 +255,26 @@ struct JavaInfo
     rtl::ByteSequence arVendorData;
 };
 
+namespace jfw {
+
+struct JavaInfoGuard {
+    JavaInfoGuard(JavaInfoGuard &) = delete;
+    void operator =(JavaInfoGuard) = delete;
+
+    JavaInfoGuard(): info(nullptr) {}
+
+    ~JavaInfoGuard() { delete info; }
+
+    void clear() {
+        delete info;
+        info = nullptr;
+    }
+
+    JavaInfo * info;
+};
+
+}
+
 /** compares two <code>JavaInfo</code> objects for equality.
 
    <p>Two <code>JavaInfo</code> objects are said to be equal if the contained
diff --git a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx
index ea2f846..9daf574 100644
--- a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx
+++ b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx
@@ -64,8 +64,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
             return -1;
         }
 
-        JavaInfo * pInfo = nullptr;
-        errcode = jfw_getSelectedJRE( & pInfo);
+        jfw::JavaInfoGuard pInfo;
+        errcode = jfw_getSelectedJRE(&pInfo.info);
 
         if (errcode != JFW_E_NONE && errcode != JFW_E_INVALID_SETTINGS)
         {
@@ -73,19 +73,19 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
             return -1;
         }
 
-        if (pInfo == nullptr)
+        if (pInfo.info == nullptr)
         {
-            if (!findAndSelect(&pInfo))
+            if (!findAndSelect(&pInfo.info))
                 return -1;
         }
         else
         {
             //check if the JRE was not uninstalled
             sal_Bool bExist = sal_False;
-            errcode = jfw_existJRE(pInfo, &bExist);
+            errcode = jfw_existJRE(pInfo.info, &bExist);
             if (errcode == JFW_E_NONE)
             {
-                if (!bExist && !findAndSelect(&pInfo))
+                if (!bExist && !findAndSelect(&pInfo.info))
                     return -1;
             }
             else
@@ -95,9 +95,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
             }
         }
 
-        OString sPaths = getLD_LIBRARY_PATH(pInfo->arVendorData);
+        OString sPaths = getLD_LIBRARY_PATH(pInfo.info->arVendorData);
         fprintf(stdout, "%s\n", sPaths.getStr());
-        delete pInfo;
     }
     catch (const std::exception&)
     {
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index ab72925..0e65773 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -657,23 +657,6 @@ JavaVirtualMachine::getSupportedServiceNames()
     return serviceGetSupportedServiceNames();
 }
 
-namespace {
-
-struct JavaInfoGuard: private boost::noncopyable {
-    JavaInfoGuard(): info(nullptr) {}
-
-    ~JavaInfoGuard() { delete info; }
-
-    void clear() {
-        delete info;
-        info = nullptr;
-    }
-
-    JavaInfo * info;
-};
-
-}
-
 css::uno::Any SAL_CALL
 JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
     throw (css::uno::RuntimeException, std::exception)
@@ -698,7 +681,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
     if (aId != aProcessId)
         return css::uno::Any();
 
-    JavaInfoGuard info;
+    jfw::JavaInfoGuard info;
     while (!m_xVirtualMachine.is()) // retry until successful
     {
         // This is the second attempt to create Java.  m_bDontCreateJvm is
@@ -816,14 +799,14 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
             //we search another one. As long as there is a javaldx, we should
             //never come into this situation. javaldx checks always if the JRE
             //still exist.
-            JavaInfo * pJavaInfo = nullptr;
-            if (JFW_E_NONE == jfw_getSelectedJRE(&pJavaInfo))
+            jfw::JavaInfoGuard pJavaInfo;
+            if (JFW_E_NONE == jfw_getSelectedJRE(&pJavaInfo.info))
             {
                 sal_Bool bExist = sal_False;
-                if (JFW_E_NONE == jfw_existJRE(pJavaInfo, &bExist))
+                if (JFW_E_NONE == jfw_existJRE(pJavaInfo.info, &bExist))
                 {
                     if (!bExist
-                        && ! (pJavaInfo->nRequirements & JFW_REQUIRE_NEEDRESTART))
+                        && ! (pJavaInfo.info->nRequirements & JFW_REQUIRE_NEEDRESTART))
                     {
                         info.clear();
                         javaFrameworkError errFind = jfw_findAndSelectJRE(
@@ -836,8 +819,6 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
                 }
             }
 
-            delete pJavaInfo;
-
             //Error: %PRODUCTNAME requires a Java
             //runtime environment (JRE) to perform this task. The selected JRE
             //is defective. Please select another version or install a new JRE
commit 8e9a7cac42d554402a6ead3a83ae8b7defc9247b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 10 19:21:15 2016 +0100

    No more need for jfw_freeJavaInfo
    
    Change-Id: I2426a76936b4099a243ce8c102da867e7868aac3

diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 57e4ded..fadea88 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -214,7 +214,7 @@ void SvxJavaOptionsPage::dispose()
     for ( pIter = m_aAddedInfos.begin(); pIter != m_aAddedInfos.end(); ++pIter )
     {
         JavaInfo* pInfo = *pIter;
-        jfw_freeJavaInfo( pInfo );
+        delete pInfo;
     }
     m_aAddedInfos.clear();
 
@@ -442,7 +442,7 @@ void SvxJavaOptionsPage::ClearJavaInfo()
         for ( sal_Int32 i = 0; i < m_nInfoSize; ++i )
         {
             JavaInfo* pInfo = *parInfo++;
-            jfw_freeJavaInfo( pInfo );
+            delete pInfo;
         }
 
         rtl_freeMemory( m_parJavaInfo );
@@ -508,7 +508,7 @@ void SvxJavaOptionsPage::LoadJREs()
         }
     }
 
-    jfw_freeJavaInfo( pSelectedJava );
+    delete pSelectedJava;
 #else
     (void) this;
 #endif
@@ -602,7 +602,7 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder )
             nPos = m_pJavaList->GetEntryCount() - 1;
         }
         else
-            jfw_freeJavaInfo( pInfo );
+            delete pInfo;
 
         SvTreeListEntry* pEntry = m_pJavaList->GetEntry( nPos );
         m_pJavaList->Select( pEntry );
@@ -722,7 +722,7 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
                     bModified = true;
                 }
             }
-            jfw_freeJavaInfo( pSelectedJava );
+            delete pSelectedJava;
             break;
         }
     }
diff --git a/desktop/source/migration/services/jvmfwk.cxx b/desktop/source/migration/services/jvmfwk.cxx
index 1529b3d..8be315f 100644
--- a/desktop/source/migration/services/jvmfwk.cxx
+++ b/desktop/source/migration/services/jvmfwk.cxx
@@ -73,7 +73,7 @@ CJavaInfo::CJavaInfo(): pData(nullptr)
 
 CJavaInfo::~CJavaInfo()
 {
-    jfw_freeJavaInfo(pData);
+    delete pData;
 }
 
 
diff --git a/include/jvmfwk/framework.hxx b/include/jvmfwk/framework.hxx
index 184b2c1..e88ae4b 100644
--- a/include/jvmfwk/framework.hxx
+++ b/include/jvmfwk/framework.hxx
@@ -208,9 +208,7 @@ typedef enum _javaFrameworkError
 
     <p>
     Instances of this struct are created by the plug-in libraries which are used by
-    this framework (jvmfwk/vendorplugin.h).
-    For convenience this API provides the function <code>jfw_freeJavaInfo</code>
-    which frees the objects properly. </p>
+    this framework (jvmfwk/vendorplugin.h).</p>
  */
 struct JavaInfo
 {
@@ -257,13 +255,6 @@ struct JavaInfo
     rtl::ByteSequence arVendorData;
 };
 
-/** frees the memory of a <code>JavaInfo</code> object.
-    @param pInfo
-    The object which is to be freed. It can be NULL;
- */
-JVMFWK_DLLPUBLIC void jfw_freeJavaInfo(JavaInfo *pInfo);
-
-
 /** compares two <code>JavaInfo</code> objects for equality.
 
    <p>Two <code>JavaInfo</code> objects are said to be equal if the contained
@@ -362,7 +353,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_isVMRunning(sal_Bool *bRunning);
 
     @param ppInfo
     [out] a <code>JavaInfo</code> pointer, representing the selected JRE.
-    The caller has to free it by calling <code>jfw_freeJavaInfo<code>. The
+    The caller has to delete it. The
     <code>JavaInfo</code> is for informational purposes only. It is not
     necessary to call <code>jfw_setSelectedJRE</code> afterwards.<br/>
     <code>ppInfo</code>can be NULL. If <code>*ppInfo</code> is not null, then it is
@@ -393,7 +384,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo);
     [out] on returns it contains a pointer to an array of <code>JavaInfo</code>
     pointers.
     The caller must free the array with <code>rtl_freeMemory</code> and each
-    element of the array must be freed with <code>jfw_freeJavaInfo</code>.
+    element of the array must be deleted.
     @param pSize
     [out] on return contains the size of array returned in <code>parInfo</code>.
 
@@ -750,8 +741,8 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_existJRE(const JavaInfo *pInfo, sal_Bool
     should be called. That is, <code>jfw_startVM</code> which uses the
     settings cannot be called before all settings have be made.</p>
     <p>
-    The only functions which are not effected by <code>jfw_lock</code> are
-    <code>jfw_freeJavaInfo</code> and <code>jfw_areEqualJavaInfo</code>.
+    The only functions which is not effected by <code>jfw_lock</code> is
+    <code>jfw_areEqualJavaInfo</code>.
  */
 JVMFWK_DLLPUBLIC void jfw_lock();
 
diff --git a/jvmfwk/inc/vendorplugin.hxx b/jvmfwk/inc/vendorplugin.hxx
index a108cb3..0bd5988 100644
--- a/jvmfwk/inc/vendorplugin.hxx
+++ b/jvmfwk/inc/vendorplugin.hxx
@@ -73,8 +73,8 @@ typedef enum
     version should be the first in the array. </p>
     <p>
     The function allocates memory for an array and all the JavaInfo objects returned
-    in <code>parJavaInfo</code>. The caller must free each JavaInfo object by calling
-    <code>jfw_freeJavaInfo</code> (#include "jvmfwk/framework.hxx"). The array is to be
+    in <code>parJavaInfo</code>. The caller must delete each JavaInfo object.
+    The array is to be
     freed by rtl_freeMemory.
     In case an error occurred <code>parJavaInfo</code> need not be freed.
     </p>
@@ -217,8 +217,7 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
     is also the first element in the vector.</p>
     <p>
     The function allocates memory for all the JavaInfo objects returned
-    in <code>vecJavaInfosFromPath</code>. The caller must free each JavaInfo object by calling
-    <code>jfw_freeJavaInfo</code> (#include "jvmfwk/framework.hxx").
+    in <code>vecJavaInfosFromPath</code>. The caller must delete each JavaInfo object.
     </p>
     @param vecVendorInfos
        [in] vector specifying the vendor and version requirements that the JRE must fulfill.
diff --git a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx
index 748b7d7..ea2f846 100644
--- a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx
+++ b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx
@@ -97,7 +97,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
 
         OString sPaths = getLD_LIBRARY_PATH(pInfo->arVendorData);
         fprintf(stdout, "%s\n", sPaths.getStr());
-        jfw_freeJavaInfo(pInfo);
+        delete pInfo;
     }
     catch (const std::exception&)
     {
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index 6f9c455..88658a1 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -427,7 +427,7 @@ javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo)
             {
                 bInfoFound = true;
             }
-            jfw_freeJavaInfo(pHomeInfo);
+            delete pHomeInfo;
         }
 
         // if no Java installation providing all features was detected by using JAVA_HOME,
@@ -460,7 +460,7 @@ javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo)
                             aCurrentInfo = pJInfo;
                         }
 
-                        jfw_freeJavaInfo(pJInfo);
+                        delete pJInfo;
                     }
                     ++it;
                 }
@@ -529,7 +529,7 @@ javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo)
                 //The array returned by jfw_plugin_getAllJavaInfos must be freed as well as
                 //its contents
                 for (int j = 0; j < cInfos; j++)
-                    jfw_freeJavaInfo(arInfos[j]);
+                    delete arInfos[j];
                 rtl_freeMemory(arInfos);
 
                 if (bInfoFound)
@@ -642,12 +642,6 @@ bool jfw_areEqualJavaInfo(JavaInfo const * pInfoA,JavaInfo const * pInfoB)
     return false;
 }
 
-
-void jfw_freeJavaInfo(JavaInfo *pInfo)
-{
-    delete pInfo;
-}
-
 javaFrameworkError jfw_getSelectedJRE(JavaInfo **ppInfo)
 {
     javaFrameworkError errcode = JFW_E_NONE;
@@ -805,7 +799,7 @@ javaFrameworkError jfw_setSelectedJRE(JavaInfo const *pInfo)
             jfw::setJavaSelected();
         }
 
-        jfw_freeJavaInfo(currentInfo);
+        delete currentInfo;
     }
     catch (const jfw::FrameworkException& e)
     {
@@ -1051,7 +1045,7 @@ CJavaInfo CJavaInfo::createWrapper(::JavaInfo* info)
 }
 void CJavaInfo::attach(::JavaInfo * info)
 {
-    jfw_freeJavaInfo(pInfo);
+    delete pInfo;
     pInfo = info;
 }
 ::JavaInfo * CJavaInfo::detach()
@@ -1063,7 +1057,7 @@ void CJavaInfo::attach(::JavaInfo * info)
 
 CJavaInfo::~CJavaInfo()
 {
-    jfw_freeJavaInfo(pInfo);
+    delete pInfo;
 }
 
 
@@ -1085,7 +1079,7 @@ CJavaInfo & CJavaInfo::operator = (const CJavaInfo& info)
     if (&info == this)
         return *this;
 
-    jfw_freeJavaInfo(pInfo);
+    delete pInfo;
     pInfo = copyJavaInfo(info.pInfo);
     return *this;
 }
@@ -1094,7 +1088,7 @@ CJavaInfo & CJavaInfo::operator = (const ::JavaInfo* info)
     if (info == pInfo)
         return *this;
 
-    jfw_freeJavaInfo(pInfo);
+    delete pInfo;
     pInfo = copyJavaInfo(info);
     return *this;
 }
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index 78ac585..ab72925 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -662,10 +662,10 @@ namespace {
 struct JavaInfoGuard: private boost::noncopyable {
     JavaInfoGuard(): info(nullptr) {}
 
-    ~JavaInfoGuard() { jfw_freeJavaInfo(info); }
+    ~JavaInfoGuard() { delete info; }
 
     void clear() {
-        jfw_freeJavaInfo(info);
+        delete info;
         info = nullptr;
     }
 
@@ -836,7 +836,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
                 }
             }
 
-            jfw_freeJavaInfo(pJavaInfo);
+            delete pJavaInfo;
 
             //Error: %PRODUCTNAME requires a Java
             //runtime environment (JRE) to perform this task. The selected JRE
commit 8546831b3b36e29c1ee42b790cbecd3fd8d8bbaf
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 10 17:32:48 2016 +0100

    Turn JavaInfo sal_Sequence* member into rtl::ByteSequence
    
    Change-Id: Iecd476970b0b7a46afe223f71e95b0010048d7b1

diff --git a/include/jvmfwk/framework.hxx b/include/jvmfwk/framework.hxx
index 0380e1f..184b2c1 100644
--- a/include/jvmfwk/framework.hxx
+++ b/include/jvmfwk/framework.hxx
@@ -23,6 +23,7 @@
 #define INCLUDED_JVMFWK_FRAMEWORK_HXX
 
 #include <jvmfwk/jvmfwkdllapi.hxx>
+#include <rtl/byteseq.hxx>
 #include <rtl/ustring.h>
 #include <rtl/ustring.hxx>
 #include <osl/mutex.h>
@@ -207,8 +208,7 @@ typedef enum _javaFrameworkError
 
     <p>
     Instances of this struct are created by the plug-in libraries which are used by
-    this framework (jvmfwk/vendorplugin.h). The contained members must be
-    freed individually.
+    this framework (jvmfwk/vendorplugin.h).
     For convenience this API provides the function <code>jfw_freeJavaInfo</code>
     which frees the objects properly. </p>
  */
@@ -254,7 +254,7 @@ struct JavaInfo
         values. The plug-in libraries can put all data, necessary for
         starting the java runtime into this sequence. </p>
      */
-    sal_Sequence * arVendorData;
+    rtl::ByteSequence arVendorData;
 };
 
 /** frees the memory of a <code>JavaInfo</code> object.
@@ -271,7 +271,7 @@ JVMFWK_DLLPUBLIC void jfw_freeJavaInfo(JavaInfo *pInfo);
    in the second <code>JavaInfo</code> object. The equality of the
    <code>OUString</code> members is determined
    by <code>operator ==</code>.
-   Similarly the equality of the <code>sal_Sequence</code> is
+   Similarly the equality of the <code>rtl::ByteSequence</code> is
    also determined by a comparison
    function (see <code>rtl::ByteSequence::operator ==</code>). </p>
    <p>
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 214a501..a3db87f 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -162,10 +162,9 @@ JavaInfo* createJavaInfo(const rtl::Reference<VendorBase> & info)
     }
 
     OUString sVendorData = buf.makeStringAndClear();
-    rtl::ByteSequence byteSeq( reinterpret_cast<sal_Int8*>(sVendorData.pData->buffer),
-                               sVendorData.getLength() * sizeof(sal_Unicode));
-    pInfo->arVendorData = byteSeq.get();
-    rtl_byte_sequence_acquire(pInfo->arVendorData);
+    pInfo->arVendorData = rtl::ByteSequence(
+        reinterpret_cast<sal_Int8*>(sVendorData.pData->buffer),
+        sVendorData.getLength() * sizeof(sal_Unicode));
 
     return pInfo;
 }
diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index 8c6d590..639e935 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -984,8 +984,7 @@ JavaInfo * CNodeJavaInfo::makeJavaInfo() const
     pInfo->sVersion = sVersion;
     pInfo->nFeatures = nFeatures;
     pInfo->nRequirements = nRequirements;
-    pInfo->arVendorData = arVendorData.getHandle();
-    rtl_byte_sequence_acquire(pInfo->arVendorData);
+    pInfo->arVendorData = arVendorData;
     return pInfo;
 }
 
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index a6cac21..6f9c455 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -630,13 +630,12 @@ bool jfw_areEqualJavaInfo(JavaInfo const * pInfoA,JavaInfo const * pInfoB)
         return true;
     if (pInfoA == nullptr || pInfoB == nullptr)
         return false;
-    rtl::ByteSequence sData(pInfoA->arVendorData);
     if (pInfoA->sVendor == pInfoB->sVendor
         && pInfoA->sLocation == pInfoB->sLocation
         && pInfoA->sVersion == pInfoB->sVersion
         && pInfoA->nFeatures == pInfoB->nFeatures
         && pInfoA->nRequirements == pInfoB->nRequirements
-        && sData == pInfoB->arVendorData)
+        && pInfoA->arVendorData == pInfoB->arVendorData)
     {
         return true;
     }
@@ -646,9 +645,6 @@ bool jfw_areEqualJavaInfo(JavaInfo const * pInfoA,JavaInfo const * pInfoB)
 
 void jfw_freeJavaInfo(JavaInfo *pInfo)
 {
-    if (pInfo == nullptr)
-        return;
-    rtl_byte_sequence_release(pInfo->arVendorData);
     delete pInfo;
 }
 
@@ -1073,11 +1069,7 @@ CJavaInfo::~CJavaInfo()
 
 JavaInfo * CJavaInfo::copyJavaInfo(const JavaInfo * pInfo)
 {
-    if (pInfo == nullptr)
-        return nullptr;
-    JavaInfo* newInfo = new JavaInfo(*pInfo);
-    rtl_byte_sequence_acquire(newInfo->arVendorData);
-    return newInfo;
+    return pInfo == nullptr ? nullptr : new JavaInfo(*pInfo);
 }
 
 
commit 5dcdb35ab1e99dbeb283d3694ab7ebba354e9197
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 10 17:11:10 2016 +0100

    Turn JavaInfo rtl_uString* members into OUString
    
    Change-Id: Ieb23b0c36ef56a4793a56cdb450df34e4d9bce1d

diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index d950c47..57e4ded 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -596,7 +596,7 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder )
 
         if ( !bFound )
         {
-            jfw_addJRELocation( pInfo->sLocation );
+            jfw_addJRELocation( pInfo->sLocation.pData );
             AddJRE( pInfo );
             m_aAddedInfos.push_back( pInfo );
             nPos = m_pJavaList->GetEntryCount() - 1;
diff --git a/include/jvmfwk/framework.hxx b/include/jvmfwk/framework.hxx
index 6ee4320..0380e1f 100644
--- a/include/jvmfwk/framework.hxx
+++ b/include/jvmfwk/framework.hxx
@@ -24,6 +24,7 @@
 
 #include <jvmfwk/jvmfwkdllapi.hxx>
 #include <rtl/ustring.h>
+#include <rtl/ustring.hxx>
 #include <osl/mutex.h>
 #include "jni.h"
 
@@ -219,10 +220,10 @@ struct JavaInfo
         Java system property <code>java.vendor</code>.
         </p>
      */
-    rtl_uString *sVendor;
+    OUString sVendor;
     /** contains the file URL to the installation directory.
     */
-    rtl_uString *sLocation;
+    OUString sLocation;
     /** contains the version of this Java distribution.
 
         <p>The version string  must adhere to the rules
@@ -231,7 +232,7 @@ struct JavaInfo
         equal the Java system property <code>java.version</code>.
         </p>
     */
-    rtl_uString *sVersion;
+    OUString sVersion;
     /** indicates supported special features.
 
         <p>For example, <code>JFW_FEATURE_ACCESSBRIDGE</code> indicates that
@@ -268,9 +269,8 @@ JVMFWK_DLLPUBLIC void jfw_freeJavaInfo(JavaInfo *pInfo);
    <p>Two <code>JavaInfo</code> objects are said to be equal if the contained
    members of the first <code>JavaInfo</code> are equal to their counterparts
    in the second <code>JavaInfo</code> object. The equality of the
-   <code>rtl_uString</code> members is determined
-   by the respective comparison function (see
-   <code>OUString::equals</code>).
+   <code>OUString</code> members is determined
+   by <code>operator ==</code>.
    Similarly the equality of the <code>sal_Sequence</code> is
    also determined by a comparison
    function (see <code>rtl::ByteSequence::operator ==</code>). </p>
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index e694203..214a501 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -147,15 +147,9 @@ OString getPluginJarPath(
 JavaInfo* createJavaInfo(const rtl::Reference<VendorBase> & info)
 {
     JavaInfo* pInfo = new JavaInfo;
-    OUString sVendor = info->getVendor();
-    pInfo->sVendor = sVendor.pData;
-    rtl_uString_acquire(sVendor.pData);
-    OUString sHome = info->getHome();
-    pInfo->sLocation = sHome.pData;
-    rtl_uString_acquire(pInfo->sLocation);
-    OUString sVersion = info->getVersion();
-    pInfo->sVersion = sVersion.pData;
-    rtl_uString_acquire(pInfo->sVersion);
+    pInfo->sVendor = info->getVendor();
+    pInfo->sLocation = info->getHome();
+    pInfo->sVersion = info->getVersion();
     pInfo->nFeatures = info->supportsAccessibility() ? 1 : 0;
     pInfo->nRequirements = info->needsRestart() ? JFW_REQUIRE_NEEDRESTART : 0;
     OUStringBuffer buf(1024);
@@ -692,7 +686,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
 #if defined UNX && !defined MACOSX
     //Setting the JAVA_HOME is needed for awt
     OUString sPathLocation;
-    osl_getSystemPathFromFileURL(pInfo->sLocation, & sPathLocation.pData);
+    osl::FileBase::getSystemPathFromFileURL(pInfo->sLocation, sPathLocation);
     osl_setEnvironment(OUString("JAVA_HOME").pData, sPathLocation.pData);
 #endif
 
diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index 60a1fa5..8c6d590 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -979,12 +979,9 @@ JavaInfo * CNodeJavaInfo::makeJavaInfo() const
         return nullptr;
     JavaInfo * pInfo = new JavaInfo;
     memset(pInfo, 0, sizeof(JavaInfo));
-    pInfo->sVendor = sVendor.pData;
-    rtl_uString_acquire(pInfo->sVendor);
-    pInfo->sLocation = sLocation.pData;
-    rtl_uString_acquire(pInfo->sLocation);
-    pInfo->sVersion = sVersion.pData;
-    rtl_uString_acquire(pInfo->sVersion);
+    pInfo->sVendor = sVendor;
+    pInfo->sLocation = sLocation;
+    pInfo->sVersion = sVersion;
     pInfo->nFeatures = nFeatures;
     pInfo->nRequirements = nRequirements;
     pInfo->arVendorData = arVendorData.getHandle();
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index e70e831..a6cac21 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -630,13 +630,10 @@ bool jfw_areEqualJavaInfo(JavaInfo const * pInfoA,JavaInfo const * pInfoB)
         return true;
     if (pInfoA == nullptr || pInfoB == nullptr)
         return false;
-    OUString sVendor(pInfoA->sVendor);
-    OUString sLocation(pInfoA->sLocation);
-    OUString sVersion(pInfoA->sVersion);
     rtl::ByteSequence sData(pInfoA->arVendorData);
-    if (sVendor.equals(pInfoB->sVendor)
-        && sLocation.equals(pInfoB->sLocation)
-        && sVersion.equals(pInfoB->sVersion)
+    if (pInfoA->sVendor == pInfoB->sVendor
+        && pInfoA->sLocation == pInfoB->sLocation
+        && pInfoA->sVersion == pInfoB->sVersion
         && pInfoA->nFeatures == pInfoB->nFeatures
         && pInfoA->nRequirements == pInfoB->nRequirements
         && sData == pInfoB->arVendorData)
@@ -651,9 +648,6 @@ void jfw_freeJavaInfo(JavaInfo *pInfo)
 {
     if (pInfo == nullptr)
         return;
-    rtl_uString_release(pInfo->sVendor);
-    rtl_uString_release(pInfo->sLocation);
-    rtl_uString_release(pInfo->sVersion);
     rtl_byte_sequence_release(pInfo->arVendorData);
     delete pInfo;
 }
@@ -1081,12 +1075,8 @@ JavaInfo * CJavaInfo::copyJavaInfo(const JavaInfo * pInfo)
 {
     if (pInfo == nullptr)
         return nullptr;
-    JavaInfo* newInfo = new JavaInfo;
-    memcpy(newInfo, pInfo, sizeof(JavaInfo));
-    rtl_uString_acquire(pInfo->sVendor);
-    rtl_uString_acquire(pInfo->sLocation);
-    rtl_uString_acquire(pInfo->sVersion);
-    rtl_byte_sequence_acquire(pInfo->arVendorData);
+    JavaInfo* newInfo = new JavaInfo(*pInfo);
+    rtl_byte_sequence_acquire(newInfo->arVendorData);
     return newInfo;
 }
 
commit 81dd7115e8da9a365a2d26e225f6ec4d2d8ccb5f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 10 16:47:16 2016 +0100

    Manage JavaInfo instances via new/delete
    
    Change-Id: I10a113718e525b646c51aa8a19f9f2b75a36714a

diff --git a/include/jvmfwk/framework.hxx b/include/jvmfwk/framework.hxx
index f55676c..6ee4320 100644
--- a/include/jvmfwk/framework.hxx
+++ b/include/jvmfwk/framework.hxx
@@ -206,10 +206,8 @@ typedef enum _javaFrameworkError
 
     <p>
     Instances of this struct are created by the plug-in libraries which are used by
-    this framework (jvmfwk/vendorplugin.h). The memory of the instances is created
-    by <code>rtl_allocateMemory</code> (rtl/alloc.h). Therefore, the memory must
-    be freed by <code>rtl_freeMemory</code>. Also the contained members must be
-    freed particularly.
+    this framework (jvmfwk/vendorplugin.h). The contained members must be
+    freed individually.
     For convenience this API provides the function <code>jfw_freeJavaInfo</code>
     which frees the objects properly. </p>
  */
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 89e1a49..e694203 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -146,9 +146,7 @@ OString getPluginJarPath(
 
 JavaInfo* createJavaInfo(const rtl::Reference<VendorBase> & info)
 {
-    JavaInfo* pInfo = static_cast<JavaInfo*>(rtl_allocateMemory(sizeof(JavaInfo)));
-    if (pInfo == nullptr)
-        return nullptr;
+    JavaInfo* pInfo = new JavaInfo;
     OUString sVendor = info->getVendor();
     pInfo->sVendor = sVendor.pData;
     rtl_uString_acquire(sVendor.pData);
diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index 3e9f478..60a1fa5 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -977,9 +977,7 @@ JavaInfo * CNodeJavaInfo::makeJavaInfo() const
 {
     if (bNil || m_bEmptyNode)
         return nullptr;
-    JavaInfo * pInfo = static_cast<JavaInfo*>(rtl_allocateMemory(sizeof(JavaInfo)));
-    if (pInfo == nullptr)
-        return nullptr;
+    JavaInfo * pInfo = new JavaInfo;
     memset(pInfo, 0, sizeof(JavaInfo));
     pInfo->sVendor = sVendor.pData;
     rtl_uString_acquire(pInfo->sVendor);
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index f28092a..e70e831 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -655,7 +655,7 @@ void jfw_freeJavaInfo(JavaInfo *pInfo)
     rtl_uString_release(pInfo->sLocation);
     rtl_uString_release(pInfo->sVersion);
     rtl_byte_sequence_release(pInfo->arVendorData);
-    rtl_freeMemory(pInfo);
+    delete pInfo;
 }
 
 javaFrameworkError jfw_getSelectedJRE(JavaInfo **ppInfo)
@@ -1081,16 +1081,12 @@ JavaInfo * CJavaInfo::copyJavaInfo(const JavaInfo * pInfo)
 {
     if (pInfo == nullptr)
         return nullptr;
-    JavaInfo* newInfo =
-          static_cast<JavaInfo*>(rtl_allocateMemory(sizeof(JavaInfo)));
-    if (newInfo)
-    {
-        memcpy(newInfo, pInfo, sizeof(JavaInfo));
-        rtl_uString_acquire(pInfo->sVendor);
-        rtl_uString_acquire(pInfo->sLocation);
-        rtl_uString_acquire(pInfo->sVersion);
-        rtl_byte_sequence_acquire(pInfo->arVendorData);
-    }
+    JavaInfo* newInfo = new JavaInfo;
+    memcpy(newInfo, pInfo, sizeof(JavaInfo));
+    rtl_uString_acquire(pInfo->sVendor);
+    rtl_uString_acquire(pInfo->sLocation);
+    rtl_uString_acquire(pInfo->sVersion);
+    rtl_byte_sequence_acquire(pInfo->arVendorData);
     return newInfo;
 }
 
commit 624f9696a9d18480f04cca85c174099dbb8dbee5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 10 15:16:47 2016 +0100

    No need for SAL_CALL here
    
    Change-Id: Iefa38d62235eb54ed5f1ff78b49127bd7bea1f5e

diff --git a/include/jvmfwk/framework.hxx b/include/jvmfwk/framework.hxx
index ce7363c..f55676c 100644
--- a/include/jvmfwk/framework.hxx
+++ b/include/jvmfwk/framework.hxx
@@ -262,7 +262,7 @@ struct JavaInfo
     @param pInfo
     The object which is to be freed. It can be NULL;
  */
-JVMFWK_DLLPUBLIC void SAL_CALL jfw_freeJavaInfo(JavaInfo *pInfo);
+JVMFWK_DLLPUBLIC void jfw_freeJavaInfo(JavaInfo *pInfo);
 
 
 /** compares two <code>JavaInfo</code> objects for equality.
@@ -286,7 +286,7 @@ JVMFWK_DLLPUBLIC void SAL_CALL jfw_freeJavaInfo(JavaInfo *pInfo);
    true - both object represent the same JRE.</br>
    false - the objects represend different JREs
  */
-JVMFWK_DLLPUBLIC bool SAL_CALL jfw_areEqualJavaInfo(
+JVMFWK_DLLPUBLIC bool jfw_areEqualJavaInfo(
     JavaInfo const * pInfoA,JavaInfo const * pInfoB);
 
 /** determines if a Java Virtual Machine is already running.
@@ -309,7 +309,7 @@ JVMFWK_DLLPUBLIC bool SAL_CALL jfw_areEqualJavaInfo(
     JFW_E_NONE function ran successfully.<br/>
     JFW_E_INVALID_ARG the parameter <code>bRunning</code> was NULL.
 */
-JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_isVMRunning(sal_Bool *bRunning);
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_isVMRunning(sal_Bool *bRunning);
 
 /** detects a suitable JRE and configures the framework to use it.
 
@@ -378,7 +378,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_isVMRunning(sal_Bool *bRunning)
     JFW_E_CONFIGURATION mode was not properly set or their prerequisites
     were not met.
  */
-JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo);
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo);
 
 /** provides information about all available JRE installations.
 
@@ -406,7 +406,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pIn
     JFW_E_CONFIGURATION mode was not properly set or their prerequisites
     were not met.
 */
-JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_findAllJREs(
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_findAllJREs(
     JavaInfo ***parInfo, sal_Int32 *pSize);
 
 /** determines if a path points to a Java installation.
@@ -438,7 +438,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_findAllJREs(
    JFW_E_FAILED_VERSION a JRE was detected but if failed the version
    requirements as determined by the javavendors.xml
  */
-JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getJavaInfoByPath(
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_getJavaInfoByPath(
     rtl_uString *pPath, JavaInfo **ppInfo);
 
 
@@ -506,7 +506,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getJavaInfoByPath(
     JFW_E_FAILED_VERSION the "Default Mode" is active. The JRE determined by
     <code>JAVA_HOME</code>does not meet the version requirements.
  */
-JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_startVM(
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_startVM(
     JavaInfo const * pInfo, JavaVMOption * arOptions, sal_Int32 nSize,
     JavaVM ** ppVM, JNIEnv ** ppEnv);
 
@@ -536,7 +536,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_startVM(
     were not met.<br/>
     JFW_E_DIRECT_MODE the function cannot be used in this mode.
  */
-JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setSelectedJRE(JavaInfo const *pInfo);
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_setSelectedJRE(JavaInfo const *pInfo);
 
 
 /** provides information about the JRE that is to be used.
@@ -566,7 +566,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setSelectedJRE(JavaInfo const *
     JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
     JRE has been selected afterwards. <br/>
  */
-JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getSelectedJRE(JavaInfo **ppInfo);
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_getSelectedJRE(JavaInfo **ppInfo);
 
 
 /** determines if Java can be used.
@@ -585,7 +585,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getSelectedJRE(JavaInfo **ppInf
     were not met.<br/>
    JFW_E_DIRECT_MODE the function cannot be used in this mode.
  */
-JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setEnabled(bool bEnabled);
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_setEnabled(bool bEnabled);
 
 /** provides the information if Java can be used.
 
@@ -600,7 +600,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setEnabled(bool bEnabled);
     were not met.<br/>
     JFW_E_DIRECT_MODE the function cannot be used in this mode.
  */
-JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getEnabled(sal_Bool *pbEnabled);
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_getEnabled(sal_Bool *pbEnabled);
 
 /** determines parameters which are passed to VM during its creation.
 
@@ -624,7 +624,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getEnabled(sal_Bool *pbEnabled)
     were not met.<br/>
     JFW_E_DIRECT_MODE the function cannot be used in this mode.
  */
-JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setVMParameters(
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_setVMParameters(
     rtl_uString **  arArgs, sal_Int32 nSize);
 
 /** obtains the currently used start parameters.
@@ -649,7 +649,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setVMParameters(
     were not met.<br/>
     JFW_E_DIRECT_MODE the function cannot be used in this mode.
  */
-JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getVMParameters(
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_getVMParameters(
     rtl_uString *** parParameters,
     sal_Int32 * pSize);
 
@@ -671,7 +671,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getVMParameters(
     were not met.<br/>
    JFW_E_DIRECT_MODE the function cannot be used in this mode.
  */
-JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setUserClassPath(rtl_uString * pCP);
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_setUserClassPath(rtl_uString * pCP);
 /** provides the value of the current user class path.
 
    <p>The function returns an empty string if no user class path is set.
@@ -690,7 +690,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setUserClassPath(rtl_uString *
     were not met.<br/>
    JFW_E_DIRECT_MODE the function cannot be used in this mode.
  */
-JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getUserClassPath(rtl_uString ** ppCP);
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_getUserClassPath(rtl_uString ** ppCP);
 
 /** saves the location of a JRE.
 
@@ -718,7 +718,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getUserClassPath(rtl_uString **
     were not met.<br/>
     JFW_E_DIRECT_MODE the function cannot be used in this mode.
  */
-JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_addJRELocation(rtl_uString * sLocation);
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_addJRELocation(rtl_uString * sLocation);
 
 /** checks if the installation of the jre still exists.
 
@@ -737,7 +737,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_addJRELocation(rtl_uString * sL
     JFW_E_ERROR an error occurred during execution.</br>
     JFW_E_INVALID_ARG pInfo contains invalid data</br>
  */
-JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_existJRE(const JavaInfo *pInfo, sal_Bool *exist);
+JVMFWK_DLLPUBLIC javaFrameworkError jfw_existJRE(const JavaInfo *pInfo, sal_Bool *exist);
 
 
 /** locks this API so that it cannot be used by other threads.
@@ -755,14 +755,14 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_existJRE(const JavaInfo *pInfo,
     The only functions which are not effected by <code>jfw_lock</code> are
     <code>jfw_freeJavaInfo</code> and <code>jfw_areEqualJavaInfo</code>.
  */
-JVMFWK_DLLPUBLIC void SAL_CALL jfw_lock();
+JVMFWK_DLLPUBLIC void jfw_lock();
 
 /** unlocks this API.
 
     <p>This function is called after <code>jfw_lock</code>. It allows other
     threads to use this API concurrently.</p>
 */
-JVMFWK_DLLPUBLIC void SAL_CALL jfw_unlock();
+JVMFWK_DLLPUBLIC void jfw_unlock();
 
 #endif
 
commit bf6c5c9b0f75ff2675db96767b468250248a7e30
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 10 15:13:45 2016 +0100

    No need to repeat SAL_CALL in definitions
    
    Change-Id: Ief75af9d08d9b7e31d821773db2363fa201f3038

diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index 819b6a1a..f28092a 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -47,7 +47,7 @@ bool areEqualJavaInfo(
 
 }
 
-javaFrameworkError SAL_CALL jfw_findAllJREs(JavaInfo ***pparInfo, sal_Int32 *pSize)
+javaFrameworkError jfw_findAllJREs(JavaInfo ***pparInfo, sal_Int32 *pSize)
 {
     javaFrameworkError retVal = JFW_E_NONE;
     try
@@ -197,7 +197,7 @@ javaFrameworkError SAL_CALL jfw_findAllJREs(JavaInfo ***pparInfo, sal_Int32 *pSi
     return retVal;
 }
 
-javaFrameworkError SAL_CALL jfw_startVM(
+javaFrameworkError jfw_startVM(
     JavaInfo const * pInfo, JavaVMOption * arOptions, sal_Int32 cOptions,
     JavaVM ** ppVM, JNIEnv ** ppEnv)
 {
@@ -372,7 +372,7 @@ javaFrameworkError SAL_CALL jfw_startVM(
     PATH environment variables. If no suitable JavaInfo is found there, it
     inspects all JavaInfos found by the jfw_plugin_get* functions.
  */
-javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo)
+javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo)
 {
     javaFrameworkError errcode = JFW_E_NONE;
     try
@@ -624,8 +624,7 @@ javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo)
     return errcode;
 }
 
-bool SAL_CALL jfw_areEqualJavaInfo(
-    JavaInfo const * pInfoA,JavaInfo const * pInfoB)
+bool jfw_areEqualJavaInfo(JavaInfo const * pInfoA,JavaInfo const * pInfoB)
 {
     if (pInfoA == pInfoB)
         return true;
@@ -648,7 +647,7 @@ bool SAL_CALL jfw_areEqualJavaInfo(
 }
 
 
-void SAL_CALL jfw_freeJavaInfo(JavaInfo *pInfo)
+void jfw_freeJavaInfo(JavaInfo *pInfo)
 {
     if (pInfo == nullptr)
         return;
@@ -659,7 +658,7 @@ void SAL_CALL jfw_freeJavaInfo(JavaInfo *pInfo)
     rtl_freeMemory(pInfo);
 }
 
-javaFrameworkError SAL_CALL jfw_getSelectedJRE(JavaInfo **ppInfo)
+javaFrameworkError jfw_getSelectedJRE(JavaInfo **ppInfo)
 {
     javaFrameworkError errcode = JFW_E_NONE;
     try
@@ -713,7 +712,7 @@ javaFrameworkError SAL_CALL jfw_getSelectedJRE(JavaInfo **ppInfo)
     return errcode;
 }
 
-javaFrameworkError SAL_CALL jfw_isVMRunning(sal_Bool *bRunning)
+javaFrameworkError jfw_isVMRunning(sal_Bool *bRunning)
 {
     osl::MutexGuard guard(jfw::FwkMutex::get());
     if (bRunning == nullptr)
@@ -725,8 +724,7 @@ javaFrameworkError SAL_CALL jfw_isVMRunning(sal_Bool *bRunning)
     return JFW_E_NONE;
 }
 
-javaFrameworkError SAL_CALL jfw_getJavaInfoByPath(
-    rtl_uString *pPath, JavaInfo **ppInfo)
+javaFrameworkError jfw_getJavaInfoByPath(rtl_uString *pPath, JavaInfo **ppInfo)
 {
     javaFrameworkError errcode = JFW_E_NONE;
     try
@@ -794,7 +792,7 @@ javaFrameworkError SAL_CALL jfw_getJavaInfoByPath(
 }
 
 
-javaFrameworkError SAL_CALL jfw_setSelectedJRE(JavaInfo const *pInfo)
+javaFrameworkError jfw_setSelectedJRE(JavaInfo const *pInfo)
 {
     javaFrameworkError errcode = JFW_E_NONE;
     try
@@ -827,7 +825,7 @@ javaFrameworkError SAL_CALL jfw_setSelectedJRE(JavaInfo const *pInfo)
     }
     return errcode;
 }
-javaFrameworkError SAL_CALL jfw_setEnabled(bool bEnabled)
+javaFrameworkError jfw_setEnabled(bool bEnabled)
 {
     javaFrameworkError errcode = JFW_E_NONE;
     try
@@ -861,7 +859,7 @@ javaFrameworkError SAL_CALL jfw_setEnabled(bool bEnabled)
     return errcode;
 }
 
-javaFrameworkError SAL_CALL jfw_getEnabled(sal_Bool *pbEnabled)
+javaFrameworkError jfw_getEnabled(sal_Bool *pbEnabled)
 {
     javaFrameworkError errcode = JFW_E_NONE;
     try
@@ -884,7 +882,7 @@ javaFrameworkError SAL_CALL jfw_getEnabled(sal_Bool *pbEnabled)
 }
 
 
-javaFrameworkError SAL_CALL jfw_setVMParameters(
+javaFrameworkError jfw_setVMParameters(
     rtl_uString * * arOptions, sal_Int32 nLen)
 {
     javaFrameworkError errcode = JFW_E_NONE;
@@ -909,7 +907,7 @@ javaFrameworkError SAL_CALL jfw_setVMParameters(
     return errcode;
 }
 
-javaFrameworkError SAL_CALL jfw_getVMParameters(
+javaFrameworkError jfw_getVMParameters(
     rtl_uString *** parOptions, sal_Int32 * pLen)
 {
     javaFrameworkError errcode = JFW_E_NONE;
@@ -933,7 +931,7 @@ javaFrameworkError SAL_CALL jfw_getVMParameters(
     return errcode;
 }
 
-javaFrameworkError SAL_CALL jfw_setUserClassPath(rtl_uString * pCp)
+javaFrameworkError jfw_setUserClassPath(rtl_uString * pCp)
 {
     javaFrameworkError errcode = JFW_E_NONE;
     try
@@ -956,7 +954,7 @@ javaFrameworkError SAL_CALL jfw_setUserClassPath(rtl_uString * pCp)
     return errcode;
 }
 
-javaFrameworkError SAL_CALL jfw_getUserClassPath(rtl_uString ** ppCP)
+javaFrameworkError jfw_getUserClassPath(rtl_uString ** ppCP)
 {
     javaFrameworkError errcode = JFW_E_NONE;
     try
@@ -979,7 +977,7 @@ javaFrameworkError SAL_CALL jfw_getUserClassPath(rtl_uString ** ppCP)
     return errcode;
 }
 
-javaFrameworkError SAL_CALL jfw_addJRELocation(rtl_uString * sLocation)
+javaFrameworkError jfw_addJRELocation(rtl_uString * sLocation)
 {
     javaFrameworkError errcode = JFW_E_NONE;
     try
@@ -1031,12 +1029,12 @@ javaFrameworkError jfw_existJRE(const JavaInfo *pInfo, sal_Bool *exist)
     return ret;
 }
 
-void SAL_CALL jfw_lock()
+void jfw_lock()
 {
     jfw::FwkMutex::get().acquire();
 }
 
-void SAL_CALL jfw_unlock()
+void jfw_unlock()
 {
     jfw::FwkMutex::get().release();
 }
commit 8471ba7b97a2a01039133674d3960c5c16803833
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Mar 10 15:10:39 2016 +0100

    No need for extern "C" here
    
    ...and fix resulting loplugin:salbool fallout
    
    Change-Id: I5ae1497608d31c20b0d10676450a7673dee1c651

diff --git a/include/jvmfwk/framework.hxx b/include/jvmfwk/framework.hxx
index 9ba49ce..ce7363c 100644
--- a/include/jvmfwk/framework.hxx
+++ b/include/jvmfwk/framework.hxx
@@ -27,8 +27,6 @@
 #include <osl/mutex.h>
 #include "jni.h"
 
-extern "C" {
-
 /** @file
     <p>This library can operate in two modes, application mode and direct mode.</p>
 
@@ -285,10 +283,10 @@ JVMFWK_DLLPUBLIC void SAL_CALL jfw_freeJavaInfo(JavaInfo *pInfo);
    @param pInfoB
    the second argument which is compared with the first.
    @return
-   sal_True - both object represent the same JRE.</br>
-   sal_False - the objects represend different JREs
+   true - both object represent the same JRE.</br>
+   false - the objects represend different JREs
  */
-JVMFWK_DLLPUBLIC sal_Bool SAL_CALL jfw_areEqualJavaInfo(
+JVMFWK_DLLPUBLIC bool SAL_CALL jfw_areEqualJavaInfo(
     JavaInfo const * pInfoA,JavaInfo const * pInfoB);
 
 /** determines if a Java Virtual Machine is already running.
@@ -573,7 +571,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getSelectedJRE(JavaInfo **ppInf
 
 /** determines if Java can be used.
 
-   <p>If <code>bEnabled</code> is <code>sal_False</code> then a call
+   <p>If <code>bEnabled</code> is <code>false</code> then a call
    to jfw_startVM will result in an error with the errorcode
    <code>JFW_E_JAVA_DISABLED</code></p>
 
@@ -587,7 +585,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getSelectedJRE(JavaInfo **ppInf
     were not met.<br/>
    JFW_E_DIRECT_MODE the function cannot be used in this mode.
  */
-JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setEnabled(sal_Bool bEnabled);
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setEnabled(bool bEnabled);
 
 /** provides the information if Java can be used.
 
@@ -766,8 +764,6 @@ JVMFWK_DLLPUBLIC void SAL_CALL jfw_lock();
 */
 JVMFWK_DLLPUBLIC void SAL_CALL jfw_unlock();
 
-}
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index 501bf71..819b6a1a 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -624,13 +624,13 @@ javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo)
     return errcode;
 }
 
-sal_Bool SAL_CALL jfw_areEqualJavaInfo(
+bool SAL_CALL jfw_areEqualJavaInfo(
     JavaInfo const * pInfoA,JavaInfo const * pInfoB)
 {
     if (pInfoA == pInfoB)
-        return sal_True;
+        return true;
     if (pInfoA == nullptr || pInfoB == nullptr)
-        return sal_False;
+        return false;
     OUString sVendor(pInfoA->sVendor);
     OUString sLocation(pInfoA->sLocation);
     OUString sVersion(pInfoA->sVersion);
@@ -642,9 +642,9 @@ sal_Bool SAL_CALL jfw_areEqualJavaInfo(
         && pInfoA->nRequirements == pInfoB->nRequirements
         && sData == pInfoB->arVendorData)
     {
-        return sal_True;
+        return true;
     }
-    return sal_False;
+    return false;
 }
 
 
@@ -827,7 +827,7 @@ javaFrameworkError SAL_CALL jfw_setSelectedJRE(JavaInfo const *pInfo)
     }
     return errcode;
 }
-javaFrameworkError SAL_CALL jfw_setEnabled(sal_Bool bEnabled)
+javaFrameworkError SAL_CALL jfw_setEnabled(bool bEnabled)
 {
     javaFrameworkError errcode = JFW_E_NONE;
     try
diff --git a/svtools/source/java/javainteractionhandler.cxx b/svtools/source/java/javainteractionhandler.cxx
index 464f82e..c07fcaf 100644
--- a/svtools/source/java/javainteractionhandler.cxx
+++ b/svtools/source/java/javainteractionhandler.cxx
@@ -163,7 +163,7 @@ void SAL_CALL JavaInteractionHandler::handle( const Reference< XInteractionReque
             nResult = aQueryBox->Execute();
             if ( nResult == RET_YES )
             {
-                jfw_setEnabled(sal_True);
+                jfw_setEnabled(true);
             }
 
             m_nResult_JavaDisabled = nResult;


More information about the Libreoffice-commits mailing list