-
Notifications
You must be signed in to change notification settings - Fork 282
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
Use std::move to transfer ownership of DataBufs. #1956
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1956 +/- ##
=======================================
Coverage 61.12% 61.12%
=======================================
Files 96 96
Lines 19055 19054 -1
Branches 9743 9732 -11
=======================================
Hits 11647 11647
- Misses 5092 5094 +2
+ Partials 2316 2313 -3
Continue to review full report at Codecov.
|
No copy assignment operator is defined. I would define it as deleted l. |
DataBuf& operator=(DataBuf&& rhs); | ||
|
||
// No copy assignment. | ||
DataBuf& operator=(const DataBuf&) = delete; |
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.
@neheb: is this what you mean?
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.
Yeah
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.
@neheb: If you're happy, please could you approve this PR so that I can merge it? Thanks!
DataBuf
had a constructor that was used as a move constructor, but didn't have the correct type. This fixes that and changes the code to usestd::move
when transferring ownership of aDataBuf
.I also removed
DataBufRef
, because it is no longer used.Everything here should be behavior preserving, except for the change that I made to this code in
image.cpp
:exiv2/src/image.cpp
Lines 593 to 595 in 4901c5d
That looks like a bug to me because it's not copying the icc profile from
image
unlike all the copy operations in that function. Also, the condition&& iccProfile()
could never fail, becauseiccProfile
returned a pointer to theiccProfile_
field, so it could never be null. So I've changed that code to something that I think makes more sense. Unfortunately, we don't have any test coverage for it, so I don't know if I have broken anything with that change.