diff options
author | skotti <skotti@wintermute> | 2009-10-27 14:57:42 +0100 |
---|---|---|
committer | skotti <skotti@wintermute> | 2009-10-27 14:57:42 +0100 |
commit | e05bf6d61038d45f281994c6ba2fff290d4e1236 (patch) | |
tree | d721de583112c17e8a93e20f1e57ca9d0d387b99 | |
parent | 40ab64211cc89ec112e5baf8c7ff78ad4680b7a3 (diff) | |
parent | 3a50a41f57f97293d533b3e5e136fedc01447d46 (diff) |
Merge latest DEV300 and CWS sb111
-rwxr-xr-x | cpputools/source/regcomplazy/regcomplazy.cxx | 62 | ||||
-rw-r--r-- | jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 20 | ||||
-rw-r--r-- | sal/inc/osl/file.h | 8 | ||||
-rw-r--r-- | sal/osl/unx/file.cxx | 23 | ||||
-rw-r--r-- | sal/rtl/source/ustring.c | 8 |
5 files changed, 53 insertions, 68 deletions
diff --git a/cpputools/source/regcomplazy/regcomplazy.cxx b/cpputools/source/regcomplazy/regcomplazy.cxx index abcb2c187c08..ccffc107b16e 100755 --- a/cpputools/source/regcomplazy/regcomplazy.cxx +++ b/cpputools/source/regcomplazy/regcomplazy.cxx @@ -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); diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index a823d551af88..61edd8ebcaf4 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -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; } diff --git a/sal/inc/osl/file.h b/sal/inc/osl/file.h index 3e7a85dfe662..27ee5c9f12d8 100644 --- a/sal/inc/osl/file.h +++ b/sal/inc/osl/file.h @@ -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 diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index 8e7d76cda614..dc68767ea430 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -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; } diff --git a/sal/rtl/source/ustring.c b/sal/rtl/source/ustring.c index bfe9a7c5f2bd..b938caf0d4b1 100644 --- a/sal/rtl/source/ustring.c +++ b/sal/rtl/source/ustring.c @@ -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 { |