Skip to content

Commit

Permalink
Switch to heif_context_read_from_memory_without_copy because the othe…
Browse files Browse the repository at this point in the history
…r method has been deprecated.
  • Loading branch information
dlemstra committed Jun 14, 2019
1 parent 8994a54 commit 665b5fd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion coders/heic.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,21 @@ static Image *ReadHEICImage(const ImageInfo *image_info,
Decode HEIF file
*/
heif_context=heif_context_alloc();
error=heif_context_read_from_memory(heif_context,file_data,length,NULL);
error=heif_context_read_from_memory_without_copy(heif_context,file_data,
length,NULL);
file_data=RelinquishMagickMemory(file_data);
if (IsHeifSuccess(&error,image) == MagickFalse)
{
heif_context_free(heif_context);
file_data=RelinquishMagickMemory(file_data);
return(DestroyImageList(image));
}
image_handle=(struct heif_image_handle *) NULL;
error=heif_context_get_primary_image_handle(heif_context,&image_handle);
if (IsHeifSuccess(&error,image) == MagickFalse)
{
heif_context_free(heif_context);
file_data=RelinquishMagickMemory(file_data);
return(DestroyImageList(image));
}
#if LIBHEIF_NUMERIC_VERSION >= 0x01040000
Expand All @@ -231,6 +234,7 @@ static Image *ReadHEICImage(const ImageInfo *image_info,
{
heif_image_handle_release(image_handle);
heif_context_free(heif_context);
file_data=RelinquishMagickMemory(file_data);
ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
}
color_buffer=(unsigned char *) AcquireMagickMemory(length);
Expand Down Expand Up @@ -272,6 +276,7 @@ static Image *ReadHEICImage(const ImageInfo *image_info,
{
heif_image_handle_release(image_handle);
heif_context_free(heif_context);
file_data=RelinquishMagickMemory(file_data);
ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
}
exif_buffer=(unsigned char*) AcquireMagickMemory(exif_size);
Expand Down Expand Up @@ -311,13 +316,15 @@ static Image *ReadHEICImage(const ImageInfo *image_info,
image->colorspace=YCbCrColorspace;
heif_image_handle_release(image_handle);
heif_context_free(heif_context);
file_data=RelinquishMagickMemory(file_data);
return(GetFirstImageInList(image));
}
status=SetImageExtent(image,image->columns,image->rows);
if (status == MagickFalse)
{
heif_image_handle_release(image_handle);
heif_context_free(heif_context);
file_data=RelinquishMagickMemory(file_data);
return(DestroyImageList(image));
}
/*
Expand Down Expand Up @@ -349,6 +356,7 @@ static Image *ReadHEICImage(const ImageInfo *image_info,
{
heif_image_handle_release(image_handle);
heif_context_free(heif_context);
file_data=RelinquishMagickMemory(file_data);
return(DestroyImageList(image));
}
p_y=heif_image_get_plane(heif_image,heif_channel_Y,&stride_y);
Expand Down Expand Up @@ -381,6 +389,7 @@ static Image *ReadHEICImage(const ImageInfo *image_info,
heif_image_release(heif_image);
heif_image_handle_release(image_handle);
heif_context_free(heif_context);
file_data=RelinquishMagickMemory(file_data);
profile=GetImageProfile(image,"icc");
if (profile != (const StringInfo *) NULL)
(void) TransformImageColorspace(image,sRGBColorspace);
Expand Down

0 comments on commit 665b5fd

Please sign in to comment.