sb111: merged in to-the-side QA fixes
This commit is contained in:
commit
6e7eaf1bfb
5 changed files with 53 additions and 68 deletions
|
@ -49,16 +49,11 @@ using namespace ::rtl;
|
|||
|
||||
typedef ::std::vector< ::rtl::OString > OSVector;
|
||||
|
||||
typedef ::std::pair< ::rtl::OString, OSVector > DataPair;
|
||||
|
||||
typedef ::std::vector< DataPair > DataVector;
|
||||
|
||||
struct CompDescriptor {
|
||||
OString sImplementationName;
|
||||
OString sComponentName;
|
||||
OString sLoaderName;
|
||||
OSVector vSupportedServices;
|
||||
DataVector vData;
|
||||
};
|
||||
|
||||
typedef ::std::vector< CompDescriptor > CDescrVector;
|
||||
|
@ -147,28 +142,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
|
|||
OString sToken(sTmp);
|
||||
if (sTmp.pData->buffer[sTmp.getLength()-1] == '\x0D')
|
||||
sToken = sTmp.copy(0, sTmp.getLength()-1);
|
||||
|
||||
if (sToken.indexOf("[Data]") >= 0) {
|
||||
do {
|
||||
OString sTmp2 = sDescr.getToken(0, '\x0A', nTokenIndex);
|
||||
OString sToken2(sTmp2);
|
||||
if (sTmp2.pData->buffer[sTmp2.getLength()-1] == '\x0D')
|
||||
sToken2 = sTmp2.copy(0, sTmp2.getLength()-1);
|
||||
|
||||
if ((sToken2.getLength() > 0) && (sToken2.pData->buffer[0] != '[')) {
|
||||
OString dataKey(sToken2.copy(0, sToken2.indexOf('=')));
|
||||
OString sValues(sToken2.copy(sToken2.indexOf('=')+1));
|
||||
sal_Int32 nVIndex = 0;
|
||||
OSVector vValues;
|
||||
do {
|
||||
OString sValue = sValues.getToken(0, ';', nVIndex);
|
||||
vValues.push_back(sValue);
|
||||
} while (nVIndex >= 0 );
|
||||
descr.vData.push_back(DataPair(dataKey, vValues));
|
||||
} else
|
||||
break;
|
||||
} while (nTokenIndex >= 0 );
|
||||
}
|
||||
if ( sToken.indexOf("[ComponentDescriptor]") >= 0) {
|
||||
if (bFirst)
|
||||
bFirst = false;
|
||||
|
@ -247,41 +220,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
|
|||
subKey.setValue(OUString(), RG_VALUETYPE_STRING,
|
||||
(sal_Char*)sCompName.getStr(), sCompName.getLength()+1);
|
||||
|
||||
if ((*comp_iter).vData.size() > 0) {
|
||||
usKeyName = OUSTR("DATA");
|
||||
RegistryKey dataKey, valueKey;
|
||||
key.createKey(usKeyName, dataKey);
|
||||
|
||||
DataVector::const_iterator data_iter = ((*comp_iter).vData).begin();
|
||||
do {
|
||||
OUString sDataKey(OSToOUS((*data_iter).first));
|
||||
dataKey.createKey(sDataKey, valueKey);
|
||||
|
||||
OSVector::const_iterator value_iter = ((*data_iter).second).begin();
|
||||
int vlen = (*data_iter).second.size();
|
||||
sal_Char** pValueList = (sal_Char**)rtl_allocateZeroMemory(
|
||||
vlen * sizeof(sal_Char*));
|
||||
int i = 0;
|
||||
do {
|
||||
pValueList[i] = (sal_Char*)rtl_allocateZeroMemory(
|
||||
(*value_iter).getLength()+1 * sizeof(sal_Char));
|
||||
rtl_copyMemory(pValueList[i], (sal_Char*)(*value_iter).getStr(),
|
||||
(*value_iter).getLength()+1);
|
||||
i++;
|
||||
value_iter++;
|
||||
} while (value_iter != (*data_iter).second.end());
|
||||
|
||||
valueKey.setStringListValue(OUString(), pValueList, vlen);
|
||||
|
||||
// free memory
|
||||
for (i=0; i<vlen; i++)
|
||||
rtl_freeMemory(pValueList[i]);
|
||||
rtl_freeMemory(pValueList);
|
||||
|
||||
data_iter++;
|
||||
} while (data_iter != (*comp_iter).vData.end());
|
||||
}
|
||||
|
||||
usKeyName = OUSTR("UNO/SERVICES");
|
||||
key.createKey(usKeyName, subKey);
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ extern VendorSupportMapEntry gVendorMap[];
|
|||
|
||||
bool getSDKInfoFromRegistry(vector<OUString> & vecHome);
|
||||
bool getJREInfoFromRegistry(vector<OUString>& vecJavaHome);
|
||||
rtl::OUString decodeOutput(const rtl::OString& s);
|
||||
bool decodeOutput(const rtl::OString& s, rtl::OUString* out);
|
||||
|
||||
|
||||
|
||||
|
@ -452,7 +452,9 @@ bool getJavaProps(const OUString & exePath,
|
|||
break;
|
||||
JFW_TRACE2(OString("[Java framework] line:\" ")
|
||||
+ aLine + OString(" \".\n"));
|
||||
OUString sLine = decodeOutput(aLine);
|
||||
OUString sLine;
|
||||
if (!decodeOutput(aLine, &sLine))
|
||||
continue;
|
||||
JFW_TRACE2(OString("[Java framework] line:\" ")
|
||||
+ OString( CHAR_POINTER(sLine)) + OString(" \".\n"));
|
||||
sLine = sLine.trim();
|
||||
|
@ -486,8 +488,9 @@ bool getJavaProps(const OUString & exePath,
|
|||
readable strings. The strings are encoded as integer values separated
|
||||
by spaces.
|
||||
*/
|
||||
rtl::OUString decodeOutput(const rtl::OString& s)
|
||||
bool decodeOutput(const rtl::OString& s, rtl::OUString* out)
|
||||
{
|
||||
OSL_ASSERT(out != 0);
|
||||
OUStringBuffer buff(512);
|
||||
sal_Int32 nIndex = 0;
|
||||
do
|
||||
|
@ -495,14 +498,19 @@ rtl::OUString decodeOutput(const rtl::OString& s)
|
|||
OString aToken = s.getToken( 0, ' ', nIndex );
|
||||
if (aToken.getLength())
|
||||
{
|
||||
for (sal_Int32 i = 0; i < aToken.getLength(); ++i)
|
||||
{
|
||||
if (aToken[i] < '0' || aToken[i] > '9')
|
||||
return false;
|
||||
}
|
||||
sal_Unicode value = (sal_Unicode)(aToken.toInt32());
|
||||
buff.append(value);
|
||||
}
|
||||
} while (nIndex >= 0);
|
||||
|
||||
OUString sDecoded(buff.makeStringAndClear());
|
||||
JFW_TRACE2(sDecoded);
|
||||
return sDecoded;
|
||||
*out = buff.makeStringAndClear();
|
||||
JFW_TRACE2(*out);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -814,6 +814,14 @@ oslFileError SAL_CALL osl_getFileSize( oslFileHandle Handle, sal_uInt64 *pSize )
|
|||
*/
|
||||
#define osl_File_MapFlag_RandomAccess ((sal_uInt32)(0x1))
|
||||
|
||||
/** Map flag denoting that the mapped address space will be accessed by the
|
||||
process soon (and it is advantageous for the operating system to already
|
||||
start paging in the data).
|
||||
|
||||
@since UDK 3.2.12
|
||||
*/
|
||||
#define osl_File_MapFlag_WillNeed ((sal_uInt32)(0x2))
|
||||
|
||||
/** Map a shared file into memory.
|
||||
|
||||
@since UDK 3.2.10
|
||||
|
|
|
@ -1080,6 +1080,29 @@ SAL_CALL osl_mapFile (
|
|||
}
|
||||
}
|
||||
}
|
||||
if (uFlags & osl_File_MapFlag_WillNeed)
|
||||
{
|
||||
// On Linux, madvise(..., MADV_WILLNEED) appears to have the undesirable
|
||||
// effect of not returning until the data has actually been paged in, so
|
||||
// that its net effect would typically be to slow down the process
|
||||
// (which could start processing at the beginning of the data while the
|
||||
// OS simultaneously pages in the rest); on other platforms, it remains
|
||||
// to be evaluated whether madvise or equivalent is available and
|
||||
// actually useful:
|
||||
#if defined MACOSX
|
||||
int e = posix_madvise(p, nLength, POSIX_MADV_WILLNEED);
|
||||
if (e != 0)
|
||||
{
|
||||
OSL_TRACE(
|
||||
"posix_madvise(..., POSIX_MADV_WILLNEED) failed with %d", e);
|
||||
}
|
||||
#elif defined SOLARIS
|
||||
if (madvise(static_cast< caddr_t >(p), nLength, MADV_WILLNEED) != 0)
|
||||
{
|
||||
OSL_TRACE("madvise(..., MADV_WILLNEED) failed with %d", errno);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return osl_File_E_None;
|
||||
}
|
||||
|
||||
|
|
|
@ -558,7 +558,12 @@ static void rtl_string2UString_status( rtl_uString** ppThis,
|
|||
"rtl_string2UString_status() - Wrong TextEncoding" );
|
||||
|
||||
if ( !nLen )
|
||||
{
|
||||
rtl_uString_new( ppThis );
|
||||
if (pInfo != NULL) {
|
||||
*pInfo = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( *ppThis )
|
||||
|
@ -589,6 +594,9 @@ static void rtl_string2UString_status( rtl_uString** ppThis,
|
|||
nLen--;
|
||||
}
|
||||
while ( nLen );
|
||||
if (pInfo != NULL) {
|
||||
*pInfo = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue