-
Notifications
You must be signed in to change notification settings - Fork 278
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
Move enums from tags_int.hpp to tags.hpp #2276
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2276 +/- ##
==========================================
- Coverage 63.48% 63.47% -0.01%
==========================================
Files 118 118
Lines 19598 19579 -19
Branches 9556 9549 -7
==========================================
- Hits 12442 12428 -14
+ Misses 5092 5091 -1
+ Partials 2064 2060 -4
Continue to review full report at Codecov.
|
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 do not have anything against moving that enum to the API, and it makes sense to have it there so that TagInfo
can reuse it. 👍
include/exiv2/tags.hpp
Outdated
@@ -47,18 +47,192 @@ struct EXIV2API GroupInfo::GroupName { | |||
std::string g_; //!< Group name | |||
}; | |||
|
|||
//! Type to specify the IFD to which a metadata belongs | |||
enum IfdId { |
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.
[Suggestion] Did you think about making this enumeration a scoped enum (enum class
)? I think it would help for code readability.
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.
good suggestion!
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 added a commit that does this. It's a big diff! I used a script to make most of the changes.
This is a difference between clang-format-12 and 14. Needs to be updated IMO. |
if (!ti) | ||
return sectionInfo[unknownTag.sectionId_].name_; | ||
return sectionInfo[ti->sectionId_].name_; | ||
return sectionInfo[static_cast<int>(unknownTag.sectionId_)].name_; |
Check warning
Code scanning / CodeQL
Unsafe vector access
return sectionInfo[unknownTag.sectionId_].name_; | ||
return sectionInfo[ti->sectionId_].name_; | ||
return sectionInfo[static_cast<int>(unknownTag.sectionId_)].name_; | ||
return sectionInfo[static_cast<int>(ti->sectionId_)].name_; |
Check warning
Code scanning / CodeQL
Unsafe vector access
b7152ec
to
3ef783e
Compare
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.
Thanks a lot! Specially for the additional effort for the final commit 👏
Few months ago when I introduced the clang-format workflow we discussed about this and we decided to use the clang-version coming with |
@piponazo @neheb: Regarding the clang-format version, I think the best choice is whatever people are most likely to have installed on their computers. I'm running Ubuntu 22.04, which comes with clang 14, but I expect most people are using Macs or Windows, and I don't know which version is the default on those platforms. I can easily use a docker container to run version 12 if necessary, so I'm happy to work around this if 12 is the most popular choice. |
I just happened across this, making |
This moves the declarations of enums
IfdId
andSectionId
fromsrc/tags_int.hpp
toinclude/exiv2/tags.hpp
. I think it makes the code a bit cleaner because now theTagInfo
struct can use those enums rather thanint
.But maybe there's a reason why
IfdId
andSectionId
shouldn't be included in the public interface that I'm not aware of? If so, I'll close this PR.