From 83d1ca90d906f30adedefe574410b344cf988935 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sun, 31 Mar 2019 22:18:08 +0200 Subject: [PATCH] Fix compilation Summary: Seems only gcc can do a constexpr with strlen. This fixes the build with clang, hopefully to with MSVC? Reviewers: svuorela Reviewed By: svuorela Subscribers: svuorela, apol, pino, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D20149 --- src/imageformats/kra.cpp | 2 +- src/imageformats/ora.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/imageformats/kra.cpp b/src/imageformats/kra.cpp index 9945d08..ceac73e 100644 --- a/src/imageformats/kra.cpp +++ b/src/imageformats/kra.cpp @@ -19,7 +19,7 @@ #include static constexpr char s_magic[] = "application/x-krita"; -static constexpr int s_magic_size = strlen(s_magic); +static constexpr int s_magic_size = sizeof(s_magic) - 1; // -1 to remove the last \0 KraHandler::KraHandler() { diff --git a/src/imageformats/ora.cpp b/src/imageformats/ora.cpp index 792181f..4e5a11e 100644 --- a/src/imageformats/ora.cpp +++ b/src/imageformats/ora.cpp @@ -18,7 +18,7 @@ #include static constexpr char s_magic[] = "image/openraster"; -static constexpr int s_magic_size = strlen(s_magic); +static constexpr int s_magic_size = sizeof(s_magic) - 1; // -1 to remove the last \0 OraHandler::OraHandler() {