simplify GIF_empty_buffer()

This commit is contained in:
Thomas Bernard 2020-01-18 00:50:23 +01:00
parent 550da692f8
commit aa15469015
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -774,14 +774,12 @@ void Load_GIF(T_IO_Context * context)
/// Flush the buffer /// Flush the buffer
static void GIF_empty_buffer(FILE * file, T_GIF_context *gif, byte * GIF_buffer) static void GIF_empty_buffer(FILE * file, T_GIF_context *gif, byte * GIF_buffer)
{ {
word index;
if (gif->remainder_byte) if (gif->remainder_byte)
{ {
GIF_buffer[0] = gif->remainder_byte; GIF_buffer[0] = gif->remainder_byte;
for (index = 0; index <= gif->remainder_byte; index++) if (!Write_bytes(file, GIF_buffer, (size_t)gif->remainder_byte + 1))
Write_one_byte(file, GIF_buffer[index]); File_error = 1;
gif->remainder_byte = 0; gif->remainder_byte = 0;
} }
@ -875,8 +873,6 @@ void Save_GIF(T_IO_Context * context)
if ((GIF_file=Open_file_write(context))) if ((GIF_file=Open_file_write(context)))
{ {
setvbuf(GIF_file, NULL, _IOFBF, 64*1024);
// On écrit la signature du fichier // On écrit la signature du fichier
if (Write_bytes(GIF_file,"GIF89a",6)) if (Write_bytes(GIF_file,"GIF89a",6))
{ {