Skip to content

Commit

Permalink
Use correct extent value when calling GetNextToken.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemstra committed Mar 26, 2016
1 parent 7573b87 commit 4cc3168
Show file tree
Hide file tree
Showing 15 changed files with 356 additions and 322 deletions.
192 changes: 96 additions & 96 deletions coders/svg.c

Large diffs are not rendered by default.

22 changes: 13 additions & 9 deletions magick/coder.c
Expand Up @@ -774,7 +774,7 @@ MagickExport MagickBooleanType ListCoderInfo(FILE *file,
% %
% %
% %
+ L o a d C o d e r L i s t %
+ L o a d C o d e r C a c h e %
% %
% %
% %
Expand Down Expand Up @@ -817,6 +817,9 @@ static MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache,
MagickStatusType
status;

size_t
extent;

/*
Load the coder map file.
*/
Expand All @@ -827,12 +830,13 @@ static MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache,
status=MagickTrue;
coder_info=(CoderInfo *) NULL;
token=AcquireString(xml);
extent=strlen(token)+MaxTextExtent;
for (q=(char *) xml; *q != '\0'; )
{
/*
Interpret XML.
*/
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
if (*token == '\0')
break;
(void) CopyMagickString(keyword,token,MaxTextExtent);
Expand All @@ -842,7 +846,7 @@ static MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache,
Doctype element.
*/
while ((LocaleNCompare(q,"]>",2) != 0) && (*q != '\0'))
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
continue;
}
if (LocaleNCompare(keyword,"<!--",4) == 0)
Expand All @@ -851,7 +855,7 @@ static MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache,
Comment element.
*/
while ((LocaleNCompare(q,"->",2) != 0) && (*q != '\0'))
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
continue;
}
if (LocaleCompare(keyword,"<include") == 0)
Expand All @@ -862,10 +866,10 @@ static MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache,
while (((*token != '/') && (*(token+1) != '>')) && (*q != '\0'))
{
(void) CopyMagickString(keyword,token,MaxTextExtent);
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
if (*token != '=')
continue;
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
if (LocaleCompare(keyword,"file") == 0)
{
if (depth > 200)
Expand Down Expand Up @@ -924,11 +928,11 @@ static MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache,
coder_info=(CoderInfo *) NULL;
continue;
}
GetNextToken(q,(const char **) NULL,MaxTextExtent,token);
GetNextToken(q,(const char **) NULL,extent,token);
if (*token != '=')
continue;
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
GetNextToken(q,&q,extent,token);
switch (*keyword)
{
case 'M':
Expand Down
22 changes: 13 additions & 9 deletions magick/color.c
Expand Up @@ -2180,7 +2180,7 @@ MagickExport MagickBooleanType ListColorInfo(FILE *file,
% %
% %
% %
+ L o a d C o l o r L i s t %
+ L o a d C o l o r C a c h e %
% %
% %
% %
Expand Down Expand Up @@ -2223,6 +2223,9 @@ static MagickBooleanType LoadColorCache(LinkedListInfo *color_cache,
MagickStatusType
status;

size_t
extent;

/*
Load the color map file.
*/
Expand All @@ -2233,12 +2236,13 @@ static MagickBooleanType LoadColorCache(LinkedListInfo *color_cache,
status=MagickTrue;
color_info=(ColorInfo *) NULL;
token=AcquireString(xml);
extent=strlen(token)+MaxTextExtent;
for (q=(char *) xml; *q != '\0'; )
{
/*
Interpret XML.
*/
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
if (*token == '\0')
break;
(void) CopyMagickString(keyword,token,MaxTextExtent);
Expand All @@ -2248,7 +2252,7 @@ static MagickBooleanType LoadColorCache(LinkedListInfo *color_cache,
Doctype element.
*/
while ((LocaleNCompare(q,"]>",2) != 0) && (*q != '\0'))
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
continue;
}
if (LocaleNCompare(keyword,"<!--",4) == 0)
Expand All @@ -2257,7 +2261,7 @@ static MagickBooleanType LoadColorCache(LinkedListInfo *color_cache,
Comment element.
*/
while ((LocaleNCompare(q,"->",2) != 0) && (*q != '\0'))
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
continue;
}
if (LocaleCompare(keyword,"<include") == 0)
Expand All @@ -2268,10 +2272,10 @@ static MagickBooleanType LoadColorCache(LinkedListInfo *color_cache,
while (((*token != '/') && (*(token+1) != '>')) && (*q != '\0'))
{
(void) CopyMagickString(keyword,token,MaxTextExtent);
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
if (*token != '=')
continue;
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
if (LocaleCompare(keyword,"file") == 0)
{
if (depth > 200)
Expand Down Expand Up @@ -2329,11 +2333,11 @@ static MagickBooleanType LoadColorCache(LinkedListInfo *color_cache,
color_info=(ColorInfo *) NULL;
continue;
}
GetNextToken(q,(const char **) NULL,MaxTextExtent,token);
GetNextToken(q,(const char **) NULL,extent,token);
if (*token != '=')
continue;
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
GetNextToken(q,&q,extent,token);
switch (*keyword)
{
case 'C':
Expand Down
22 changes: 13 additions & 9 deletions magick/configure.c
Expand Up @@ -1157,20 +1157,24 @@ static MagickBooleanType LoadConfigureCache(LinkedListInfo *configure_cache,
MagickStatusType
status;

size_t
extent;

/*
Load the configure map file.
*/
(void) LogMagickEvent(ConfigureEvent,GetMagickModule(),
"Loading configure file \"%s\" ...",filename);
status=MagickTrue;
configure_info=(ConfigureInfo *) NULL;
token=AcquireString((char *) xml);
token=AcquireString(xml);
extent=strlen(token)+MaxTextExtent;
for (q=(char *) xml; *q != '\0'; )
{
/*
Interpret XML.
*/
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
if (*token == '\0')
break;
(void) CopyMagickString(keyword,token,MaxTextExtent);
Expand All @@ -1180,7 +1184,7 @@ static MagickBooleanType LoadConfigureCache(LinkedListInfo *configure_cache,
Doctype element.
*/
while ((LocaleNCompare(q,"]>",2) != 0) && (*q != '\0'))
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
continue;
}
if (LocaleNCompare(keyword,"<!--",4) == 0)
Expand All @@ -1189,7 +1193,7 @@ static MagickBooleanType LoadConfigureCache(LinkedListInfo *configure_cache,
Comment element.
*/
while ((LocaleNCompare(q,"->",2) != 0) && (*q != '\0'))
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
continue;
}
if (LocaleCompare(keyword,"<include") == 0)
Expand All @@ -1200,10 +1204,10 @@ static MagickBooleanType LoadConfigureCache(LinkedListInfo *configure_cache,
while (((*token != '/') && (*(token+1) != '>')) && (*q != '\0'))
{
(void) CopyMagickString(keyword,token,MaxTextExtent);
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
if (*token != '=')
continue;
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
if (LocaleCompare(keyword,"file") == 0)
{
if (depth > 200)
Expand Down Expand Up @@ -1265,11 +1269,11 @@ static MagickBooleanType LoadConfigureCache(LinkedListInfo *configure_cache,
/*
Parse configure element.
*/
GetNextToken(q,(const char **) NULL,MaxTextExtent,token);
GetNextToken(q,(const char **) NULL,extent,token);
if (*token != '=')
continue;
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,MaxTextExtent,token);
GetNextToken(q,&q,extent,token);
GetNextToken(q,&q,extent,token);
switch (*keyword)
{
case 'N':
Expand Down
35 changes: 0 additions & 35 deletions magick/delegate.c
Expand Up @@ -959,41 +959,6 @@ MagickExport MagickBooleanType GetDelegateThreadSupport(
% %
% %
% %
+ G e t M a g i c k T o k e n %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% MagickToken() gets a token from the token stream. A token is defined as
% a sequence of characters delimited by whitespace (e.g. clip-path), a
% sequence delimited with quotes (.e.g "Quote me"), or a sequence enclosed in
% parenthesis (e.g. rgb(0,0,0)). GetNextToken() also recognizes these
% separator characters: ':', '=', ',', and ';'.
%
% The format of the MagickToken method is:
%
% void MagickToken(const char *start,const char **end,char *token)
%
% A description of each parameter follows:
%
% o start: the start of the token sequence.
%
% o end: point to the end of the token sequence.
%
% o token: copy the token to this buffer.
%
*/
MagickExport void GetMagickToken(const char *start,const char **end,char *token)
{
GetNextToken(start,end,~0UL,token);
}

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
+ I s D e l e g a t e C a c h e I n s t a n t i a t e d %
% %
% %
Expand Down
35 changes: 35 additions & 0 deletions magick/deprecate.c
Expand Up @@ -2884,6 +2884,41 @@ MagickExport void *GetMagickRegistry(const ssize_t id,RegistryType *type,
% %
% %
% %
+ G e t M a g i c k T o k e n %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% MagickToken() gets a token from the token stream. A token is defined as
% a sequence of characters delimited by whitespace (e.g. clip-path), a
% sequence delimited with quotes (.e.g "Quote me"), or a sequence enclosed in
% parenthesis (e.g. rgb(0,0,0)). GetNextToken() also recognizes these
% separator characters: ':', '=', ',', and ';'.
%
% The format of the MagickToken method is:
%
% void MagickToken(const char *start,const char **end,char *token)
%
% A description of each parameter follows:
%
% o start: the start of the token sequence.
%
% o end: point to the end of the token sequence.
%
% o token: copy the token to this buffer.
%
*/
MagickExport void GetMagickToken(const char *start,const char **end,char *token)
{
GetNextToken(start,end,~0UL,token);
}

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% G e t I m a g e G e o m e t r y %
% %
% %
Expand Down

0 comments on commit 4cc3168

Please sign in to comment.