Kaydet (Commit) 2d5a7c36 authored tarafından Matteo Casalin's avatar Matteo Casalin

sal_uInt16 to size_t

Change-Id: Ia36a8d833b697dad4f6bbc611b703efcda4b220c
üst 299363bb
...@@ -92,8 +92,8 @@ SwGlossaryGroupDlg::SwGlossaryGroupDlg(Window * pParent, ...@@ -92,8 +92,8 @@ SwGlossaryGroupDlg::SwGlossaryGroupDlg(Window * pParent,
m_pPathLB->SelectEntryPos(0); m_pPathLB->SelectEntryPos(0);
m_pPathLB->Enable(true); m_pPathLB->Enable(true);
const sal_uInt16 nCount = pHdl->GetGroupCnt(); const size_t nCount = pHdl->GetGroupCnt();
for( sal_uInt16 i = 0; i < nCount; ++i) for( size_t i = 0; i < nCount; ++i)
{ {
OUString sTitle; OUString sTitle;
OUString sGroup = pHdl->GetGroupName(i, &sTitle); OUString sGroup = pHdl->GetGroupName(i, &sTitle);
......
...@@ -660,14 +660,14 @@ void SwGlossaryDlg::Init() ...@@ -660,14 +660,14 @@ void SwGlossaryDlg::Init()
m_pCategoryBox->SetUpdateMode( false ); m_pCategoryBox->SetUpdateMode( false );
m_pCategoryBox->Clear(); m_pCategoryBox->Clear();
// display text block regions // display text block regions
const sal_uInt16 nCnt = pGlossaryHdl->GetGroupCnt(); const size_t nCnt = pGlossaryHdl->GetGroupCnt();
SvTreeListEntry* pSelEntry = 0; SvTreeListEntry* pSelEntry = 0;
const OUString sSelStr(::GetCurrGlosGroup().getToken(0, GLOS_DELIM)); const OUString sSelStr(::GetCurrGlosGroup().getToken(0, GLOS_DELIM));
const sal_Int32 nSelPath = ::GetCurrGlosGroup().getToken(1, GLOS_DELIM).toInt32(); const sal_Int32 nSelPath = ::GetCurrGlosGroup().getToken(1, GLOS_DELIM).toInt32();
// #i66304# - "My AutoText" comes from mytexts.bau, but should be translated // #i66304# - "My AutoText" comes from mytexts.bau, but should be translated
const OUString sMyAutoTextEnglish("My AutoText"); const OUString sMyAutoTextEnglish("My AutoText");
const OUString sMyAutoTextTranslated(SW_RES(STR_MY_AUTOTEXT)); const OUString sMyAutoTextTranslated(SW_RES(STR_MY_AUTOTEXT));
for(sal_uInt16 nId = 0; nId < nCnt; ++nId ) for(size_t nId = 0; nId < nCnt; ++nId )
{ {
OUString sTitle; OUString sTitle;
OUString sGroupName(pGlossaryHdl->GetGroupName(nId, &sTitle)); OUString sGroupName(pGlossaryHdl->GetGroupName(nId, &sTitle));
......
...@@ -149,12 +149,12 @@ void SwGlossaryHdl::SetCurGroup(const OUString &rGrp, bool bApi, bool bAlwaysCre ...@@ -149,12 +149,12 @@ void SwGlossaryHdl::SetCurGroup(const OUString &rGrp, bool bApi, bool bAlwaysCre
} }
} }
sal_uInt16 SwGlossaryHdl::GetGroupCnt() const size_t SwGlossaryHdl::GetGroupCnt() const
{ {
return rStatGlossaries.GetGroupCnt(); return rStatGlossaries.GetGroupCnt();
} }
OUString SwGlossaryHdl::GetGroupName( sal_uInt16 nId, OUString* pTitle ) OUString SwGlossaryHdl::GetGroupName( size_t nId, OUString* pTitle )
{ {
OUString sRet = rStatGlossaries.GetGroupName(nId); OUString sRet = rStatGlossaries.GetGroupName(nId);
if(pTitle) if(pTitle)
......
...@@ -103,8 +103,8 @@ public: ...@@ -103,8 +103,8 @@ public:
bool _bCreate = false bool _bCreate = false
); );
sal_uInt16 GetGroupCnt(); size_t GetGroupCnt();
OUString GetGroupName(sal_uInt16 ); OUString GetGroupName(size_t);
OUString GetGroupTitle( const OUString& rGroupName ); OUString GetGroupTitle( const OUString& rGroupName );
bool FindGroupName(OUString& rGroup); bool FindGroupName(OUString& rGroup);
......
...@@ -49,8 +49,8 @@ public: ...@@ -49,8 +49,8 @@ public:
bool ConvertToNew(SwTextBlocks& rOld); bool ConvertToNew(SwTextBlocks& rOld);
void GlossaryDlg(); void GlossaryDlg();
sal_uInt16 GetGroupCnt() const; size_t GetGroupCnt() const;
OUString GetGroupName( sal_uInt16, OUString* pTitle = 0 ); OUString GetGroupName( size_t, OUString* pTitle = 0 );
bool NewGroup(OUString & rGroupName, const OUString& rTitle); bool NewGroup(OUString & rGroupName, const OUString& rTitle);
bool DelGroup(const OUString &); bool DelGroup(const OUString &);
bool RenameGroup(const OUString& rOld, OUString& rNew, const OUString& rNewTitle); bool RenameGroup(const OUString& rOld, OUString& rNew, const OUString& rNewTitle);
......
...@@ -97,9 +97,9 @@ OUString SwGlossaries::GetDefName() ...@@ -97,9 +97,9 @@ OUString SwGlossaries::GetDefName()
} }
// supplies the number of text block groups // supplies the number of text block groups
sal_uInt16 SwGlossaries::GetGroupCnt() size_t SwGlossaries::GetGroupCnt()
{ {
return static_cast<sal_uInt16>(GetNameList().size()); return GetNameList().size();
} }
// supplies the group's name // supplies the group's name
...@@ -107,9 +107,8 @@ bool SwGlossaries::FindGroupName(OUString& rGroup) ...@@ -107,9 +107,8 @@ bool SwGlossaries::FindGroupName(OUString& rGroup)
{ {
// if the group name doesn't contain a path, a suitable group entry // if the group name doesn't contain a path, a suitable group entry
// can the searched for here; // can the searched for here;
sal_uInt16 nCount = GetGroupCnt(); const size_t nCount = GetGroupCnt();
sal_uInt16 i; for(size_t i = 0; i < nCount; ++i)
for(i= 0; i < nCount; i++)
{ {
const OUString sTemp(GetGroupName(i)); const OUString sTemp(GetGroupName(i));
if (rGroup==sTemp.getToken(0, GLOS_DELIM)) if (rGroup==sTemp.getToken(0, GLOS_DELIM))
...@@ -121,7 +120,7 @@ bool SwGlossaries::FindGroupName(OUString& rGroup) ...@@ -121,7 +120,7 @@ bool SwGlossaries::FindGroupName(OUString& rGroup)
// you can search two times because for more directories the case sensitive // you can search two times because for more directories the case sensitive
// name could occur multiple times // name could occur multiple times
const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore(); const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
for(i = 0; i < nCount; i++) for(size_t i = 0; i < nCount; ++i)
{ {
const OUString sTemp( GetGroupName( i )); const OUString sTemp( GetGroupName( i ));
sal_uInt16 nPath = (sal_uInt16)sTemp.getToken(1, GLOS_DELIM).toInt32(); sal_uInt16 nPath = (sal_uInt16)sTemp.getToken(1, GLOS_DELIM).toInt32();
...@@ -136,9 +135,9 @@ bool SwGlossaries::FindGroupName(OUString& rGroup) ...@@ -136,9 +135,9 @@ bool SwGlossaries::FindGroupName(OUString& rGroup)
return false; return false;
} }
OUString SwGlossaries::GetGroupName(sal_uInt16 nGroupId) OUString SwGlossaries::GetGroupName(size_t nGroupId)
{ {
OSL_ENSURE(static_cast<size_t>(nGroupId) < m_GlosArr.size(), OSL_ENSURE(nGroupId < m_GlosArr.size(),
"SwGlossaries::GetGroupName: index out of bounds"); "SwGlossaries::GetGroupName: index out of bounds");
return m_GlosArr[nGroupId]; return m_GlosArr[nGroupId];
} }
...@@ -499,12 +498,12 @@ void SwGlossaries::RemoveFileFromList( const OUString& rGroup ) ...@@ -499,12 +498,12 @@ void SwGlossaries::RemoveFileFromList( const OUString& rGroup )
OUString SwGlossaries::GetCompleteGroupName( const OUString& rGroupName ) OUString SwGlossaries::GetCompleteGroupName( const OUString& rGroupName )
{ {
const sal_uInt16 nCount = GetGroupCnt(); const size_t nCount = GetGroupCnt();
// when the group name was created internally the path is here as well // when the group name was created internally the path is here as well
sal_Int32 nIndex = 0; sal_Int32 nIndex = 0;
const OUString sGroupName(rGroupName.getToken(0, GLOS_DELIM, nIndex)); const OUString sGroupName(rGroupName.getToken(0, GLOS_DELIM, nIndex));
const bool bPathLen = !rGroupName.getToken(0, GLOS_DELIM, nIndex).isEmpty(); const bool bPathLen = !rGroupName.getToken(0, GLOS_DELIM, nIndex).isEmpty();
for ( sal_uInt16 i = 0; i < nCount; i++ ) for ( size_t i = 0; i < nCount; i++ )
{ {
const OUString sGrpName = GetGroupName(i); const OUString sGrpName = GetGroupName(i);
if (bPathLen) if (bPathLen)
......
...@@ -89,7 +89,9 @@ SwXAutoTextContainer::~SwXAutoTextContainer() ...@@ -89,7 +89,9 @@ SwXAutoTextContainer::~SwXAutoTextContainer()
sal_Int32 SwXAutoTextContainer::getCount(void) throw( uno::RuntimeException, std::exception ) sal_Int32 SwXAutoTextContainer::getCount(void) throw( uno::RuntimeException, std::exception )
{ {
return pGlossaries->GetGroupCnt(); OSL_ENSURE(pGlossaries->GetGroupCnt() < static_cast<size_t>(SAL_MAX_INT32),
"SwXAutoTextContainer::getCount: too many items");
return static_cast<sal_Int32>(pGlossaries->GetGroupCnt());
} }
uno::Any SwXAutoTextContainer::getByIndex(sal_Int32 nIndex) uno::Any SwXAutoTextContainer::getByIndex(sal_Int32 nIndex)
...@@ -97,9 +99,9 @@ uno::Any SwXAutoTextContainer::getByIndex(sal_Int32 nIndex) ...@@ -97,9 +99,9 @@ uno::Any SwXAutoTextContainer::getByIndex(sal_Int32 nIndex)
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
uno::Any aRet; uno::Any aRet;
sal_uInt16 nCount = pGlossaries->GetGroupCnt(); const size_t nCount = pGlossaries->GetGroupCnt();
if ( 0 <= nIndex && nIndex < nCount ) if ( 0 <= nIndex && static_cast<size_t>(nIndex) < nCount )
aRet = getByName(pGlossaries->GetGroupName( static_cast< sal_uInt16 >(nIndex) )); aRet = getByName(pGlossaries->GetGroupName( static_cast<size_t>(nIndex) ));
else else
throw lang::IndexOutOfBoundsException(); throw lang::IndexOutOfBoundsException();
return aRet; return aRet;
...@@ -136,12 +138,14 @@ uno::Any SwXAutoTextContainer::getByName(const OUString& GroupName) ...@@ -136,12 +138,14 @@ uno::Any SwXAutoTextContainer::getByName(const OUString& GroupName)
uno::Sequence< OUString > SwXAutoTextContainer::getElementNames(void) throw( uno::RuntimeException, std::exception ) uno::Sequence< OUString > SwXAutoTextContainer::getElementNames(void) throw( uno::RuntimeException, std::exception )
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
sal_uInt16 nCount = pGlossaries->GetGroupCnt(); const size_t nCount = pGlossaries->GetGroupCnt();
OSL_ENSURE(nCount < static_cast<size_t>(SAL_MAX_INT32),
"SwXAutoTextContainer::getElementNames: too many groups");
uno::Sequence< OUString > aGroupNames(nCount); uno::Sequence< OUString > aGroupNames(static_cast<sal_Int32>(nCount));
OUString *pArr = aGroupNames.getArray(); OUString *pArr = aGroupNames.getArray();
for ( sal_uInt16 i = 0; i < nCount; i++ ) for ( size_t i = 0; i < nCount; ++i )
{ {
// The names will be passed without a path extension. // The names will be passed without a path extension.
OUString sGroupName(pGlossaries->GetGroupName(i)); OUString sGroupName(pGlossaries->GetGroupName(i));
......
...@@ -248,8 +248,8 @@ void SwGlossaryList::Update() ...@@ -248,8 +248,8 @@ void SwGlossaryList::Update()
const OUString sExt( SwGlossaries::GetExtension() ); const OUString sExt( SwGlossaries::GetExtension() );
if(!bFilled) if(!bFilled)
{ {
const sal_uInt16 nGroupCount = pGlossaries->GetGroupCnt(); const size_t nGroupCount = pGlossaries->GetGroupCnt();
for(sal_uInt16 i = 0; i < nGroupCount; i++) for(size_t i = 0; i < nGroupCount; ++i)
{ {
OUString sGrpName = pGlossaries->GetGroupName(i); OUString sGrpName = pGlossaries->GetGroupName(i);
const size_t nPath = static_cast<size_t>( const size_t nPath = static_cast<size_t>(
......
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