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

more SonarLint cleanups #2531

Merged
merged 15 commits into from
Mar 20, 2023
Merged

more SonarLint cleanups #2531

merged 15 commits into from
Mar 20, 2023

Conversation

neheb
Copy link
Collaborator

@neheb neheb commented Mar 4, 2023

No description provided.

@ghost
Copy link

ghost commented Mar 4, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@codecov
Copy link

codecov bot commented Mar 4, 2023

Codecov Report

Merging #2531 (9a5ea32) into main (4a26eba) will decrease coverage by 0.07%.
The diff coverage is 74.25%.

❗ Current head 9a5ea32 differs from pull request most recent head 943f03f. Consider uploading reports for the commit 943f03f to get more accurate results

@@            Coverage Diff             @@
##             main    #2531      +/-   ##
==========================================
- Coverage   63.97%   63.91%   -0.07%     
==========================================
  Files         103      103              
  Lines       22467    22389      -78     
  Branches    10858    10829      -29     
==========================================
- Hits        14374    14309      -65     
+ Misses       5872     5862      -10     
+ Partials     2221     2218       -3     
Impacted Files Coverage Δ
include/exiv2/metadatum.hpp 78.57% <ø> (-1.43%) ⬇️
include/exiv2/riffvideo.hpp 100.00% <ø> (ø)
include/exiv2/slice.hpp 91.30% <ø> (ø)
include/exiv2/tags.hpp 0.00% <ø> (ø)
src/crwimage_int.hpp 95.55% <ø> (+7.32%) ⬆️
src/exif.cpp 66.97% <0.00%> (+0.41%) ⬆️
src/http.cpp 0.00% <0.00%> (ø)
src/jp2image.cpp 70.72% <0.00%> (-0.07%) ⬇️
src/makernote_int.cpp 66.35% <0.00%> (-0.07%) ⬇️
src/matroskavideo.cpp 4.59% <0.00%> (ø)
... and 48 more

... and 1 file with indirect coverage changes

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

@neheb neheb force-pushed the mf branch 3 times, most recently from ca82db6 to 31bbecf Compare March 5, 2023 01:44
@neheb
Copy link
Collaborator Author

neheb commented Mar 5, 2023

@kevinbackhouse what do you think about the if constexpr change?

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. I just made some comments and questions before approving

}

static auto getFocusMode2(const ExifData* metadata, uint32_t& val) {
static uint32_t getFocusMode2(const ExifData* metadata) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you check for this change if FocusMode2 value could be 0 ? In case this field can take this value, we would need to return another value to indicate an error in the operation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No. I just assumed there are tests for this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree with @piponazo: I'd prefer to keep the separate Boolean return value to indicate success on all of these functions, to avoid the potential confusion if the field contains "" or 0.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed.

src/safe_op.hpp Outdated Show resolved Hide resolved
src/basicio.cpp Show resolved Hide resolved
src/convert.cpp Outdated Show resolved Hide resolved
src/convert.cpp Show resolved Hide resolved
@neheb neheb force-pushed the mf branch 2 times, most recently from 2c13910 to e99fd71 Compare March 7, 2023 21:37
@neheb neheb marked this pull request as ready for review March 7, 2023 21:48
@neheb neheb force-pushed the mf branch 18 times, most recently from c6904bb to aac5f54 Compare March 10, 2023 19:02
@kevinbackhouse
Copy link
Collaborator

@kevinbackhouse what do you think about the if constexpr change?

@neheb: That's very cool. I never saw that C++ feature before.

@neheb neheb force-pushed the mf branch 7 times, most recently from c6c90dd to 4c002da Compare March 19, 2023 02:24
src/safe_op.hpp Outdated
}
return num < 0 ? -num : num;
return std::abs(num);
Copy link
Collaborator

Choose a reason for hiding this comment

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

The type isn't signed here so I don't think there's any need to use std::abs.

Suggested change
return std::abs(num);
return num;

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
@neheb neheb force-pushed the mf branch 2 times, most recently from 0620d65 to 53482f3 Compare March 19, 2023 21:07
neheb added 13 commits March 19, 2023 14:31
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Found with google-readability-avoid-underscore-in-googletest-name

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Because of Impl, there's no way this can work properly.

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>
Just make it part of the template

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Seems to trip up MemorySanitizer on ARM32.

Also applied various simplifications to the code using std::filesystem

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Found with: google-runtime-references

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
@neheb neheb merged commit 22b1201 into Exiv2:main Mar 20, 2023
@neheb neheb deleted the mf branch March 20, 2023 15:01
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