From 4d072b8543e3f770bb1c90f09a6ee019b4365641 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Fri, 3 Feb 2017 09:57:54 +0100 Subject: [PATCH] Added acquire and destroy method for CustomStreamInfo. --- MagickCore/blob.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++ MagickCore/blob.h | 4 +++ 2 files changed, 72 insertions(+) diff --git a/MagickCore/blob.c b/MagickCore/blob.c index 768c47bf0..443f6ab3c 100644 --- a/MagickCore/blob.c +++ b/MagickCore/blob.c @@ -191,6 +191,42 @@ static int % % % % % % ++ A c q u i r e C u s t o m S t r e a m I n f o % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% AcquireCustomStreamInfo() allocates the CustomStreamInfo structure. +% +% The format of the AcquireCustomStreamInfo method is: +% +% CustomStreamInfo *AcquireCustomStreamInfo(ExceptionInfo *exception) +% +% A description of each parameter follows: +% +% o exception: return any errors or warnings in this structure. +% +*/ +MagickExport CustomStreamInfo *AcquireCustomStreamInfo( + ExceptionInfo *exception) +{ + CustomStreamInfo + *custom_stream; + + custom_stream=(CustomStreamInfo *) AcquireMagickMemory( + sizeof(*custom_stream)); + if (custom_stream == (CustomStreamInfo *) NULL) + ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); + (void) ResetMagickMemory(custom_stream,0,sizeof(*custom_stream)); + return(custom_stream); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % + A t t a c h B l o b % % % % % @@ -683,6 +719,38 @@ MagickExport void DestroyBlob(Image *image) % % % % % % ++ D e s t r o y C u s t o m S t r e a m I n f o % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DestroyCustomStreamInfo() destroys memory associated with the +% CustomStreamInfo structure. +% +% The format of the DestroyCustomStreamInfo method is: +% +% CustomStreamInfo *DestroyCustomStreamInfo(CustomStreamInfo *stream_info) +% +% A description of each parameter follows: +% +% o custom_stream: the custom stream info. +% +*/ +MagickExport CustomStreamInfo *DestroyCustomStreamInfo( + CustomStreamInfo *custom_stream) +{ + (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); + assert(custom_stream != (CustomStreamInfo *) NULL); + custom_stream=(CustomStreamInfo *) RelinquishMagickMemory(custom_stream); + return(custom_stream); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % + D e t a c h B l o b % % % % % diff --git a/MagickCore/blob.h b/MagickCore/blob.h index 6007a68f1..ef9f57071 100644 --- a/MagickCore/blob.h +++ b/MagickCore/blob.h @@ -46,6 +46,10 @@ typedef struct _CustomStreamInfo #include "MagickCore/image.h" #include "MagickCore/stream.h" +extern MagickExport CustomStreamInfo + *AcquireCustomStreamInfo(ExceptionInfo *), + *DestroyCustomStreamInfo(CustomStreamInfo *); + extern MagickExport FILE *GetBlobFileHandle(const Image *); -- 2.40.0