From 550dadb86e2b3743bba797fbfff1f7a58cc250ed Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Thu, 18 Aug 2022 13:21:53 +0200 Subject: [PATCH] Utils: fix narrowing warning We test the small string capacity anyway, so we never write a larger size. Change-Id: Ie3a2f907898229fdee6219149917d9fddd3297e6 Reviewed-by: Cristian Adam --- src/libs/utils/smallstringlayout.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libs/utils/smallstringlayout.h b/src/libs/utils/smallstringlayout.h index d85dedac089..22312ef5a9a 100644 --- a/src/libs/utils/smallstringlayout.h +++ b/src/libs/utils/smallstringlayout.h @@ -43,12 +43,14 @@ template > struct ControlBlock { - using SizeType = ControlType; + using SizeType = ControlType; constexpr ControlBlock() noexcept = default; - constexpr ControlBlock(ControlType shortStringSize, bool isReadOnlyReference, bool isReference) noexcept - : m_shortStringSize(shortStringSize), - m_isReadOnlyReference(isReadOnlyReference), - m_isReference(isReference) + constexpr ControlBlock(size_type shortStringSize, + bool isReadOnlyReference, + bool isReference) noexcept + : m_shortStringSize(static_cast(shortStringSize)) + , m_isReadOnlyReference(isReadOnlyReference) + , m_isReference(isReference) {} constexpr void setShortStringSize(size_type size)