Turn JavaInfo sal_Sequence* member into rtl::ByteSequence

Change-Id: Iecd476970b0b7a46afe223f71e95b0010048d7b1
This commit is contained in:
Stephan Bergmann
2016-03-10 17:32:48 +01:00
parent 5dcdb35ab1
commit 8546831b3b
4 changed files with 10 additions and 20 deletions

View File

@@ -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>

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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);
}