remove manual math

Signed-off-by: Rosen Penev <rosenp@gmail.com>
main
Rosen Penev 2 years ago
parent 527dc9f666
commit b8d4b9c6ea

@ -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);

@ -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();
@ -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

@ -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

Loading…
Cancel
Save