Skip to content

Commit

Permalink
://github.com//pull/266
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Sep 14, 2016
1 parent ccb2417 commit da02578
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
5 changes: 4 additions & 1 deletion MagickCore/resource.c
Expand Up @@ -433,7 +433,10 @@ MagickExport MagickBooleanType GetPathTemplate(char *path)
return(MagickTrue);
value=GetPolicyValue("temporary-path");
if (value != (char *) NULL)
(void) CloneString(&directory,value);
{
(void) CloneString(&directory,value);
value=DestroyString(value);
}
if (strlen(directory) > (MagickPathExtent-25))
{
directory=DestroyString(directory);
Expand Down
27 changes: 17 additions & 10 deletions coders/tiff.c
Expand Up @@ -2781,7 +2781,23 @@ static MagickBooleanType GetTIFFInfo(const ImageInfo *image_info,
(void) ResetMagickMemory(tiff_info,0,sizeof(*tiff_info));
option=GetImageOption(image_info,"tiff:tile-geometry");
if (option == (const char *) NULL)
return(MagickTrue);
{
uint32
rows_per_strip;

option=GetImageOption(image_info,"tiff:rows-per-strip");
if (option != (const char *) NULL)
rows_per_strip=(size_t) strtol(option,(char **) NULL,10);
else
if (TIFFGetField(tiff,TIFFTAG_IMAGELENGTH,&rows_per_strip) == 0)
rows_per_strip=0; /* use default */
rows_per_strip=TIFFDefaultStripSize(tiff,rows_per_strip);
(void) TIFFSetField(tiff,TIFFTAG_ROWSPERSTRIP,rows_per_strip);
return(MagickTrue);
}
/*
Create tiled TIFF, ignore "tiff:rows-per-strip".
*/
flags=ParseAbsoluteGeometry(option,&tiff_info->tile_geometry);
if ((flags & HeightValue) == 0)
tiff_info->tile_geometry.height=tiff_info->tile_geometry.width;
Expand Down Expand Up @@ -3127,9 +3143,6 @@ static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info,
endian,
photometric;

uint32
rows_per_strip;

unsigned char
*pixels;

Expand Down Expand Up @@ -3475,10 +3488,6 @@ static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info,
if ((image_info->interlace == PlaneInterlace) ||
(image_info->interlace == PartitionInterlace))
(void) TIFFSetField(tiff,TIFFTAG_PLANARCONFIG,PLANARCONFIG_SEPARATE);
rows_per_strip=(uint32) image->rows;
option=GetImageOption(image_info,"tiff:rows-per-strip");
if (option != (const char *) NULL)
rows_per_strip=(size_t) strtol(option,(char **) NULL,10);
switch (compress_tag)
{
case COMPRESSION_JPEG:
Expand Down Expand Up @@ -3579,8 +3588,6 @@ static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info,
default:
break;
}
rows_per_strip=TIFFDefaultStripSize(tiff,rows_per_strip);
(void) TIFFSetField(tiff,TIFFTAG_ROWSPERSTRIP,rows_per_strip);
if ((image->resolution.x != 0.0) && (image->resolution.y != 0.0))
{
unsigned short
Expand Down
14 changes: 8 additions & 6 deletions coders/ttf.c
Expand Up @@ -245,19 +245,21 @@ static Image *ReadTTFImage(const ImageInfo *image_info,ExceptionInfo *exception)
break;
}
(void) CopyMagickString(image->magick,image_info->magick,MagickPathExtent);
(void) CopyMagickString(image->filename,image_info->filename,MagickPathExtent);
(void) CopyMagickString(image->filename,image_info->filename,
MagickPathExtent);
/*
Prepare drawing commands
*/
y=20;
draw_info=CloneDrawInfo(image_info,(DrawInfo *) NULL);
draw_info->font=AcquireString(image->filename);
ConcatenateString(&draw_info->primitive,"push graphic-context\n");
(void) FormatLocaleString(buffer,MagickPathExtent," viewbox 0 0 %.20g %.20g\n",
(double) image->columns,(double) image->rows);
(void) FormatLocaleString(buffer,MagickPathExtent,
" viewbox 0 0 %.20g %.20g\n",(double) image->columns,(double) image->rows);
ConcatenateString(&draw_info->primitive,buffer);
ConcatenateString(&draw_info->primitive," font-size 18\n");
(void) FormatLocaleString(buffer,MagickPathExtent," text 10,%.20g '",(double) y);
(void) FormatLocaleString(buffer,MagickPathExtent," text 10,%.20g '",
(double) y);
ConcatenateString(&draw_info->primitive,buffer);
text=EscapeString(Text,'"');
ConcatenateString(&draw_info->primitive,text);
Expand All @@ -269,8 +271,8 @@ static Image *ReadTTFImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
y+=i+12;
ConcatenateString(&draw_info->primitive," font-size 18\n");
(void) FormatLocaleString(buffer,MagickPathExtent," text 10,%.20g '%.20g'\n",
(double) y,(double) i);
(void) FormatLocaleString(buffer,MagickPathExtent,
" text 10,%.20g '%.20g'\n",(double) y,(double) i);
ConcatenateString(&draw_info->primitive,buffer);
(void) FormatLocaleString(buffer,MagickPathExtent," font-size %.20g\n",
(double) i);
Expand Down

0 comments on commit da02578

Please sign in to comment.