Avoid -Wstringop-overread by using a view with encoded length
For some reason the suppression stopped working for me, but using the viewAt function is better in general as it doesn't depend on null termination. Amendsbb10da84941375(viewAt() was added by2c2c6de85afor 6.3, so we can use it in all affected branches). Pick-to: 6.7 6.5 Change-Id: Ic71bd559929a2cd0cdea4ed1cc1edcfc583865ff Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit cec64aaf2a8e110421d61478b9ad0cb177ee0d1c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
parent
348d56cca4
commit
68c22bd7d3
|
|
@ -35,7 +35,7 @@ static constexpr auto magicRuleTypes = qOffsetStringArray(
|
|||
QMimeMagicRule::Type QMimeMagicRule::type(const QByteArray &theTypeName)
|
||||
{
|
||||
for (int i = String; i <= Byte; ++i) {
|
||||
if (theTypeName == magicRuleTypes.at(i))
|
||||
if (theTypeName == magicRuleTypes.viewAt(i))
|
||||
return Type(i);
|
||||
}
|
||||
return Invalid;
|
||||
|
|
|
|||
Loading…
Reference in New Issue