layout fixes for tga sniff
This commit is contained in:
parent
b3ff4d9ed6
commit
fef024061f
@ -52,14 +52,15 @@
|
|||||||
|
|
||||||
#if defined(HAVE_MAGICK6) || defined(HAVE_MAGICK7)
|
#if defined(HAVE_MAGICK6) || defined(HAVE_MAGICK7)
|
||||||
|
|
||||||
/* ImageMagick can't detect some formats, like ICO and TGA, by examining the contents --
|
/* ImageMagick can't detect some formats, like ICO and TGA, by examining the
|
||||||
* ico.c and tga.c simply do not have recognisers.
|
* contents -- ico.c and tga.c simply do not have recognisers.
|
||||||
*
|
*
|
||||||
* For these formats, do the detection ourselves.
|
* For these formats, do the detection ourselves.
|
||||||
* Return an IM format specifier, or NULL to let IM do the detection.
|
* Return an IM format specifier, or NULL to let IM do the detection.
|
||||||
*
|
*
|
||||||
* For sniffing TGAs, we check that there is at least enough room for the header and that
|
* For sniffing TGAs, we check that there is at least enough room for the
|
||||||
* the preamble contains valid values:
|
* header and that the preamble contains valid values:
|
||||||
|
*
|
||||||
* -----------------------------------------------------------
|
* -----------------------------------------------------------
|
||||||
* |0x00 | 0-255 idlength, skip |
|
* |0x00 | 0-255 idlength, skip |
|
||||||
* |0x01 | 0-1, color map present |
|
* |0x01 | 0-1, color map present |
|
||||||
@ -80,16 +81,18 @@ magick_sniff( const unsigned char *bytes, size_t length )
|
|||||||
bytes[2] == 1 &&
|
bytes[2] == 1 &&
|
||||||
bytes[3] == 0 )
|
bytes[3] == 0 )
|
||||||
return( "ICO" );
|
return( "ICO" );
|
||||||
if( length >= 18 &&
|
|
||||||
(bytes[1] == 0 || bytes[1] == 1) && (
|
if( length >= 18 &&
|
||||||
bytes[2] == 0 ||
|
(bytes[1] == 0 ||
|
||||||
bytes[2] == 1 ||
|
bytes[1] == 1) &&
|
||||||
bytes[2] == 2 ||
|
(bytes[2] == 0 ||
|
||||||
bytes[2] == 3 ||
|
bytes[2] == 1 ||
|
||||||
bytes[2] == 9 ||
|
bytes[2] == 2 ||
|
||||||
bytes[2] == 10 ||
|
bytes[2] == 3 ||
|
||||||
bytes[2] == 11) )
|
bytes[2] == 9 ||
|
||||||
return( "TGA" );
|
bytes[2] == 10 ||
|
||||||
|
bytes[2] == 11) )
|
||||||
|
return( "TGA" );
|
||||||
|
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user