-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
random cleanups #3169
base: main
Are you sure you want to change the base?
random cleanups #3169
Conversation
1c1dd86
to
ebd140d
Compare
src/properties.cpp
Outdated
@@ -5033,8 +5033,8 @@ const XmpPropertyInfo* XmpProperties::propertyInfo(const XmpKey& key) { | |||
std::string property = key.tagName(); | |||
// If property is a path for a nested property, determines the innermost element | |||
if (auto i = property.find_last_of('/'); i != std::string::npos) { | |||
for (; i != std::string::npos && !isalpha(property.at(i)); ++i) { | |||
} | |||
while (!std::isalpha(property.at(i))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably check for \0
. I agree that the previous i != std::string::npos
check was wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at() here is probably wrong too.
if (!value_.empty()) { | ||
std::copy(value_.begin(), value_.end() - 1, std::ostream_iterator<int>(os, " ")); | ||
os << static_cast<int>(value_.back()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a weird way to write the code. Is it a standard idiom that I'm not familiar with? If so, please could you add a comment with a hyperlink to the relevant wikipedia page or similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's standard. The goal way to avoid a manual loop.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
These are no longer needed with modern compilers. Signed-off-by: Rosen Penev <rosenp@gmail.com>
simpler Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
std::swap was added here to avoid a use after move warning. But in reality, the second usage of object is wrong and should be changed to nullptr. Signed-off-by: Rosen Penev <rosenp@gmail.com>
Rebased. |
No description provided.