Kaydet (Commit) f5419886 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Fix dubious std::lower_bound usage that breaks in a _DEBUG MSVC build

üst 096d36c9
......@@ -518,18 +518,6 @@ struct ImpContentLessCompare : public ::std::binary_function< ImpContent, ImpCon
}
};
struct ImpContentMixLessCompare : public ::std::binary_function< ImpContent, sal_uInt64, bool>
{
inline bool operator() (const ImpContent& lhs, const sal_uInt64& rhs) const
{
return lhs.nTypeAndId < rhs;
}
inline bool operator() (const sal_uInt64& lhs, const ImpContent& rhs) const
{
return lhs < rhs.nTypeAndId;
}
};
static ResHookProc pImplResHookProc = 0;
InternalResMgr::InternalResMgr( const OUString& rFileURL,
......@@ -667,12 +655,13 @@ sal_Bool InternalResMgr::Create()
sal_Bool InternalResMgr::IsGlobalAvailable( RESOURCE_TYPE nRT, sal_uInt32 nId ) const
{
// Anfang der Strings suchen
sal_uInt64 nValue = ((sal_uInt64(nRT) << 32) | nId);
ImpContent aValue;
aValue.nTypeAndId = ((sal_uInt64(nRT) << 32) | nId);
ImpContent * pFind = ::std::lower_bound(pContent,
pContent + nEntries,
nValue,
ImpContentMixLessCompare());
return (pFind != (pContent + nEntries)) && (pFind->nTypeAndId == nValue);
aValue,
ImpContentLessCompare());
return (pFind != (pContent + nEntries)) && (pFind->nTypeAndId == aValue.nTypeAndId);
}
// -----------------------------------------------------------------------
......@@ -685,13 +674,14 @@ void* InternalResMgr::LoadGlobalRes( RESOURCE_TYPE nRT, sal_uInt32 nId,
pResUseDump->erase( (sal_uInt64(nRT) << 32) | nId );
#endif
// Anfang der Strings suchen
sal_uInt64 nValue = ((sal_uInt64(nRT) << 32) | nId);
ImpContent aValue;
aValue.nTypeAndId = ((sal_uInt64(nRT) << 32) | nId);
ImpContent* pEnd = (pContent + nEntries);
ImpContent* pFind = ::std::lower_bound( pContent,
pEnd,
nValue,
ImpContentMixLessCompare());
if( pFind && (pFind != pEnd) && (pFind->nTypeAndId == nValue) )
aValue,
ImpContentLessCompare());
if( pFind && (pFind != pEnd) && (pFind->nTypeAndId == aValue.nTypeAndId) )
{
if( nRT == RSC_STRING && bEqual2Content )
{
......
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