diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2016-03-01 23:21:02 +0100 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2016-03-01 23:51:05 +0100 |
commit | f00967cf38ed0c2c197284391fc521825bb3c2ac (patch) | |
tree | d1505cfff1707c51a74ece3091dcc25afbc5d778 /rsc | |
parent | 4845155e0126571e4176819c5f27b76160146ce0 (diff) |
sal_uIntPtr/sal_uLong to Index (aka sal_uInt32) in UniqueIndex
Change-Id: I212cb3bb9d920741629fc4564bbd28b393e8fe00
Diffstat (limited to 'rsc')
-rw-r--r-- | rsc/inc/rscdb.hxx | 6 | ||||
-rw-r--r-- | rsc/inc/rscdef.hxx | 27 | ||||
-rw-r--r-- | rsc/source/parser/rscdb.cxx | 24 | ||||
-rw-r--r-- | rsc/source/parser/rsclex.cxx | 2 | ||||
-rw-r--r-- | rsc/source/parser/rscyacc.y | 1 | ||||
-rw-r--r-- | rsc/source/rsc/rsc.cxx | 26 | ||||
-rw-r--r-- | rsc/source/tools/rscdef.cxx | 49 |
7 files changed, 68 insertions, 67 deletions
diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx index c7c49583aef4..9aadf3d8766b 100644 --- a/rsc/inc/rscdb.hxx +++ b/rsc/inc/rscdb.hxx @@ -223,7 +223,7 @@ class RscTypCont void InsWinBit( RscTop * pClass, const OString& rName, Atom nVal ); - void WriteInc( FILE * fOutput, sal_uLong lKey ); + void WriteInc( FILE * fOutput, RscFileTab::Index lKey ); public: RscBool aBool; @@ -274,13 +274,13 @@ public: } RscTop * SearchType( Atom nTypId ); // deletes all resource objects of this file - void Delete( sal_uLong lFileKey ); + void Delete( RscFileTab::Index lFileKey ); RscTop * GetRoot() { return pRoot; } sal_uInt32 PutSysName( sal_uInt32 nRscTyp, char * pName, sal_uInt32 nConst, sal_uInt32 nId, bool bFirst ); void ClearSysNames(); ERRTYPE WriteRc( WriteRcContext& rContext ); - void WriteSrc( FILE * fOutput, sal_uLong nFileIndex, + void WriteSrc( FILE * fOutput, RscFileTab::Index nFileIndex, bool bName = true ); void PutTranslatorKey( sal_uInt64 nKey ); void IncFilePos( sal_uLong nOffset ){ nFilePos += nOffset; } diff --git a/rsc/inc/rscdef.hxx b/rsc/inc/rscdef.hxx index 41e22f659a4d..d2194f040e21 100644 --- a/rsc/inc/rscdef.hxx +++ b/rsc/inc/rscdef.hxx @@ -221,8 +221,6 @@ public: bool IsIncFile(){ return bIncFile; }; }; -#define NOFILE_INDEX UNIQUEINDEX_ENTRY_NOTFOUND - class RscDefTree { RscDefine * pDefRoot; @@ -238,8 +236,13 @@ public: class RscFileTab : public UniqueIndex<RscFile> { +public: + using UniqueIndex<RscFile>::Index; + using UniqueIndex<RscFile>::IndexNotFound; + +private: RscDefTree aDefTree; - sal_uLong Find(const OString& rName); + Index Find(const OString& rName); public: RscFileTab(); ~RscFileTab(); @@ -250,22 +253,22 @@ public: return FindDef(rStr.getStr()); } - bool Depend( sal_uLong lDepend, sal_uLong lFree ); - bool TestDef( sal_uLong lFileKey, size_t lPos, + bool Depend( Index lDepend, Index lFree ); + bool TestDef( Index lFileKey, size_t lPos, const RscDefine * pDefDec ); - bool TestDef( sal_uLong lFileKey, size_t lPos, + bool TestDef( Index lFileKey, size_t lPos, const RscExpression * pExpDec ); - RscDefine * NewDef( sal_uLong lKey, const OString& rDefName, + RscDefine * NewDef( Index lKey, const OString& rDefName, sal_Int32 lId, sal_uLong lPos ); - RscDefine * NewDef( sal_uLong lKey, const OString& rDefName, + RscDefine * NewDef( Index lKey, const OString& rDefName, RscExpression *, sal_uLong lPos ); // deletes all defines defined in this file - void DeleteFileContext( sal_uLong lKey ); - sal_uLong NewCodeFile(const OString& rName); - sal_uLong NewIncFile(const OString& rName, const OString& rPath); - RscFile * GetFile( sal_uLong lFileKey ){ return Get( lFileKey ); } + void DeleteFileContext( Index lKey ); + Index NewCodeFile(const OString& rName); + Index NewIncFile(const OString& rName, const OString& rPath); + RscFile * GetFile( Index lFileKey ){ return Get( lFileKey ); } }; #endif // INCLUDED_RSC_INC_RSCDEF_HXX diff --git a/rsc/source/parser/rscdb.cxx b/rsc/source/parser/rscdb.cxx index c3c34e76c150..2c253e8736c4 100644 --- a/rsc/source/parser/rscdb.cxx +++ b/rsc/source/parser/rscdb.cxx @@ -297,13 +297,13 @@ sal_uInt32 RscTypCont::PutSysName( sal_uInt32 nRscTyp, char * pFileName, return pSysEntry->nKey; } -void RscTypCont::WriteInc( FILE * fOutput, sal_uLong lFileKey ) +void RscTypCont::WriteInc( FILE * fOutput, RscFileTab::Index lFileKey ) { - if( NOFILE_INDEX == lFileKey ) + if( lFileKey == RscFileTab::IndexNotFound ) { - sal_uIntPtr aIndex = aFileTab.FirstIndex(); - while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) + RscFileTab::Index aIndex = aFileTab.FirstIndex(); + while( aIndex != RscFileTab::IndexNotFound ) { RscFile * pFName = aFileTab.Get( aIndex ); if( pFName->IsIncFile() ) @@ -503,7 +503,7 @@ ERRTYPE RscTypCont::WriteRc( WriteRcContext& rContext ) return aError; } -void RscTypCont::WriteSrc( FILE * fOutput, sal_uLong nFileKey, +void RscTypCont::WriteSrc( FILE * fOutput, RscFileTab::Index nFileKey, bool bName ) { RscEnumerateRef aEnumRef( this, pRoot, fOutput ); @@ -517,10 +517,10 @@ void RscTypCont::WriteSrc( FILE * fOutput, sal_uLong nFileKey, RscFile* pFName; WriteInc( fOutput, nFileKey ); - if( NOFILE_INDEX == nFileKey ) + if( nFileKey == RscFileTab::IndexNotFound ) { - sal_uIntPtr aIndex = aFileTab.FirstIndex(); - while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) + RscFileTab::Index aIndex = aFileTab.FirstIndex(); + while( aIndex != RscFileTab::IndexNotFound ) { pFName = aFileTab.Get( aIndex ); if( !pFName->IsIncFile() ) @@ -542,10 +542,10 @@ void RscTypCont::WriteSrc( FILE * fOutput, sal_uLong nFileKey, else { RscId::SetNames( false ); - if( NOFILE_INDEX == nFileKey ) + if( nFileKey == RscFileTab::IndexNotFound ) { - sal_uIntPtr aIndex = aFileTab.FirstIndex(); - while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) + RscFileTab::Index aIndex = aFileTab.FirstIndex(); + while( aIndex != RscFileTab::IndexNotFound ) { aEnumRef.WriteSrc( aIndex ); aIndex = aFileTab.NextIndex( aIndex ); @@ -579,7 +579,7 @@ IMPL_LINK_TYPED( RscDel, Delete, const NameNode&, r, void ) pNode->pObjBiTree = pNode->GetObjNode()->DelObjNode( pNode, lFileKey ); } -void RscTypCont::Delete( sal_uLong lFileKey ) +void RscTypCont::Delete( RscFileTab::Index lFileKey ) { // delete resource instance RscDel aDel( pRoot, lFileKey ); diff --git a/rsc/source/parser/rsclex.cxx b/rsc/source/parser/rsclex.cxx index 47c31877ef6e..f5f7c0cb7871 100644 --- a/rsc/source/parser/rsclex.cxx +++ b/rsc/source/parser/rsclex.cxx @@ -369,7 +369,7 @@ void IncludeParser( RscFileInst * pFileInst ) int nToken; // token value YYSTYPE aYYSType; // token data RscFile * pFName; // file structure - sal_uLong lKey; // file key + RscFileTab::Index lKey; // file key RscTypCont * pTypCon = pFileInst->pTypCont; pFName = pTypCon->aFileTab.Get( pFileInst->GetFileIndex() ); diff --git a/rsc/source/parser/rscyacc.y b/rsc/source/parser/rscyacc.y index c084d9b2e988..c0a9114ed3a1 100644 --- a/rsc/source/parser/rscyacc.y +++ b/rsc/source/parser/rscyacc.y @@ -20,6 +20,7 @@ #include "sal/config.h" +#include <limits.h> #include <stdio.h> #include <ctype.h> #include <string.h> diff --git a/rsc/source/rsc/rsc.cxx b/rsc/source/rsc/rsc.cxx index 77ec2b85aa7d..6d663a220344 100644 --- a/rsc/source/rsc/rsc.cxx +++ b/rsc/source/rsc/rsc.cxx @@ -333,8 +333,8 @@ ERRTYPE RscCompiler::Start() pTC->pEH->SetListFile( nullptr ); - sal_uIntPtr aIndex = pTC->aFileTab.FirstIndex(); - while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND && aError.IsOk() ) + RscFileTab::Index aIndex = pTC->aFileTab.FirstIndex(); + while( aIndex != RscFileTab::IndexNotFound && aError.IsOk() ) { pFName = pTC->aFileTab.Get( aIndex ); if( !pFName->bScanned && !pFName->IsIncFile() ) @@ -353,8 +353,8 @@ ERRTYPE RscCompiler::Start() if ( pTC->pEH->GetVerbosity() >= RscVerbosityVerbose ) { pTC->pEH->StdOut( "Files: " ); - sal_uIntPtr aIndex = pTC->aFileTab.FirstIndex(); - while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) + RscFileTab::Index aIndex = pTC->aFileTab.FirstIndex(); + while( aIndex != RscFileTab::IndexNotFound ) { pFName = pTC->aFileTab.Get( aIndex ); pTC->pEH->StdOut( pFName->aFileName.getStr() ); @@ -395,13 +395,13 @@ void RscCompiler::EndCompile() else { // write file - sal_uIntPtr aIndex = pTC->aFileTab.FirstIndex(); - while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) + RscFileTab::Index aIndex = pTC->aFileTab.FirstIndex(); + while( aIndex != RscFileTab::IndexNotFound ) { RscFile* pFN = pTC->aFileTab.Get( aIndex ); if( !pFN->IsIncFile() ) { - pTC->WriteSrc( foutput, NOFILE_INDEX, false ); + pTC->WriteSrc( foutput, RscFileTab::IndexNotFound, false ); break; // ?T 281091MM only one source file } } @@ -572,8 +572,8 @@ ERRTYPE RscCompiler::Link() for( it = pCL->m_aOutputFiles.begin(); it != pCL->m_aOutputFiles.end(); ++it ) { // cleanup nodes - for( sal_uIntPtr aIndex = pTC->aFileTab.FirstIndex(); - aIndex != UNIQUEINDEX_ENTRY_NOTFOUND && aError.IsOk(); + for( RscFileTab::Index aIndex = pTC->aFileTab.FirstIndex(); + aIndex != RscFileTab::IndexNotFound && aError.IsOk(); aIndex = pTC->aFileTab.NextIndex( aIndex ) ) { pFName = pTC->aFileTab.Get( aIndex ); @@ -673,8 +673,8 @@ ERRTYPE RscCompiler::Link() } // parse files for specific language - for( sal_uIntPtr aIndex = pTC->aFileTab.FirstIndex(); - aIndex != UNIQUEINDEX_ENTRY_NOTFOUND && aError.IsOk(); + for( RscFileTab::Index aIndex = pTC->aFileTab.FirstIndex(); + aIndex != RscFileTab::IndexNotFound && aError.IsOk(); aIndex = pTC->aFileTab.NextIndex( aIndex ) ) { pFName = pTC->aFileTab.Get( aIndex ); @@ -725,8 +725,8 @@ ERRTYPE RscCompiler::Link() else { // parse files - for( sal_uIntPtr aIndex = pTC->aFileTab.FirstIndex(); - aIndex != UNIQUEINDEX_ENTRY_NOTFOUND && aError.IsOk(); + for( RscFileTab::Index aIndex = pTC->aFileTab.FirstIndex(); + aIndex != RscFileTab::IndexNotFound && aError.IsOk(); aIndex = pTC->aFileTab.NextIndex( aIndex ) ) { pFName = pTC->aFileTab.Get( aIndex ); diff --git a/rsc/source/tools/rscdef.cxx b/rsc/source/tools/rscdef.cxx index 155382de4917..c3dbffe28d88 100644 --- a/rsc/source/tools/rscdef.cxx +++ b/rsc/source/tools/rscdef.cxx @@ -21,6 +21,8 @@ // overall program includes #include <rscdef.hxx> +#include <limits.h> + bool RscId::bNames = true; void RscId::SetNames( bool bSet ) @@ -489,24 +491,21 @@ RscFileTab::~RscFileTab() aDefTree.Remove(); - sal_uIntPtr aIndex = LastIndex(); - while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) + Index aIndex = LastIndex(); + while( aIndex != IndexNotFound ) { delete Remove( aIndex ); aIndex = LastIndex(); }; } -sal_uLong RscFileTab::Find( const OString& rName ) +RscFileTab::Index RscFileTab::Find( const OString& rName ) { - sal_uIntPtr aIndex = FirstIndex(); - while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND && (Get(aIndex)->aFileName != rName) ) + Index aIndex = FirstIndex(); + while( aIndex != IndexNotFound && (Get(aIndex)->aFileName != rName) ) aIndex = NextIndex(aIndex); - if( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) - return aIndex; - else - return NOFILE_INDEX; + return aIndex; } RscDefine * RscFileTab::FindDef( const char * pName ) @@ -516,13 +515,13 @@ RscDefine * RscFileTab::FindDef( const char * pName ) /* This method gives back true when lDepend exists and is behind lFree, or when lDepend does not exist. */ -bool RscFileTab::Depend( sal_uLong lDepend, sal_uLong lFree ) +bool RscFileTab::Depend( Index lDepend, Index lFree ) { if( lDepend == lFree ) return true; - sal_uIntPtr aIndex = FirstIndex(); - while( aIndex != UNIQUEINDEX_ENTRY_NOTFOUND ) + Index aIndex = FirstIndex(); + while( aIndex != IndexNotFound ) { RscFile * pFile = Get(aIndex); if( !pFile->IsIncFile() ) @@ -536,7 +535,7 @@ bool RscFileTab::Depend( sal_uLong lDepend, sal_uLong lFree ) return true; } -bool RscFileTab::TestDef( sal_uLong lFileKey, size_t lPos, +bool RscFileTab::TestDef( Index lFileKey, size_t lPos, const RscDefine * pDefDec ) { if( lFileKey == pDefDec->GetFileKey() ) @@ -554,7 +553,7 @@ bool RscFileTab::TestDef( sal_uLong lFileKey, size_t lPos, return TestDef( lFileKey, lPos, pDefDec->pExp ); } -bool RscFileTab::TestDef( sal_uLong lFileKey, size_t lPos, +bool RscFileTab::TestDef( Index lFileKey, size_t lPos, const RscExpression * pExpDec ) { if( !pExpDec ) @@ -579,7 +578,7 @@ bool RscFileTab::TestDef( sal_uLong lFileKey, size_t lPos, return true; } -RscDefine * RscFileTab::NewDef( sal_uLong lFileKey, const OString& rDefName, +RscDefine * RscFileTab::NewDef( Index lFileKey, const OString& rDefName, sal_Int32 lId, sal_uLong lPos ) { RscDefine * pDef = FindDef( rDefName ); @@ -600,7 +599,7 @@ RscDefine * RscFileTab::NewDef( sal_uLong lFileKey, const OString& rDefName, return pDef; } -RscDefine * RscFileTab::NewDef( sal_uLong lFileKey, const OString& rDefName, +RscDefine * RscFileTab::NewDef( Index lFileKey, const OString& rDefName, RscExpression * pExp, sal_uLong lPos ) { RscDefine * pDef = FindDef( rDefName ); @@ -630,11 +629,9 @@ RscDefine * RscFileTab::NewDef( sal_uLong lFileKey, const OString& rDefName, return pDef; } -void RscFileTab::DeleteFileContext( sal_uLong lFileKey ) +void RscFileTab::DeleteFileContext( Index lFileKey ) { - RscFile * pFName; - - pFName = GetFile( lFileKey ); + RscFile* pFName = GetFile( lFileKey ); if( pFName ) { for ( size_t i = 0, n = pFName->aDefLst.maList.size(); i < n; ++i ) @@ -647,10 +644,10 @@ void RscFileTab::DeleteFileContext( sal_uLong lFileKey ) } } -sal_uLong RscFileTab::NewCodeFile( const OString& rName ) +RscFileTab::Index RscFileTab::NewCodeFile( const OString& rName ) { - sal_uLong lKey = Find( rName ); - if( UNIQUEINDEX_ENTRY_NOTFOUND == lKey ) + Index lKey = Find( rName ); + if( lKey == IndexNotFound ) { RscFile * pFName = new RscFile(); pFName->aFileName = rName; @@ -661,11 +658,11 @@ sal_uLong RscFileTab::NewCodeFile( const OString& rName ) return lKey; } -sal_uLong RscFileTab::NewIncFile(const OString& rName, +RscFileTab::Index RscFileTab::NewIncFile(const OString& rName, const OString& rPath) { - sal_uLong lKey = Find( rName ); - if( UNIQUEINDEX_ENTRY_NOTFOUND == lKey ) + Index lKey = Find( rName ); + if( lKey == IndexNotFound ) { RscFile * pFName = new RscFile(); pFName->aFileName = rName; |