summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2014-06-29 13:35:45 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2014-07-22 23:50:39 +0200
commit2d5a7c36ee9ae7ff39d8415f81fb911ff822548e (patch)
tree81a74142bf923e88e50c361d1632344aaf20fa45
parent299363bbbfdc43822ac43b9be0913c9c96f71d86 (diff)
sal_uInt16 to size_t
Change-Id: Ia36a8d833b697dad4f6bbc611b703efcda4b220c
-rw-r--r--sw/source/ui/misc/glosbib.cxx4
-rw-r--r--sw/source/ui/misc/glossary.cxx4
-rw-r--r--sw/source/uibase/dochdl/gloshdl.cxx4
-rw-r--r--sw/source/uibase/inc/glosdoc.hxx4
-rw-r--r--sw/source/uibase/inc/gloshdl.hxx4
-rw-r--r--sw/source/uibase/misc/glosdoc.cxx19
-rw-r--r--sw/source/uibase/uno/unoatxt.cxx18
-rw-r--r--sw/source/uibase/utlui/gloslst.cxx4
8 files changed, 32 insertions, 29 deletions
diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx
index 8a6762f8c675..a62598835cbb 100644
--- a/sw/source/ui/misc/glosbib.cxx
+++ b/sw/source/ui/misc/glosbib.cxx
@@ -92,8 +92,8 @@ SwGlossaryGroupDlg::SwGlossaryGroupDlg(Window * pParent,
m_pPathLB->SelectEntryPos(0);
m_pPathLB->Enable(true);
- const sal_uInt16 nCount = pHdl->GetGroupCnt();
- for( sal_uInt16 i = 0; i < nCount; ++i)
+ const size_t nCount = pHdl->GetGroupCnt();
+ for( size_t i = 0; i < nCount; ++i)
{
OUString sTitle;
OUString sGroup = pHdl->GetGroupName(i, &sTitle);
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index db58cafe8834..9b39b1a1f0ef 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -660,14 +660,14 @@ void SwGlossaryDlg::Init()
m_pCategoryBox->SetUpdateMode( false );
m_pCategoryBox->Clear();
// display text block regions
- const sal_uInt16 nCnt = pGlossaryHdl->GetGroupCnt();
+ const size_t nCnt = pGlossaryHdl->GetGroupCnt();
SvTreeListEntry* pSelEntry = 0;
const OUString sSelStr(::GetCurrGlosGroup().getToken(0, GLOS_DELIM));
const sal_Int32 nSelPath = ::GetCurrGlosGroup().getToken(1, GLOS_DELIM).toInt32();
// #i66304# - "My AutoText" comes from mytexts.bau, but should be translated
const OUString sMyAutoTextEnglish("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 sGroupName(pGlossaryHdl->GetGroupName(nId, &sTitle));
diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx
index 555699af6e45..01b2070fedc2 100644
--- a/sw/source/uibase/dochdl/gloshdl.cxx
+++ b/sw/source/uibase/dochdl/gloshdl.cxx
@@ -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();
}
-OUString SwGlossaryHdl::GetGroupName( sal_uInt16 nId, OUString* pTitle )
+OUString SwGlossaryHdl::GetGroupName( size_t nId, OUString* pTitle )
{
OUString sRet = rStatGlossaries.GetGroupName(nId);
if(pTitle)
diff --git a/sw/source/uibase/inc/glosdoc.hxx b/sw/source/uibase/inc/glosdoc.hxx
index b075882c1c82..8ed321445d5f 100644
--- a/sw/source/uibase/inc/glosdoc.hxx
+++ b/sw/source/uibase/inc/glosdoc.hxx
@@ -103,8 +103,8 @@ public:
bool _bCreate = false
);
- sal_uInt16 GetGroupCnt();
- OUString GetGroupName(sal_uInt16 );
+ size_t GetGroupCnt();
+ OUString GetGroupName(size_t);
OUString GetGroupTitle( const OUString& rGroupName );
bool FindGroupName(OUString& rGroup);
diff --git a/sw/source/uibase/inc/gloshdl.hxx b/sw/source/uibase/inc/gloshdl.hxx
index aa4e0c9a5704..9f4f3051a711 100644
--- a/sw/source/uibase/inc/gloshdl.hxx
+++ b/sw/source/uibase/inc/gloshdl.hxx
@@ -49,8 +49,8 @@ public:
bool ConvertToNew(SwTextBlocks& rOld);
void GlossaryDlg();
- sal_uInt16 GetGroupCnt() const;
- OUString GetGroupName( sal_uInt16, OUString* pTitle = 0 );
+ size_t GetGroupCnt() const;
+ OUString GetGroupName( size_t, OUString* pTitle = 0 );
bool NewGroup(OUString & rGroupName, const OUString& rTitle);
bool DelGroup(const OUString &);
bool RenameGroup(const OUString& rOld, OUString& rNew, const OUString& rNewTitle);
diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx
index cab58a74a2fc..743dbd49c3eb 100644
--- a/sw/source/uibase/misc/glosdoc.cxx
+++ b/sw/source/uibase/misc/glosdoc.cxx
@@ -97,9 +97,9 @@ OUString SwGlossaries::GetDefName()
}
// 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
@@ -107,9 +107,8 @@ bool SwGlossaries::FindGroupName(OUString& rGroup)
{
// if the group name doesn't contain a path, a suitable group entry
// can the searched for here;
- sal_uInt16 nCount = GetGroupCnt();
- sal_uInt16 i;
- for(i= 0; i < nCount; i++)
+ const size_t nCount = GetGroupCnt();
+ for(size_t i = 0; i < nCount; ++i)
{
const OUString sTemp(GetGroupName(i));
if (rGroup==sTemp.getToken(0, GLOS_DELIM))
@@ -121,7 +120,7 @@ bool SwGlossaries::FindGroupName(OUString& rGroup)
// you can search two times because for more directories the case sensitive
// name could occur multiple times
const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
- for(i = 0; i < nCount; i++)
+ for(size_t i = 0; i < nCount; ++i)
{
const OUString sTemp( GetGroupName( i ));
sal_uInt16 nPath = (sal_uInt16)sTemp.getToken(1, GLOS_DELIM).toInt32();
@@ -136,9 +135,9 @@ bool SwGlossaries::FindGroupName(OUString& rGroup)
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");
return m_GlosArr[nGroupId];
}
@@ -499,12 +498,12 @@ void SwGlossaries::RemoveFileFromList( const OUString& rGroup )
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
sal_Int32 nIndex = 0;
const OUString sGroupName(rGroupName.getToken(0, GLOS_DELIM, nIndex));
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);
if (bPathLen)
diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx
index 53b13fa6277c..6769dcc009b2 100644
--- a/sw/source/uibase/uno/unoatxt.cxx
+++ b/sw/source/uibase/uno/unoatxt.cxx
@@ -89,7 +89,9 @@ SwXAutoTextContainer::~SwXAutoTextContainer()
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)
@@ -97,9 +99,9 @@ uno::Any SwXAutoTextContainer::getByIndex(sal_Int32 nIndex)
{
SolarMutexGuard aGuard;
uno::Any aRet;
- sal_uInt16 nCount = pGlossaries->GetGroupCnt();
- if ( 0 <= nIndex && nIndex < nCount )
- aRet = getByName(pGlossaries->GetGroupName( static_cast< sal_uInt16 >(nIndex) ));
+ const size_t nCount = pGlossaries->GetGroupCnt();
+ if ( 0 <= nIndex && static_cast<size_t>(nIndex) < nCount )
+ aRet = getByName(pGlossaries->GetGroupName( static_cast<size_t>(nIndex) ));
else
throw lang::IndexOutOfBoundsException();
return aRet;
@@ -136,12 +138,14 @@ uno::Any SwXAutoTextContainer::getByName(const OUString& GroupName)
uno::Sequence< OUString > SwXAutoTextContainer::getElementNames(void) throw( uno::RuntimeException, std::exception )
{
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();
- 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.
OUString sGroupName(pGlossaries->GetGroupName(i));
diff --git a/sw/source/uibase/utlui/gloslst.cxx b/sw/source/uibase/utlui/gloslst.cxx
index 6027dedb16ed..ca09e9b35d72 100644
--- a/sw/source/uibase/utlui/gloslst.cxx
+++ b/sw/source/uibase/utlui/gloslst.cxx
@@ -248,8 +248,8 @@ void SwGlossaryList::Update()
const OUString sExt( SwGlossaries::GetExtension() );
if(!bFilled)
{
- const sal_uInt16 nGroupCount = pGlossaries->GetGroupCnt();
- for(sal_uInt16 i = 0; i < nGroupCount; i++)
+ const size_t nGroupCount = pGlossaries->GetGroupCnt();
+ for(size_t i = 0; i < nGroupCount; ++i)
{
OUString sGrpName = pGlossaries->GetGroupName(i);
const size_t nPath = static_cast<size_t>(