Skip to content
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

find changes #2462

Merged
merged 2 commits into from
Jan 27, 2023
Merged

find changes #2462

merged 2 commits into from
Jan 27, 2023

Conversation

neheb
Copy link
Collaborator

@neheb neheb commented Jan 13, 2023

Not sure if better.

@codecov
Copy link

codecov bot commented Jan 13, 2023

Codecov Report

Merging #2462 (5bce764) into main (ed67372) will increase coverage by 0.00%.
The diff coverage is 70.32%.

@@           Coverage Diff           @@
##             main    #2462   +/-   ##
=======================================
  Coverage   62.08%   62.09%           
=======================================
  Files         121      121           
  Lines       22830    22831    +1     
  Branches    11212    11212           
=======================================
+ Hits        14175    14176    +1     
  Misses       6448     6448           
  Partials     2207     2207           
Impacted Files Coverage Δ
src/asfvideo.cpp 4.01% <0.00%> (ø)
src/convert.cpp 53.61% <ø> (ø)
src/epsimage.cpp 1.92% <0.00%> (ø)
src/riffvideo.cpp 2.83% <0.00%> (ø)
src/quicktimevideo.cpp 59.11% <48.00%> (ø)
app/exiv2.cpp 63.32% <75.00%> (+0.07%) ⬆️
src/tags_int.hpp 91.34% <80.00%> (ø)
src/makernote_int.cpp 66.91% <81.81%> (-0.07%) ⬇️
src/fujimn_int.cpp 41.81% <100.00%> (ø)
src/minoltamn_int.cpp 69.46% <100.00%> (ø)
... and 8 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@neheb
Copy link
Collaborator Author

neheb commented Jan 14, 2023

hmmm should the find() template be public API?

piponazo
piponazo previously approved these changes Jan 14, 2023
Copy link
Collaborator

@piponazo piponazo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general the changes look good (less verbose code). The only thing I would change is to use auto * instead of auto to make more evident that Exiv2::find is returning a T *. I'll leave the decision up to you.

@@ -317,7 +317,7 @@ void readWriteEpsMetadata(BasicIo& io, std::string& xmpPacket, NativePreviewList
#ifdef DEBUG
EXV_DEBUG << "readWriteEpsMetadata: First line: " << firstLine << "\n";
#endif
bool matched = std::find(epsFirstLine.begin(), epsFirstLine.end(), firstLine) != epsFirstLine.end();
auto matched = Exiv2::find(epsFirstLine, firstLine);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[discussion] auto here is taking the value of T *. Even though it is not needed, I normally find more readable to use auto * to declare the intention of using pointers. What do you think about this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like auto* mostly because of const. Eg.

auto = const char*
auto* = char*
const auto = const char* const
const auto* = const char*

Regular auto makes more sense IMO.

@neheb neheb marked this pull request as ready for review January 14, 2023 18:32
@mergify mergify bot dismissed piponazo’s stale review January 14, 2023 22:47

Pull request has been modified.

std::find in C++20 can use ranges, which is equivalent here. Less error
prone.

Namespace is properly to avoid any conflicts with std::find or others

Signed-off-by: Rosen Penev <rosenp@gmail.com>
The latter is simpler.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
@ghost
Copy link

ghost commented Jan 27, 2023

👇 Click on the image for a new way to code review
  • Make big changes easier — review code in small groups of related files

  • Know where to start — see the whole change at a glance

  • Take a code tour — explore the change with an interactive tour

  • Make comments and review — all fully sync’ed with github

    Try it now!

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map Legend

@neheb
Copy link
Collaborator Author

neheb commented Jan 27, 2023

ping @kmilos

Copy link
Collaborator

@kmilos kmilos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@neheb neheb merged commit a7a9835 into Exiv2:main Jan 27, 2023
@neheb neheb deleted the 2 branch January 27, 2023 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants