Skip to content

Commit b70bcb2

Browse files
author
Cristy
committed
revert
1 parent 4a52f91 commit b70bcb2

1 file changed

Lines changed: 14 additions & 20 deletions

File tree

coders/tiff.c

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -682,21 +682,15 @@ static MagickBooleanType TIFFSetImageProperties(TIFF *tiff,Image *image,
682682
const char *tag)
683683
{
684684
char
685-
filename[MagickPathExtent],
686-
*line = (char *) NULL;
685+
buffer[MagickPathExtent],
686+
filename[MagickPathExtent];
687687

688688
FILE
689689
*file;
690690

691691
int
692692
unique_file;
693693

694-
size_t
695-
length;
696-
697-
ssize_t
698-
count;
699-
700694
/*
701695
Set EXIF or GPS image properties.
702696
*/
@@ -707,29 +701,29 @@ static MagickBooleanType TIFFSetImageProperties(TIFF *tiff,Image *image,
707701
if ((unique_file == -1) || (file == (FILE *) NULL))
708702
{
709703
(void) RelinquishUniqueFileResource(filename);
710-
(void) ThrowMagickException(&image->exception,GetMagickModule(),
711-
FileOpenError,"UnableToCreateTemporaryFile","`%s'",filename);
704+
(void) ThrowMagickException(&image->exception,GetMagickModule(),WandError,
705+
"UnableToCreateTemporaryFile","`%s'",filename);
712706
return(MagickFalse);
713707
}
714708
TIFFPrintDirectory(tiff,file,0);
715709
(void) fseek(file,0,SEEK_SET);
716-
while ((count=getline(&line,&length,file)) != -1)
710+
while (fgets(buffer,(int) sizeof(buffer),file) != NULL)
717711
{
718712
char
719713
*p,
720-
property[MagickPathExtent];
714+
property[MagickPathExtent],
715+
value[MagickPathExtent];
721716

722-
(void) StripString(line);
723-
p=strchr(line,':');
717+
StripString(buffer);
718+
p=strchr(buffer,':');
724719
if (p == (char *) NULL)
725720
continue;
726-
*p++='\0';
727-
(void) FormatLocaleString(property,MagickPathExtent,"%s%s",tag,line);
728-
(void) StripString(p);
729-
(void) SetImageProperty(image,property,p);
721+
*p='\0';
722+
(void) FormatLocaleString(property,MagickPathExtent,"%s%s",tag,buffer);
723+
(void) FormatLocaleString(value,MagickPathExtent,"%s",p+1);
724+
StripString(value);
725+
(void) SetImageProperty(image,property,value);
730726
}
731-
if (line != (char *) NULL)
732-
free(line);
733727
(void) fclose(file);
734728
(void) RelinquishUniqueFileResource(filename);
735729
return(MagickTrue);

0 commit comments

Comments
 (0)