Kaydet (Commit) 8e9a7cac authored tarafından Stephan Bergmann's avatar Stephan Bergmann

No more need for jfw_freeJavaInfo

Change-Id: I2426a76936b4099a243ce8c102da867e7868aac3
üst 8546831b
...@@ -214,7 +214,7 @@ void SvxJavaOptionsPage::dispose() ...@@ -214,7 +214,7 @@ void SvxJavaOptionsPage::dispose()
for ( pIter = m_aAddedInfos.begin(); pIter != m_aAddedInfos.end(); ++pIter ) for ( pIter = m_aAddedInfos.begin(); pIter != m_aAddedInfos.end(); ++pIter )
{ {
JavaInfo* pInfo = *pIter; JavaInfo* pInfo = *pIter;
jfw_freeJavaInfo( pInfo ); delete pInfo;
} }
m_aAddedInfos.clear(); m_aAddedInfos.clear();
...@@ -442,7 +442,7 @@ void SvxJavaOptionsPage::ClearJavaInfo() ...@@ -442,7 +442,7 @@ void SvxJavaOptionsPage::ClearJavaInfo()
for ( sal_Int32 i = 0; i < m_nInfoSize; ++i ) for ( sal_Int32 i = 0; i < m_nInfoSize; ++i )
{ {
JavaInfo* pInfo = *parInfo++; JavaInfo* pInfo = *parInfo++;
jfw_freeJavaInfo( pInfo ); delete pInfo;
} }
rtl_freeMemory( m_parJavaInfo ); rtl_freeMemory( m_parJavaInfo );
...@@ -508,7 +508,7 @@ void SvxJavaOptionsPage::LoadJREs() ...@@ -508,7 +508,7 @@ void SvxJavaOptionsPage::LoadJREs()
} }
} }
jfw_freeJavaInfo( pSelectedJava ); delete pSelectedJava;
#else #else
(void) this; (void) this;
#endif #endif
...@@ -602,7 +602,7 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder ) ...@@ -602,7 +602,7 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder )
nPos = m_pJavaList->GetEntryCount() - 1; nPos = m_pJavaList->GetEntryCount() - 1;
} }
else else
jfw_freeJavaInfo( pInfo ); delete pInfo;
SvTreeListEntry* pEntry = m_pJavaList->GetEntry( nPos ); SvTreeListEntry* pEntry = m_pJavaList->GetEntry( nPos );
m_pJavaList->Select( pEntry ); m_pJavaList->Select( pEntry );
...@@ -722,7 +722,7 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ ) ...@@ -722,7 +722,7 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
bModified = true; bModified = true;
} }
} }
jfw_freeJavaInfo( pSelectedJava ); delete pSelectedJava;
break; break;
} }
} }
......
...@@ -73,7 +73,7 @@ CJavaInfo::CJavaInfo(): pData(nullptr) ...@@ -73,7 +73,7 @@ CJavaInfo::CJavaInfo(): pData(nullptr)
CJavaInfo::~CJavaInfo() CJavaInfo::~CJavaInfo()
{ {
jfw_freeJavaInfo(pData); delete pData;
} }
......
...@@ -208,9 +208,7 @@ typedef enum _javaFrameworkError ...@@ -208,9 +208,7 @@ typedef enum _javaFrameworkError
<p> <p>
Instances of this struct are created by the plug-in libraries which are used by Instances of this struct are created by the plug-in libraries which are used by
this framework (jvmfwk/vendorplugin.h). this framework (jvmfwk/vendorplugin.h).</p>
For convenience this API provides the function <code>jfw_freeJavaInfo</code>
which frees the objects properly. </p>
*/ */
struct JavaInfo struct JavaInfo
{ {
...@@ -257,13 +255,6 @@ struct JavaInfo ...@@ -257,13 +255,6 @@ struct JavaInfo
rtl::ByteSequence arVendorData; 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. /** compares two <code>JavaInfo</code> objects for equality.
<p>Two <code>JavaInfo</code> objects are said to be equal if the contained <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); ...@@ -362,7 +353,7 @@ JVMFWK_DLLPUBLIC javaFrameworkError jfw_isVMRunning(sal_Bool *bRunning);
@param ppInfo @param ppInfo
[out] a <code>JavaInfo</code> pointer, representing the selected JRE. [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 <code>JavaInfo</code> is for informational purposes only. It is not
necessary to call <code>jfw_setSelectedJRE</code> afterwards.<br/> 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 <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); ...@@ -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> [out] on returns it contains a pointer to an array of <code>JavaInfo</code>
pointers. pointers.
The caller must free the array with <code>rtl_freeMemory</code> and each 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 @param pSize
[out] on return contains the size of array returned in <code>parInfo</code>. [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 ...@@ -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 should be called. That is, <code>jfw_startVM</code> which uses the
settings cannot be called before all settings have be made.</p> settings cannot be called before all settings have be made.</p>
<p> <p>
The only functions which are not effected by <code>jfw_lock</code> are The only functions which is not effected by <code>jfw_lock</code> is
<code>jfw_freeJavaInfo</code> and <code>jfw_areEqualJavaInfo</code>. <code>jfw_areEqualJavaInfo</code>.
*/ */
JVMFWK_DLLPUBLIC void jfw_lock(); JVMFWK_DLLPUBLIC void jfw_lock();
......
...@@ -73,8 +73,8 @@ typedef enum ...@@ -73,8 +73,8 @@ typedef enum
version should be the first in the array. </p> version should be the first in the array. </p>
<p> <p>
The function allocates memory for an array and all the JavaInfo objects returned 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 in <code>parJavaInfo</code>. The caller must delete each JavaInfo object.
<code>jfw_freeJavaInfo</code> (#include "jvmfwk/framework.hxx"). The array is to be The array is to be
freed by rtl_freeMemory. freed by rtl_freeMemory.
In case an error occurred <code>parJavaInfo</code> need not be freed. In case an error occurred <code>parJavaInfo</code> need not be freed.
</p> </p>
...@@ -217,8 +217,7 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome( ...@@ -217,8 +217,7 @@ javaPluginError jfw_plugin_getJavaInfoFromJavaHome(
is also the first element in the vector.</p> is also the first element in the vector.</p>
<p> <p>
The function allocates memory for all the JavaInfo objects returned The function allocates memory for all the JavaInfo objects returned
in <code>vecJavaInfosFromPath</code>. The caller must free each JavaInfo object by calling in <code>vecJavaInfosFromPath</code>. The caller must delete each JavaInfo object.
<code>jfw_freeJavaInfo</code> (#include "jvmfwk/framework.hxx").
</p> </p>
@param vecVendorInfos @param vecVendorInfos
[in] vector specifying the vendor and version requirements that the JRE must fulfill. [in] vector specifying the vendor and version requirements that the JRE must fulfill.
......
...@@ -97,7 +97,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) ...@@ -97,7 +97,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
OString sPaths = getLD_LIBRARY_PATH(pInfo->arVendorData); OString sPaths = getLD_LIBRARY_PATH(pInfo->arVendorData);
fprintf(stdout, "%s\n", sPaths.getStr()); fprintf(stdout, "%s\n", sPaths.getStr());
jfw_freeJavaInfo(pInfo); delete pInfo;
} }
catch (const std::exception&) catch (const std::exception&)
{ {
......
...@@ -427,7 +427,7 @@ javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo) ...@@ -427,7 +427,7 @@ javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo)
{ {
bInfoFound = true; bInfoFound = true;
} }
jfw_freeJavaInfo(pHomeInfo); delete pHomeInfo;
} }
// if no Java installation providing all features was detected by using JAVA_HOME, // if no Java installation providing all features was detected by using JAVA_HOME,
...@@ -460,7 +460,7 @@ javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo) ...@@ -460,7 +460,7 @@ javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo)
aCurrentInfo = pJInfo; aCurrentInfo = pJInfo;
} }
jfw_freeJavaInfo(pJInfo); delete pJInfo;
} }
++it; ++it;
} }
...@@ -529,7 +529,7 @@ javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo) ...@@ -529,7 +529,7 @@ javaFrameworkError jfw_findAndSelectJRE(JavaInfo **pInfo)
//The array returned by jfw_plugin_getAllJavaInfos must be freed as well as //The array returned by jfw_plugin_getAllJavaInfos must be freed as well as
//its contents //its contents
for (int j = 0; j < cInfos; j++) for (int j = 0; j < cInfos; j++)
jfw_freeJavaInfo(arInfos[j]); delete arInfos[j];
rtl_freeMemory(arInfos); rtl_freeMemory(arInfos);
if (bInfoFound) if (bInfoFound)
...@@ -642,12 +642,6 @@ bool jfw_areEqualJavaInfo(JavaInfo const * pInfoA,JavaInfo const * pInfoB) ...@@ -642,12 +642,6 @@ bool jfw_areEqualJavaInfo(JavaInfo const * pInfoA,JavaInfo const * pInfoB)
return false; return false;
} }
void jfw_freeJavaInfo(JavaInfo *pInfo)
{
delete pInfo;
}
javaFrameworkError jfw_getSelectedJRE(JavaInfo **ppInfo) javaFrameworkError jfw_getSelectedJRE(JavaInfo **ppInfo)
{ {
javaFrameworkError errcode = JFW_E_NONE; javaFrameworkError errcode = JFW_E_NONE;
...@@ -805,7 +799,7 @@ javaFrameworkError jfw_setSelectedJRE(JavaInfo const *pInfo) ...@@ -805,7 +799,7 @@ javaFrameworkError jfw_setSelectedJRE(JavaInfo const *pInfo)
jfw::setJavaSelected(); jfw::setJavaSelected();
} }
jfw_freeJavaInfo(currentInfo); delete currentInfo;
} }
catch (const jfw::FrameworkException& e) catch (const jfw::FrameworkException& e)
{ {
...@@ -1051,7 +1045,7 @@ CJavaInfo CJavaInfo::createWrapper(::JavaInfo* info) ...@@ -1051,7 +1045,7 @@ CJavaInfo CJavaInfo::createWrapper(::JavaInfo* info)
} }
void CJavaInfo::attach(::JavaInfo * info) void CJavaInfo::attach(::JavaInfo * info)
{ {
jfw_freeJavaInfo(pInfo); delete pInfo;
pInfo = info; pInfo = info;
} }
::JavaInfo * CJavaInfo::detach() ::JavaInfo * CJavaInfo::detach()
...@@ -1063,7 +1057,7 @@ void CJavaInfo::attach(::JavaInfo * info) ...@@ -1063,7 +1057,7 @@ void CJavaInfo::attach(::JavaInfo * info)
CJavaInfo::~CJavaInfo() CJavaInfo::~CJavaInfo()
{ {
jfw_freeJavaInfo(pInfo); delete pInfo;
} }
...@@ -1085,7 +1079,7 @@ CJavaInfo & CJavaInfo::operator = (const CJavaInfo& info) ...@@ -1085,7 +1079,7 @@ CJavaInfo & CJavaInfo::operator = (const CJavaInfo& info)
if (&info == this) if (&info == this)
return *this; return *this;
jfw_freeJavaInfo(pInfo); delete pInfo;
pInfo = copyJavaInfo(info.pInfo); pInfo = copyJavaInfo(info.pInfo);
return *this; return *this;
} }
...@@ -1094,7 +1088,7 @@ CJavaInfo & CJavaInfo::operator = (const ::JavaInfo* info) ...@@ -1094,7 +1088,7 @@ CJavaInfo & CJavaInfo::operator = (const ::JavaInfo* info)
if (info == pInfo) if (info == pInfo)
return *this; return *this;
jfw_freeJavaInfo(pInfo); delete pInfo;
pInfo = copyJavaInfo(info); pInfo = copyJavaInfo(info);
return *this; return *this;
} }
......
...@@ -662,10 +662,10 @@ namespace { ...@@ -662,10 +662,10 @@ namespace {
struct JavaInfoGuard: private boost::noncopyable { struct JavaInfoGuard: private boost::noncopyable {
JavaInfoGuard(): info(nullptr) {} JavaInfoGuard(): info(nullptr) {}
~JavaInfoGuard() { jfw_freeJavaInfo(info); } ~JavaInfoGuard() { delete info; }
void clear() { void clear() {
jfw_freeJavaInfo(info); delete info;
info = nullptr; info = nullptr;
} }
...@@ -836,7 +836,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId) ...@@ -836,7 +836,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
} }
} }
jfw_freeJavaInfo(pJavaInfo); delete pJavaInfo;
//Error: %PRODUCTNAME requires a Java //Error: %PRODUCTNAME requires a Java
//runtime environment (JRE) to perform this task. The selected JRE //runtime environment (JRE) to perform this task. The selected JRE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment