put the message into static_assert
and use more static_assert where its obviously possible Change-Id: I9466130809acab12505f0760f970793991564165 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124633 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
@@ -519,7 +519,7 @@ namespace pcr
|
|||||||
if( ! (_rControlValue >>= sControlValue) )
|
if( ! (_rControlValue >>= sControlValue) )
|
||||||
SAL_WARN("extensions.propctrlr", "convertToControlValue: unable to get property for Show/Hide");
|
SAL_WARN("extensions.propctrlr", "convertToControlValue: unable to get property for Show/Hide");
|
||||||
|
|
||||||
assert(SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE) == 2 && "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!");
|
static_assert(SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE), "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!");
|
||||||
bool bShow = sControlValue == PcrRes(RID_RSC_ENUM_SHOWHIDE[1]);
|
bool bShow = sControlValue == PcrRes(RID_RSC_ENUM_SHOWHIDE[1]);
|
||||||
|
|
||||||
aPropertyValue <<= bShow;
|
aPropertyValue <<= bShow;
|
||||||
@@ -627,7 +627,7 @@ namespace pcr
|
|||||||
case PROPERTY_ID_SHOW_RECORDACTIONS:
|
case PROPERTY_ID_SHOW_RECORDACTIONS:
|
||||||
case PROPERTY_ID_SHOW_FILTERSORT:
|
case PROPERTY_ID_SHOW_FILTERSORT:
|
||||||
{
|
{
|
||||||
assert(SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE) == 2 && "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!");
|
static_assert(SAL_N_ELEMENTS(RID_RSC_ENUM_SHOWHIDE) == 2, "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!");
|
||||||
OUString sControlValue = ::comphelper::getBOOL(_rPropertyValue)
|
OUString sControlValue = ::comphelper::getBOOL(_rPropertyValue)
|
||||||
? PcrRes(RID_RSC_ENUM_SHOWHIDE[1])
|
? PcrRes(RID_RSC_ENUM_SHOWHIDE[1])
|
||||||
: PcrRes(RID_RSC_ENUM_SHOWHIDE[0]);
|
: PcrRes(RID_RSC_ENUM_SHOWHIDE[0]);
|
||||||
|
@@ -529,7 +529,7 @@ OUString SfxDocumentTemplates::ConvertResourceString(const OUString& rString)
|
|||||||
STR_TEMPLATE_NAME30
|
STR_TEMPLATE_NAME30
|
||||||
};
|
};
|
||||||
|
|
||||||
assert(SAL_N_ELEMENTS(aTemplateNames) == SAL_N_ELEMENTS(STR_TEMPLATE_NAME));
|
static_assert(SAL_N_ELEMENTS(aTemplateNames) == SAL_N_ELEMENTS(STR_TEMPLATE_NAME));
|
||||||
|
|
||||||
for (size_t i = 0; i < SAL_N_ELEMENTS(STR_TEMPLATE_NAME); ++i)
|
for (size_t i = 0; i < SAL_N_ELEMENTS(STR_TEMPLATE_NAME); ++i)
|
||||||
{
|
{
|
||||||
|
@@ -1021,7 +1021,7 @@ void FmXFormShell::GetConversionMenu_Lock(weld::Menu& rNewMenu)
|
|||||||
|
|
||||||
OString FmXFormShell::SlotToIdent(sal_uInt16 nSlot)
|
OString FmXFormShell::SlotToIdent(sal_uInt16 nSlot)
|
||||||
{
|
{
|
||||||
assert(SAL_N_ELEMENTS(SelObjectSlotMap) >= SAL_N_ELEMENTS(aConvertSlots));
|
static_assert(SAL_N_ELEMENTS(SelObjectSlotMap) >= SAL_N_ELEMENTS(aConvertSlots));
|
||||||
|
|
||||||
for (size_t i = 0; i < SAL_N_ELEMENTS(aConvertSlots); ++i)
|
for (size_t i = 0; i < SAL_N_ELEMENTS(aConvertSlots); ++i)
|
||||||
{
|
{
|
||||||
|
@@ -402,7 +402,7 @@ void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit )
|
|||||||
RID_SVXSTR_DEPTH_4_INCH
|
RID_SVXSTR_DEPTH_4_INCH
|
||||||
};
|
};
|
||||||
|
|
||||||
assert(SAL_N_ELEMENTS(aDepths) == SAL_N_ELEMENTS(aDepthsInch));
|
static_assert(SAL_N_ELEMENTS(aDepths) == SAL_N_ELEMENTS(aDepthsInch));
|
||||||
|
|
||||||
const TranslateId* pResource = IsMetric(eUnit) ? aDepths : aDepthsInch;
|
const TranslateId* pResource = IsMetric(eUnit) ? aDepths : aDepthsInch;
|
||||||
|
|
||||||
|
@@ -185,7 +185,7 @@ void ShellResource::GetAutoFormatNameLst_() const
|
|||||||
mxAutoFormatNameLst.emplace();
|
mxAutoFormatNameLst.emplace();
|
||||||
mxAutoFormatNameLst->reserve(STR_AUTOFMTREDL_END);
|
mxAutoFormatNameLst->reserve(STR_AUTOFMTREDL_END);
|
||||||
|
|
||||||
assert(SAL_N_ELEMENTS(RID_SHELLRES_AUTOFMTSTRS) == STR_AUTOFMTREDL_END);
|
static_assert(SAL_N_ELEMENTS(RID_SHELLRES_AUTOFMTSTRS) == STR_AUTOFMTREDL_END);
|
||||||
for (sal_uInt16 n = 0; n < STR_AUTOFMTREDL_END; ++n)
|
for (sal_uInt16 n = 0; n < STR_AUTOFMTREDL_END; ++n)
|
||||||
{
|
{
|
||||||
OUString p(SwResId(RID_SHELLRES_AUTOFMTSTRS[n]));
|
OUString p(SwResId(RID_SHELLRES_AUTOFMTSTRS[n]));
|
||||||
|
@@ -1404,7 +1404,7 @@ OUString Printer::GetPaperName( Paper ePaper )
|
|||||||
PAPER_ARCHE, PAPER_SCREEN_16_9, PAPER_SCREEN_16_10, PAPER_16K_195x270, PAPER_16K_197x273,
|
PAPER_ARCHE, PAPER_SCREEN_16_9, PAPER_SCREEN_16_10, PAPER_16K_195x270, PAPER_16K_197x273,
|
||||||
PAPER_WIDESCREEN, PAPER_ONSCREENSHOW_4_3, PAPER_ONSCREENSHOW_16_9, PAPER_ONSCREENSHOW_16_10
|
PAPER_WIDESCREEN, PAPER_ONSCREENSHOW_4_3, PAPER_ONSCREENSHOW_16_9, PAPER_ONSCREENSHOW_16_10
|
||||||
};
|
};
|
||||||
static_assert(SAL_N_ELEMENTS(PaperIndex) == SAL_N_ELEMENTS(RID_STR_PAPERNAMES)); // ensure localized paper name count is correct
|
static_assert(SAL_N_ELEMENTS(PaperIndex) == SAL_N_ELEMENTS(RID_STR_PAPERNAMES), "localized paper name count wrong");
|
||||||
for (size_t i = 0; i < SAL_N_ELEMENTS(PaperIndex); ++i)
|
for (size_t i = 0; i < SAL_N_ELEMENTS(PaperIndex); ++i)
|
||||||
pSVData->maPaperNames[PaperIndex[i]] = VclResId(RID_STR_PAPERNAMES[i]);
|
pSVData->maPaperNames[PaperIndex[i]] = VclResId(RID_STR_PAPERNAMES[i]);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user