logo alternatiu opcional

This commit is contained in:
2026-04-05 14:35:53 +02:00
parent 00f8d6d7e3
commit ec0f233033
7 changed files with 196 additions and 37 deletions

23
source/external/gif.h vendored
View File

@@ -256,8 +256,9 @@ void uncompress( int code_length,
}
}
static int read_sub_blocks( unsigned char* buffer, unsigned char **data )
static int read_sub_blocks( unsigned char** buf_ptr, unsigned char **data )
{
unsigned char* buffer = *buf_ptr;
int data_length;
int index;
unsigned char block_size;
@@ -286,6 +287,7 @@ static int read_sub_blocks( unsigned char* buffer, unsigned char **data )
index += block_size;
}
*buf_ptr = buffer;
return data_length;
}
@@ -311,7 +313,7 @@ unsigned char* process_image_descriptor( unsigned char* buffer,
READ(&lzw_code_size, 1);
compressed_data_length = read_sub_blocks( buffer, &compressed_data );
compressed_data_length = read_sub_blocks( &buffer, &compressed_data );
// width = image_descriptor.image_width;
// height = image_descriptor.image_height;
@@ -330,8 +332,9 @@ unsigned char* process_image_descriptor( unsigned char* buffer,
return uncompressed_data;
}
static int process_extension( unsigned char* buffer )
static int process_extension( unsigned char** buf_ptr )
{
unsigned char* buffer = *buf_ptr;
extension_t extension;
graphic_control_extension_t gce;
application_extension_t application;
@@ -364,11 +367,12 @@ static int process_extension( unsigned char* buffer )
// All extensions are followed by data sub-blocks; even if it's
// just a single data sub-block of length 0
extension_data_length = read_sub_blocks( buffer, &extension_data );
extension_data_length = read_sub_blocks( &buffer, &extension_data );
if ( extension_data != NULL )
free( extension_data );
*buf_ptr = buffer;
return 1;
}
@@ -416,12 +420,13 @@ static unsigned char* process_gif_stream(unsigned char *buffer, unsigned short*
READ(header, 6);
header[ 6 ] = 0x0;
// XXX there's another format, GIF87a, that you may still find
// floating around.
if ( strcmp( "GIF89a", (char*)header ) )
// Accept both GIF89a and GIF87a (89a is a superset; the blocks this
// loader parses — LZW image data and palette — are identical in 87a).
if ( strcmp( "GIF89a", (char*)header ) != 0 &&
strcmp( "GIF87a", (char*)header ) != 0 )
{
fprintf( stderr,
"Invalid GIF file (header is '%s', should be 'GIF89a')\n",
"Invalid GIF file (header is '%s', should be 'GIF89a' or 'GIF87a')\n",
header );
return NULL;
}
@@ -462,7 +467,7 @@ static unsigned char* process_gif_stream(unsigned char *buffer, unsigned short*
color_resolution_bits);
break;
case EXTENSION_INTRODUCER:
if ( !process_extension( buffer ) )
if ( !process_extension( &buffer ) )
{
return NULL;
}