Page MenuHomePhabricator

thumb: fix optimization conversion, move and free.
ClosedPublic

Authored by netstar on Aug 5 2017, 3:47 PM.

Details

Reviewers
raster
Summary

fix image save (needs extension). use same extension (saves conversion).
fix free before use.

Diff Detail

Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 4215
Build 4280: arc lint + arc unit
netstar created this revision.Aug 5 2017, 3:47 PM

I move the extension pointer for clarity when writing the file name with sprintf.

I guess you could hardcore the extension and not check the length etc but I like to be safe ... also saves changing if thumbs need a new format elsewhere?

netstar updated this revision to Diff 11927.Aug 5 2017, 4:06 PM

Actually let's not move the ext++ :/

raster requested changes to this revision.Aug 5 2017, 7:30 PM

Can i recommend something? write to the original tmp file as you did ... THEN rename() (or ecore_file_mv) to the final name. why? atomic replacement. a rename/mv guarantees either the new file is 100% all of the new stuff or it's not there. you can never have the final file be "half written because rage crashed during the write". :)

This revision now requires changes to proceed.Aug 5 2017, 7:30 PM
netstar updated this revision to Diff 11928.Aug 5 2017, 7:31 PM
netstar edited edge metadata.

ok

raster accepted this revision.Aug 6 2017, 3:04 AM
This revision is now accepted and ready to land.Aug 6 2017, 3:04 AM
raster closed this revision.Aug 6 2017, 5:55 PM

commited in 6e2b560ed4bbbef8a68f3ac592113743ac199274