Skip to content

Commit f21f014

Browse files
committed
Avoid unused extra copy of MutableData
1 parent c25a1d2 commit f21f014

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

SDWebImageWebPCoder/Classes/SDImageWebPCoder.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,7 @@ - (void)updateIncrementalData:(NSData *)data finished:(BOOL)finished {
307307
_finished = finished;
308308
// check whether we can detect Animated WebP or Static WebP, they need different codec (Demuxer or IDecoder)
309309
if (!_hasAnimation) {
310-
_imageData = [data copy];
311-
VP8StatusCode status = WebPIUpdate(_idec, _imageData.bytes, _imageData.length);
310+
VP8StatusCode status = WebPIUpdate(_idec, data.bytes, data.length);
312311
// For Static WebP, all things done.
313312
// For Animated WebP (currently use `VP8_STATUS_UNSUPPORTED_FEATURE` to check), continue to create demuxer
314313
if (status != VP8_STATUS_UNSUPPORTED_FEATURE) {
@@ -324,7 +323,7 @@ - (void)updateIncrementalData:(NSData *)data finished:(BOOL)finished {
324323
WebPDemuxDelete(_demux);
325324
_demux = NULL;
326325
}
327-
_imageData = [data copy];
326+
_imageData = data;
328327
WebPData webpData;
329328
WebPDataInit(&webpData);
330329
webpData.bytes = _imageData.bytes;

0 commit comments

Comments
 (0)