Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
f00967cf
Kaydet (Commit)
f00967cf
authored
Mar 01, 2016
tarafından
Matteo Casalin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
sal_uIntPtr/sal_uLong to Index (aka sal_uInt32) in UniqueIndex
Change-Id: I212cb3bb9d920741629fc4564bbd28b393e8fe00
üst
4845155e
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
128 additions
and
116 deletions
+128
-116
pstm.hxx
include/tools/pstm.hxx
+10
-6
unqidx.hxx
include/tools/unqidx.hxx
+27
-20
rscdb.hxx
rsc/inc/rscdb.hxx
+3
-3
rscdef.hxx
rsc/inc/rscdef.hxx
+15
-12
rscdb.cxx
rsc/source/parser/rscdb.cxx
+12
-12
rsclex.cxx
rsc/source/parser/rsclex.cxx
+1
-1
rscyacc.y
rsc/source/parser/rscyacc.y
+1
-0
rsc.cxx
rsc/source/rsc/rsc.cxx
+13
-13
rscdef.cxx
rsc/source/tools/rscdef.cxx
+23
-26
unqidx.cxx
tools/source/memtools/unqidx.cxx
+16
-16
pstm.cxx
tools/source/ref/pstm.cxx
+7
-7
No files found.
include/tools/pstm.hxx
Dosyayı görüntüle @
f00967cf
...
...
@@ -91,8 +91,6 @@ public:
SvPersistBase
*&
rpObj
);
};
typedef
std
::
map
<
SvPersistBase
*
,
sal_uIntPtr
>
PersistBaseMap
;
class
SvStream
;
/** Persistent Stream
...
...
@@ -130,12 +128,18 @@ class SvStream;
*/
class
TOOLS_DLLPUBLIC
SvPersistStream
:
public
SvStream
{
public
:
typedef
UniqueIndex
<
SvPersistBase
>::
Index
Index
;
private
:
typedef
std
::
map
<
SvPersistBase
*
,
Index
>
PersistBaseMap
;
SvClassManager
&
rClassMgr
;
SvStream
*
pStm
;
PersistBaseMap
aPTable
;
// reversed pointer and key
UniqueIndex
<
SvPersistBase
>
aPUIdx
;
sal_uIntPtr
nStartIdx
;
Index
nStartIdx
;
const
SvPersistStream
*
pRefStm
;
virtual
sal_uIntPtr
GetData
(
void
*
pData
,
sal_uIntPtr
nSize
)
override
;
...
...
@@ -151,13 +155,13 @@ public:
virtual
void
ResetError
()
override
;
SvPersistStream
(
SvClassManager
&
,
SvStream
*
pStream
,
sal_uInt32
nStartIdx
=
1
);
Index
nStartIdx
=
1
);
virtual
~
SvPersistStream
();
void
SetStream
(
SvStream
*
pStream
);
SvPersistBase
*
GetObject
(
sal_uIntPtr
nIdx
)
const
;
sal_uIntPtr
GetIndex
(
SvPersistBase
*
)
const
;
SvPersistBase
*
GetObject
(
Index
nIdx
)
const
;
Index
GetIndex
(
SvPersistBase
*
)
const
;
static
void
WriteCompressed
(
SvStream
&
rStm
,
sal_uInt32
nVal
);
static
sal_uInt32
ReadCompressed
(
SvStream
&
rStm
);
...
...
include/tools/unqidx.hxx
Dosyayı görüntüle @
f00967cf
...
...
@@ -20,45 +20,52 @@
#define INCLUDED_TOOLS_UNQIDX_HXX
#include <tools/toolsdllapi.h>
#include <
tools/contnr.hxx
>
#include <
limits
>
#include <map>
#define UNIQUEINDEX_ENTRY_NOTFOUND CONTAINER_ENTRY_NOTFOUND
class
SAL_WARN_UNUSED
TOOLS_DLLPUBLIC
UniqueIndexImpl
{
public
:
typedef
sal_uInt32
Index
;
enum
{
IndexNotFound
=
std
::
numeric_limits
<
Index
>::
max
()
};
private
:
std
::
map
<
sal_uInt32
,
void
*>
maMap
;
sal_uIntPtr
nStartIndex
;
sal_uIntPtr
nUniqIndex
;
sal_uIntPtr
nCount
;
std
::
map
<
Index
,
void
*>
maMap
;
Index
nStartIndex
;
Index
nUniqIndex
;
Index
nCount
;
public
:
UniqueIndexImpl
(
sal_uIntPtr
_nStartIndex
=
0
)
UniqueIndexImpl
(
Index
_nStartIndex
=
0
)
:
maMap
(),
nStartIndex
(
_nStartIndex
),
nUniqIndex
(
_nStartIndex
),
nCount
(
0
)
{}
sal_uIntPtr
Insert
(
void
*
p
);
Index
Insert
(
void
*
p
);
// insert value with key, replacing existing entry if necessary
void
*
Remove
(
sal_uIntPtr
aIndex
);
void
*
Get
(
sal_uIntPtr
aIndex
)
const
;
void
*
Remove
(
Index
aIndex
);
void
*
Get
(
Index
aIndex
)
const
;
sal_uIntPtr
GetIndexOf
(
void
*
p
)
const
;
sal_uIntPtr
FirstIndex
()
const
;
sal_uIntPtr
LastIndex
()
const
;
sal_uIntPtr
NextIndex
(
sal_uIntPtr
aCurrIndex
)
const
;
Index
GetIndexOf
(
void
*
p
)
const
;
Index
FirstIndex
()
const
;
Index
LastIndex
()
const
;
Index
NextIndex
(
Index
aCurrIndex
)
const
;
};
template
<
typename
T
>
class
UniqueIndex
:
private
UniqueIndexImpl
{
public
:
UniqueIndex
<
T
>
(
sal_uIntPtr
_nStartIndex
=
0
)
:
UniqueIndexImpl
(
_nStartIndex
)
{}
using
UniqueIndexImpl
::
Index
;
using
UniqueIndexImpl
::
IndexNotFound
;
UniqueIndex
<
T
>
(
Index
_nStartIndex
=
0
)
:
UniqueIndexImpl
(
_nStartIndex
)
{}
sal_uIntPtr
Insert
(
T
*
p
)
{
return
UniqueIndexImpl
::
Insert
(
p
);
}
T
*
Get
(
sal_uIntPtr
idx
)
const
{
return
static_cast
<
T
*>
(
UniqueIndexImpl
::
Get
(
idx
)
);
}
T
*
Remove
(
sal_uIntPtr
idx
)
{
return
static_cast
<
T
*>
(
UniqueIndexImpl
::
Remove
(
idx
)
);
}
sal_uIntPtr
GetIndexOf
(
T
*
p
)
const
{
return
UniqueIndexImpl
::
GetIndexOf
(
p
);
}
Index
Insert
(
T
*
p
)
{
return
UniqueIndexImpl
::
Insert
(
p
);
}
T
*
Get
(
Index
idx
)
const
{
return
static_cast
<
T
*>
(
UniqueIndexImpl
::
Get
(
idx
)
);
}
T
*
Remove
(
Index
idx
)
{
return
static_cast
<
T
*>
(
UniqueIndexImpl
::
Remove
(
idx
)
);
}
Index
GetIndexOf
(
T
*
p
)
const
{
return
UniqueIndexImpl
::
GetIndexOf
(
p
);
}
using
UniqueIndexImpl
::
FirstIndex
;
using
UniqueIndexImpl
::
LastIndex
;
...
...
rsc/inc/rscdb.hxx
Dosyayı görüntüle @
f00967cf
...
...
@@ -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
;
}
...
...
rsc/inc/rscdef.hxx
Dosyayı görüntüle @
f00967cf
...
...
@@ -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
...
...
rsc/source/parser/rscdb.cxx
Dosyayı görüntüle @
f00967cf
...
...
@@ -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
);
...
...
rsc/source/parser/rsclex.cxx
Dosyayı görüntüle @
f00967cf
...
...
@@ -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
()
);
...
...
rsc/source/parser/rscyacc.y
Dosyayı görüntüle @
f00967cf
...
...
@@ -20,6 +20,7 @@
#include "sal/config.h"
#include <limits.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
...
...
rsc/source/rsc/rsc.cxx
Dosyayı görüntüle @
f00967cf
...
...
@@ -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
);
...
...
rsc/source/tools/rscdef.cxx
Dosyayı görüntüle @
f00967cf
...
...
@@ -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
;
...
...
tools/source/memtools/unqidx.cxx
Dosyayı görüntüle @
f00967cf
...
...
@@ -19,14 +19,14 @@
#include <tools/unqidx.hxx>
sal_uIntPtr
UniqueIndexImpl
::
Insert
(
void
*
p
)
UniqueIndexImpl
::
Index
UniqueIndexImpl
::
Insert
(
void
*
p
)
{
// NULL-Pointer not allowed
if
(
!
p
)
return
UNIQUEINDEX_ENTRY_NOTFOUND
;
return
IndexNotFound
;
// Expend array if full
sal_uIntPtr
nTmp
=
maMap
.
size
(
);
Index
nTmp
=
static_cast
<
Index
>
(
maMap
.
size
()
);
if
(
nTmp
==
nCount
)
nTmp
++
;
...
...
@@ -45,7 +45,7 @@ sal_uIntPtr UniqueIndexImpl::Insert( void* p )
return
(
nUniqIndex
+
nStartIndex
-
1
);
}
void
*
UniqueIndexImpl
::
Remove
(
sal_uIntPtr
nIndex
)
void
*
UniqueIndexImpl
::
Remove
(
Index
nIndex
)
{
// Check for valid index
if
(
(
nIndex
>=
nStartIndex
)
&&
...
...
@@ -53,7 +53,7 @@ void* UniqueIndexImpl::Remove( sal_uIntPtr nIndex )
{
// insert index as empty entry, and reduce indexcount,
// if this entry was used
std
::
map
<
sal_uInt32
,
void
*>::
iterator
it
=
maMap
.
find
(
nIndex
-
nStartIndex
);
std
::
map
<
Index
,
void
*>::
iterator
it
=
maMap
.
find
(
nIndex
-
nStartIndex
);
if
(
it
!=
maMap
.
end
()
)
{
void
*
p
=
it
->
second
;
...
...
@@ -65,52 +65,52 @@ void* UniqueIndexImpl::Remove( sal_uIntPtr nIndex )
return
nullptr
;
}
void
*
UniqueIndexImpl
::
Get
(
sal_uIntPtr
nIndex
)
const
void
*
UniqueIndexImpl
::
Get
(
Index
nIndex
)
const
{
// check for valid index
if
(
(
nIndex
>=
nStartIndex
)
&&
(
nIndex
<
(
maMap
.
size
()
+
nStartIndex
))
)
{
std
::
map
<
sal_uInt32
,
void
*>::
const_iterator
it
=
maMap
.
find
(
nIndex
-
nStartIndex
);
std
::
map
<
Index
,
void
*>::
const_iterator
it
=
maMap
.
find
(
nIndex
-
nStartIndex
);
if
(
it
!=
maMap
.
end
()
)
return
it
->
second
;
}
return
nullptr
;
}
sal_uIntPtr
UniqueIndexImpl
::
FirstIndex
()
const
UniqueIndexImpl
::
Index
UniqueIndexImpl
::
FirstIndex
()
const
{
if
(
maMap
.
empty
()
)
return
UNIQUEINDEX_ENTRY_NOTFOUND
;
return
IndexNotFound
;
return
maMap
.
begin
()
->
first
;
}
sal_uIntPtr
UniqueIndexImpl
::
LastIndex
()
const
UniqueIndexImpl
::
Index
UniqueIndexImpl
::
LastIndex
()
const
{
if
(
maMap
.
empty
()
)
return
UNIQUEINDEX_ENTRY_NOTFOUND
;
return
IndexNotFound
;
return
maMap
.
rbegin
()
->
first
;
}
sal_uIntPtr
UniqueIndexImpl
::
NextIndex
(
sal_uIntPtr
aIndex
)
const
UniqueIndexImpl
::
Index
UniqueIndexImpl
::
NextIndex
(
Index
aIndex
)
const
{
std
::
map
<
sal_uInt32
,
void
*>::
const_iterator
it
=
maMap
.
find
(
aIndex
);
if
(
it
==
maMap
.
end
()
)
return
UNIQUEINDEX_ENTRY_NOTFOUND
;
return
IndexNotFound
;
++
it
;
if
(
it
==
maMap
.
end
()
)
return
UNIQUEINDEX_ENTRY_NOTFOUND
;
return
IndexNotFound
;
return
it
->
first
;
}
sal_uIntPtr
UniqueIndexImpl
::
GetIndexOf
(
void
*
p
)
const
UniqueIndexImpl
::
Index
UniqueIndexImpl
::
GetIndexOf
(
void
*
p
)
const
{
for
(
std
::
map
<
sal_uInt32
,
void
*>::
const_iterator
it
=
maMap
.
begin
();
it
!=
maMap
.
end
();
++
it
)
if
(
it
->
second
==
p
)
return
it
->
first
;
return
UNIQUEINDEX_ENTRY_NOTFOUND
;
return
IndexNotFound
;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tools/source/ref/pstm.cxx
Dosyayı görüntüle @
f00967cf
...
...
@@ -51,7 +51,7 @@ SvCreateInstancePersist SvClassManager::Get( sal_Int32 nClassId )
(cf. <SvPersistStream::SetStream>).
@see SvPersistStream::SetStream
*/
SvPersistStream
::
SvPersistStream
(
SvClassManager
&
rMgr
,
SvStream
*
pStream
,
sal_uInt32
nStartIdxP
)
SvPersistStream
::
SvPersistStream
(
SvClassManager
&
rMgr
,
SvStream
*
pStream
,
Index
nStartIdxP
)
:
rClassMgr
(
rMgr
)
,
pStm
(
pStream
)
,
aPUIdx
(
nStartIdxP
)
...
...
@@ -135,7 +135,7 @@ void SvPersistStream::FlushData()
{
}
sal_uIntPtr
SvPersistStream
::
GetIndex
(
SvPersistBase
*
pObj
)
const
SvPersistStream
::
Index
SvPersistStream
::
GetIndex
(
SvPersistBase
*
pObj
)
const
{
PersistBaseMap
::
const_iterator
it
=
aPTable
.
find
(
pObj
);
if
(
it
==
aPTable
.
end
()
)
...
...
@@ -148,7 +148,7 @@ sal_uIntPtr SvPersistStream::GetIndex( SvPersistBase * pObj ) const
return
it
->
second
;
}
SvPersistBase
*
SvPersistStream
::
GetObject
(
sal_uIntPtr
nIdx
)
const
SvPersistBase
*
SvPersistStream
::
GetObject
(
Index
nIdx
)
const
{
if
(
nIdx
>=
nStartIdx
)
return
aPUIdx
.
Get
(
nIdx
);
...
...
@@ -388,7 +388,7 @@ static void ReadId
(
SvStream
&
rStm
,
sal_uInt8
&
nHdr
,
sal_uInt32
&
nId
,
SvPersistStream
::
Index
&
nId
,
sal_uInt16
&
nClassId
)
{
...
...
@@ -441,7 +441,7 @@ SvPersistStream& SvPersistStream::WritePointer
if
(
pObj
)
{
sal_uIntPtr
nId
=
GetIndex
(
pObj
);
Index
nId
=
GetIndex
(
pObj
);
if
(
nId
)
nP
|=
P_ID
;
else
...
...
@@ -468,7 +468,7 @@ void SvPersistStream::ReadObj
)
{
sal_uInt8
nHdr
;
sal_uInt32
nId
=
0
;
Index
nId
=
0
;
sal_uInt16
nClassId
;
rpObj
=
nullptr
;
// specification: 0 in case of error
...
...
@@ -512,7 +512,7 @@ void SvPersistStream::ReadObj
if
(
bRegister
)
{
// insert into table
sal_uIntPtr
nNewId
=
aPUIdx
.
Insert
(
rpObj
);
const
Index
nNewId
=
aPUIdx
.
Insert
(
rpObj
);
// in order to restore state after saving
aPTable
[
rpObj
]
=
nNewId
;
DBG_ASSERT
(
!
(
nHdr
&
P_DBGUTIL
)
||
nId
==
nNewId
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment