From 8f8c3e63eb9a540c0ed217bc6a40324b54121dbe Mon Sep 17 00:00:00 2001 From: Weihang Ding <798047000@qq.com> Date: Sun, 14 Jul 2024 13:21:51 +0800 Subject: [PATCH] Fix code style --- include/imageinfo.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/imageinfo.hpp b/include/imageinfo.hpp index 1cfa48c..13db0bb 100644 --- a/include/imageinfo.hpp +++ b/include/imageinfo.hpp @@ -430,6 +430,10 @@ class ImageInfo { Error error_ = kNoError; }; +inline bool is_numeric(const std::string &str) { + return !str.empty() && std::all_of(str.begin(), str.end(), ::isdigit); +} + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // https://nokiatech.github.io/heif/technical.html @@ -642,9 +646,7 @@ inline bool try_gif(ReadInterface &ri, size_t length, ImageInfo &info) { ); return true; } -inline bool is_numeric(const std::string& str) { - return !str.empty() && std::all_of(str.begin(), str.end(), ::isdigit); -} + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // http://paulbourke.net/dataformats/pic/ @@ -703,8 +705,7 @@ inline bool try_hdr(ReadInterface &ri, size_t length, ImageInfo &info) { } auto y_str = resolution.substr(p0 + 1, p1 - p0 - 1); auto x_str = resolution.substr(p2 + 1); - if( !is_numeric(x_str) || !is_numeric(y_str)) - return false; + if (!is_numeric(x_str) || !is_numeric(y_str)) return false; info = ImageInfo(kFormatHdr, "hdr", "hdr", "image/vnd.radiance"); info.set_size( // std::stol(x_str), //