Skip to content

Commit

Permalink
remove manual math
Browse files Browse the repository at this point in the history
Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed Feb 3, 2023
1 parent 527dc9f commit b8d4b9c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ void Converter::cnvXmpGPSCoord(const char* from, const char* to) {
char sep1 = '\0';
char sep2 = '\0';

value.erase(value.length() - 1);
value.pop_back();

std::istringstream in(value);

Expand Down
4 changes: 2 additions & 2 deletions src/futils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ void Uri::Decode(Uri& uri) {
Uri Uri::Parse(const std::string& uri) {
Uri result;

if (!uri.length())
if (uri.empty())
return result;

auto uriEnd = uri.end();
Expand Down Expand Up @@ -320,7 +320,7 @@ Uri Uri::Parse(const std::string& uri) {
auto portEnd = (pathStart != uriEnd) ? pathStart : queryStart;
result.Port = std::string(hostEnd, portEnd);
}
if (!result.Port.length() && result.Protocol == "http")
if (result.Port.empty() && result.Protocol == "http")
result.Port = "80";

// path
Expand Down
4 changes: 2 additions & 2 deletions src/jpgimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ void JpegBase::readMetadata() {
// the first one (most jpegs only have one anyway). Comments
// are simple single byte ISO-8859-1 strings.
comment_.assign(buf.c_str(2), size - 2);
while (comment_.length() && comment_.at(comment_.length() - 1) == '\0') {
comment_.erase(comment_.length() - 1);
while (!comment_.empty() && comment_.back() == '\0') {
comment_.pop_back();
}
--search;
} else if (marker == app2_ && size >= 13 // prevent out-of-bounds read in memcmp on next line
Expand Down

0 comments on commit b8d4b9c

Please sign in to comment.