tdf#114441 Convert sal_uLong to a better type
In slot.cxx, GetAttrCount() return a size_t type and same type can be assigned directly to nSCount. In hash.hxx, sal_uLong was declared in SvStringHashEntry, the only default parameter it the class takes is aName (type OString) while nValue was directly initialized as 0 in the constructor. The interface to change nValue is through a method setValue of same type.Also In idl/inc/hash.hxx SetValue() and GetValue functionsb are used in idl/source/prj/database.cxx with sal_uInt32 parameter and return type and thus, sal_uInt32 is suitable here.The instances of sal_uLong in source/objects/object.cxx are replaced with sal_uInt32. In object.cxx an iterator was declared using std::find to find nId in rSuperList (originally declared as std::vector<sal_uLong>), therefore if nId is sal_uInt32, the parent vector, rSuperList should be sal_uInt32. This change is now applicable to the void method InsertSlot's parameter rSuperList in object.hxx and also variables n, nId, iter, rSuperList in InsertSlot definition block in the file object.cxx. Variable aSuperList in obect.cxx is also changed to sal_uInt32 because its an argument for rSuperList parameter. nC1 and nC2 in idl/source/prj/svidl.cxx are chnaged from sal_uLong to size_t as this is suitable here. Change-Id: Ie075875229a676ea32dbf9e3049881a479773703 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147220 Reviewed-by: Hossein <hossein@libreoffice.org> Tested-by: Hossein <hossein@libreoffice.org>
This commit is contained in:
@@ -29,7 +29,7 @@
|
|||||||
class SvStringHashEntry
|
class SvStringHashEntry
|
||||||
{
|
{
|
||||||
OString aName;
|
OString aName;
|
||||||
sal_uLong nValue;
|
sal_uInt32 nValue;
|
||||||
public:
|
public:
|
||||||
SvStringHashEntry( OString aName_ )
|
SvStringHashEntry( OString aName_ )
|
||||||
: aName(std::move(aName_))
|
: aName(std::move(aName_))
|
||||||
@@ -39,8 +39,8 @@ public:
|
|||||||
|
|
||||||
const OString& GetName() const { return aName; }
|
const OString& GetName() const { return aName; }
|
||||||
|
|
||||||
void SetValue( sal_uLong n ) { nValue = n; }
|
void SetValue( sal_uInt32 n ) { nValue = n; }
|
||||||
sal_uLong GetValue() const { return nValue; }
|
sal_uInt32 GetValue() const { return nValue; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class SvStringHashTable
|
class SvStringHashTable
|
||||||
|
@@ -71,7 +71,7 @@ private:
|
|||||||
SvIdlDataBase & rBase,
|
SvIdlDataBase & rBase,
|
||||||
SvStream & rOutStm );
|
SvStream & rOutStm );
|
||||||
|
|
||||||
void InsertSlots( SvSlotElementList& rList, std::vector<sal_uLong>& rSuperList,
|
void InsertSlots( SvSlotElementList& rList, std::vector<sal_uInt32>& rSuperList,
|
||||||
SvMetaClassList & rClassList,
|
SvMetaClassList & rClassList,
|
||||||
const OString& rPrefix, SvIdlDataBase& rBase );
|
const OString& rPrefix, SvIdlDataBase& rBase );
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ public:
|
|||||||
SvBOOL aContainer;
|
SvBOOL aContainer;
|
||||||
OString aDisableFlags;
|
OString aDisableFlags;
|
||||||
SvMetaSlot* pNextSlot;
|
SvMetaSlot* pNextSlot;
|
||||||
sal_uLong nListPos;
|
sal_uInt32 nListPos;
|
||||||
SvBOOL aReadOnlyDoc;
|
SvBOOL aReadOnlyDoc;
|
||||||
|
|
||||||
void WriteSlot( std::string_view rShellName,
|
void WriteSlot( std::string_view rShellName,
|
||||||
@@ -104,9 +104,9 @@ public:
|
|||||||
bool GetContainer() const;
|
bool GetContainer() const;
|
||||||
bool GetReadOnlyDoc() const;
|
bool GetReadOnlyDoc() const;
|
||||||
|
|
||||||
sal_uLong GetListPos() const
|
sal_uInt32 GetListPos() const
|
||||||
{ return nListPos; }
|
{ return nListPos; }
|
||||||
void SetListPos(sal_uLong n)
|
void SetListPos(sal_uInt32 n)
|
||||||
{ nListPos = n; }
|
{ nListPos = n; }
|
||||||
void ResetSlotPointer()
|
void ResetSlotPointer()
|
||||||
{ pNextSlot = nullptr; }
|
{ pNextSlot = nullptr; }
|
||||||
|
@@ -165,7 +165,7 @@ sal_uInt16 SvMetaClass::WriteSlots( std::string_view rShellName,
|
|||||||
return nSCount;
|
return nSCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SvMetaClass::InsertSlots( SvSlotElementList& rList, std::vector<sal_uLong>& rSuperList,
|
void SvMetaClass::InsertSlots( SvSlotElementList& rList, std::vector<sal_uInt32>& rSuperList,
|
||||||
SvMetaClassList &rClassList,
|
SvMetaClassList &rClassList,
|
||||||
const OString& rPrefix, SvIdlDataBase& rBase)
|
const OString& rPrefix, SvIdlDataBase& rBase)
|
||||||
{
|
{
|
||||||
@@ -177,14 +177,14 @@ void SvMetaClass::InsertSlots( SvSlotElementList& rList, std::vector<sal_uLong>&
|
|||||||
rClassList.push_back( this );
|
rClassList.push_back( this );
|
||||||
|
|
||||||
// write all direct attributes
|
// write all direct attributes
|
||||||
sal_uLong n;
|
size_t n;
|
||||||
for( n = 0; n < aAttrList.size(); n++ )
|
for( n = 0; n < aAttrList.size(); n++ )
|
||||||
{
|
{
|
||||||
SvMetaAttribute * pAttr = aAttrList[n];
|
SvMetaAttribute * pAttr = aAttrList[n];
|
||||||
|
|
||||||
sal_uLong nId = pAttr->GetSlotId().GetValue();
|
sal_uInt32 nId = pAttr->GetSlotId().GetValue();
|
||||||
|
|
||||||
std::vector<sal_uLong>::iterator iter = std::find(rSuperList.begin(),
|
std::vector<sal_uInt32>::iterator iter = std::find(rSuperList.begin(),
|
||||||
rSuperList.end(),nId);
|
rSuperList.end(),nId);
|
||||||
|
|
||||||
if( iter == rSuperList.end() )
|
if( iter == rSuperList.end() )
|
||||||
@@ -282,7 +282,7 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
|
|||||||
rOutStm.WriteCharPtr("static SfxFormalArgument a").WriteOString(GetName()).WriteCharPtr("Args_Impl[] =") << endl;
|
rOutStm.WriteCharPtr("static SfxFormalArgument a").WriteOString(GetName()).WriteCharPtr("Args_Impl[] =") << endl;
|
||||||
rOutStm.WriteChar('{') << endl;
|
rOutStm.WriteChar('{') << endl;
|
||||||
|
|
||||||
std::vector<sal_uLong> aSuperList;
|
std::vector<sal_uInt32> aSuperList;
|
||||||
SvMetaClassList classList;
|
SvMetaClassList classList;
|
||||||
SvSlotElementList aSlotList;
|
SvSlotElementList aSlotList;
|
||||||
InsertSlots(aSlotList, aSuperList, classList, OString(), rBase);
|
InsertSlots(aSlotList, aSuperList, classList, OString(), rBase);
|
||||||
|
@@ -541,7 +541,7 @@ void SvMetaSlot::WriteSlot( std::string_view rShellName, sal_uInt16 nCount,
|
|||||||
if( IsMethod() )
|
if( IsMethod() )
|
||||||
{
|
{
|
||||||
SvMetaType * pType = GetType();
|
SvMetaType * pType = GetType();
|
||||||
sal_uLong nSCount = pType->GetAttrCount();
|
size_t nSCount = pType->GetAttrCount();
|
||||||
rOutStm
|
rOutStm
|
||||||
.WriteOString( OString::number(nSCount) )
|
.WriteOString( OString::number(nSCount) )
|
||||||
.WriteCharPtr( "/*Count*/," );
|
.WriteCharPtr( "/*Count*/," );
|
||||||
|
@@ -29,8 +29,8 @@
|
|||||||
static bool FileMove_Impl( const OUString & rFile1, const OUString & rFile2, bool bMoveAlways )
|
static bool FileMove_Impl( const OUString & rFile1, const OUString & rFile2, bool bMoveAlways )
|
||||||
{
|
{
|
||||||
//printf( "Move from %s to %s\n", rFile2.GetStr(), rFile1.GetStr() );
|
//printf( "Move from %s to %s\n", rFile2.GetStr(), rFile1.GetStr() );
|
||||||
sal_uLong nC1 = 0;
|
size_t nC1 = 0;
|
||||||
sal_uLong nC2 = 1;
|
size_t nC2 = 1;
|
||||||
if( !bMoveAlways )
|
if( !bMoveAlways )
|
||||||
{
|
{
|
||||||
SvFileStream aOutStm1( rFile1, StreamMode::STD_READ );
|
SvFileStream aOutStm1( rFile1, StreamMode::STD_READ );
|
||||||
|
Reference in New Issue
Block a user