From: Cristy Date: Sat, 17 Feb 2018 15:16:55 +0000 (-0500) Subject: Support named strings X-Git-Tag: 7.0.7-23~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fae31a87e45dc584731e0df7d8c295c417e4efea;p=imagemagick Support named strings --- diff --git a/MagickCore/string.c b/MagickCore/string.c index 41ddad0b0..2bbaf110c 100644 --- a/MagickCore/string.c +++ b/MagickCore/string.c @@ -847,6 +847,8 @@ MagickExport StringInfo *DestroyStringInfo(StringInfo *string_info) if (string_info->datum != (unsigned char *) NULL) string_info->datum=(unsigned char *) RelinquishMagickMemory( string_info->datum); + if (string_info->name != (char *) NULL) + string_info->name=DestroyString(string_info->name); if (string_info->path != (char *) NULL) string_info->path=DestroyString(string_info->path); string_info->signature=(~MagickCoreSignature); @@ -1324,6 +1326,35 @@ MagickExport size_t GetStringInfoLength(const StringInfo *string_info) % % % % % % +% G e t S t r i n g I n f o N a m e % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% GetStringInfoName() returns the name associated with the string. +% +% The format of the GetStringInfoName method is: +% +% const char *GetStringInfoName(const StringInfo *string_info) +% +% A description of each parameter follows: +% +% o string_info: the string info. +% +*/ +MagickExport const char *GetStringInfoName(const StringInfo *string_info) +{ + assert(string_info != (StringInfo *) NULL); + assert(string_info->signature == MagickCoreSignature); + return(string_info->name); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % % G e t S t r i n g I n f o P a t h % % % % % @@ -1809,7 +1840,39 @@ MagickExport void SetStringInfoLength(StringInfo *string_info, % % % % % % -% S e t S t r i n g I n f o D a t u m % +% S e t S t r i n g I n f o N a m e % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% SetStringInfoName() sets the name associated with the string. +% +% The format of the SetStringInfoName method is: +% +% void SetStringInfoName(StringInfo *string_info,const char *name) +% +% A description of each parameter follows: +% +% o string_info: the string info. +% +% o name: the name. +% +*/ +MagickExport void SetStringInfoName(StringInfo *string_info,const char *name) +{ + assert(string_info != (StringInfo *) NULL); + assert(string_info->signature == MagickCoreSignature); + assert(name != (const char *) NULL); + string_info->name=ConstantString(name); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% S e t S t r i n g I n f o P a t h % % % % % % % diff --git a/MagickCore/string_.h b/MagickCore/string_.h index 2b4fb22f6..4cef32ea4 100644 --- a/MagickCore/string_.h +++ b/MagickCore/string_.h @@ -35,6 +35,9 @@ typedef struct _StringInfo size_t length, signature; + + char + *name; } StringInfo; extern MagickExport char @@ -54,6 +57,7 @@ extern MagickExport char **StringToList(const char *); extern MagickExport const char + *GetStringInfoName(const StringInfo *), *GetStringInfoPath(const StringInfo *); extern MagickExport double @@ -102,6 +106,7 @@ extern MagickExport void SetStringInfo(StringInfo *,const StringInfo *), SetStringInfoDatum(StringInfo *,const unsigned char *), SetStringInfoLength(StringInfo *,const size_t), + SetStringInfoName(StringInfo *,const char *), SetStringInfoPath(StringInfo *,const char *), StripString(char *);