Skip to content

Commit

Permalink
Fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhuai authored Jul 14, 2024
1 parent fb1365c commit 8f8c3e6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions include/imageinfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/
Expand Down Expand Up @@ -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), //
Expand Down

0 comments on commit 8f8c3e6

Please sign in to comment.