diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-08-02 16:26:52 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2004-08-02 16:26:52 +0000 |
commit | bc60c6c2fb8dbf15521df6a64caf8d79b911ffee (patch) | |
tree | 8299f3a5ca67c62b1cc914da482714da86be504d /tools | |
parent | 99461b5640bfdac1ffce7b1013d1a681e3888475 (diff) |
INTEGRATION: CWS insight01 (1.26.4); FILE MERGED
2004/07/06 08:55:27 oj 1.26.4.3: RESYNC: (1.27-1.31); FILE MERGED
2004/05/29 01:27:36 oj 1.26.4.2: RESYNC: (1.26-1.27); FILE MERGED
2004/01/21 10:34:30 oj 1.26.4.1: #i24555# return NULL if resource can't be found
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/rc/resmgr.cxx | 76 |
1 files changed, 40 insertions, 36 deletions
diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index f8266cb5fdaf..14b0be9d62cb 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -2,9 +2,9 @@ * * $RCSfile: resmgr.cxx,v $ * - * $Revision: 1.31 $ + * $Revision: 1.32 $ * - * last change: $Author: hjs $ $Date: 2004-06-25 17:13:01 $ + * last change: $Author: hr $ $Date: 2004-08-02 17:26:52 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -612,44 +612,48 @@ void* InternalResMgr::LoadGlobalRes( RESOURCE_TYPE nRT, USHORT nId, // ImpContent * pFind = (ImpContent *) // bsearch( (void *)((ULONG(nRT) << 16) | nId), pContent, nEntries, // sizeof( ImpContent ), Search ); - if( nRT == RSC_STRING && bEqual2Content && ((pFind != pEnd) && (pFind->nTypeAndId == nValue)) ) + if( pFind && (pFind != pEnd) && (pFind->nTypeAndId == nValue) ) { - // String Optimierung - if( !pStringBlock ) + if( nRT == RSC_STRING && bEqual2Content ) { - // Anfang der Strings suchen - ImpContent * pFirst = pFind; - ImpContent * pLast = pFirst; - while( pFirst > pContent && ((pFirst -1)->nTypeAndId >> 16) == RSC_STRING ) - --pFirst; - while( pLast < pEnd && (pLast->nTypeAndId >> 16) == RSC_STRING ) - ++pLast; - nOffCorrection = pFirst->nOffset; - UINT32 nSize; - --pLast; - pStm->Seek( pLast->nOffset ); - RSHEADER_TYPE aHdr; - pStm->Read( &aHdr, sizeof( aHdr ) ); - nSize = pLast->nOffset + aHdr.GetGlobOff() - nOffCorrection; - pStringBlock = (BYTE*)SvMemAlloc( nSize ); - pStm->Seek( pFirst->nOffset ); - pStm->Read( pStringBlock, nSize ); + // String Optimierung + if( !pStringBlock ) + { + // Anfang der Strings suchen + ImpContent * pFirst = pFind; + ImpContent * pLast = pFirst; + while( pFirst > pContent && ((pFirst -1)->nTypeAndId >> 16) == RSC_STRING ) + --pFirst; + while( pLast < pEnd && (pLast->nTypeAndId >> 16) == RSC_STRING ) + ++pLast; + nOffCorrection = pFirst->nOffset; + UINT32 nSize; + --pLast; + pStm->Seek( pLast->nOffset ); + RSHEADER_TYPE aHdr; + pStm->Read( &aHdr, sizeof( aHdr ) ); + nSize = pLast->nOffset + aHdr.GetGlobOff() - nOffCorrection; + pStringBlock = (BYTE*)SvMemAlloc( nSize ); + pStm->Seek( pFirst->nOffset ); + pStm->Read( pStringBlock, nSize ); + } + *pResHandle = pStringBlock; + return (BYTE*)pStringBlock + pFind->nOffset - nOffCorrection; + } // if( nRT == RSC_STRING && bEqual2Content ) + else + { + *pResHandle = 0; + RSHEADER_TYPE aHeader; + pStm->Seek( pFind->nOffset ); + pStm->Read( &aHeader, sizeof( RSHEADER_TYPE ) ); + void * pRes = ::operator new( aHeader.GetGlobOff() ); + memcpy( pRes, &aHeader, sizeof( RSHEADER_TYPE ) ); + pStm->Read( (BYTE*)pRes + sizeof( RSHEADER_TYPE ), + aHeader.GetGlobOff() - sizeof( RSHEADER_TYPE ) ); + return pRes; } - *pResHandle = pStringBlock; - return (BYTE*)pStringBlock + pFind->nOffset - nOffCorrection; - } + } // if( pFind && (pFind != pEnd) && (pFind->nTypeAndId == nValue) ) *pResHandle = 0; - if( pFind ) - { - RSHEADER_TYPE aHeader; - pStm->Seek( pFind->nOffset ); - pStm->Read( &aHeader, sizeof( RSHEADER_TYPE ) ); - void * pRes = ::operator new( aHeader.GetGlobOff() ); - memcpy( pRes, &aHeader, sizeof( RSHEADER_TYPE ) ); - pStm->Read( (BYTE*)pRes + sizeof( RSHEADER_TYPE ), - aHeader.GetGlobOff() - sizeof( RSHEADER_TYPE ) ); - return pRes; - } //Resource holen return NULL; } |