cid#1506514 Uninitialized scalar field

Change-Id: I777d9008289b2afb464d1002e8be32072c0a4501
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136099
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2022-06-19 12:38:51 +01:00
parent 66b93c18fd
commit 5d41aca772
2 changed files with 8 additions and 5 deletions

View file

@ -40,7 +40,7 @@ class SmElementsControl
SmDocShell* mpDocShell;
SmFormat maFormat;
size_t mnCurrentSetIndex;
int mnCurrentSetIndex;
sal_uInt16 m_nSmSyntaxVersion;
bool mbVerticalMode;
@ -50,7 +50,7 @@ class SmElementsControl
Link<OUString, void> maSelectHdlLink;
void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText);
void addElements(size_t nCategory);
void addElements(int nCategory);
void build();
@ -66,7 +66,7 @@ public:
~SmElementsControl();
static const std::vector<TranslateId>& categories();
void setElementSetIndex(size_t nSetIndex);
void setElementSetIndex(int nSetIndex);
void setVerticalMode(bool bVertical);

View file

@ -454,6 +454,7 @@ const std::vector<TranslateId>& SmElementsControl::categories()
SmElementsControl::SmElementsControl(std::unique_ptr<weld::IconView> pIconView)
: mpDocShell(new SmDocShell(SfxModelFlags::EMBEDDED_OBJECT))
, mnCurrentSetIndex(-1)
, m_nSmSyntaxVersion(SM_MOD()->GetConfig()->GetDefaultSmSyntaxVersion())
, mbVerticalMode(true)
, mpIconView(std::move(pIconView))
@ -540,7 +541,7 @@ OUString SmElementsControl::GetElementHelpText(const OUString& itemId)
return weld::fromId<ElementData*>(itemId)->maHelpText;
}
void SmElementsControl::setElementSetIndex(size_t nSetIndex)
void SmElementsControl::setElementSetIndex(int nSetIndex)
{
if (mnCurrentSetIndex == nSetIndex)
return;
@ -548,13 +549,15 @@ void SmElementsControl::setElementSetIndex(size_t nSetIndex)
build();
}
void SmElementsControl::addElements(size_t nCategory)
void SmElementsControl::addElements(int nCategory)
{
mpIconView->freeze();
mpIconView->clear();
mpIconView->set_item_width(0);
maItemDatas.clear();
assert(nCategory >= 0 && o3tl::make_unsigned(nCategory) < s_a5CategoryDescriptions.size());
const auto& [aElementsArray, aElementsArraySize] = s_a5CategoryDescriptions[nCategory];
for (size_t i = 0; i < aElementsArraySize; i++)