From aa154690151b8d3d5701f76c64742db4f6212dc1 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 18 Jan 2020 00:50:23 +0100 Subject: [PATCH] simplify GIF_empty_buffer() --- src/giformat.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/giformat.c b/src/giformat.c index 92bbacd1..96aefbd0 100644 --- a/src/giformat.c +++ b/src/giformat.c @@ -774,16 +774,14 @@ void Load_GIF(T_IO_Context * context) /// Flush the buffer static void GIF_empty_buffer(FILE * file, T_GIF_context *gif, byte * GIF_buffer) { - word index; - if (gif->remainder_byte) { GIF_buffer[0] = gif->remainder_byte; - for (index = 0; index <= gif->remainder_byte; index++) - Write_one_byte(file, GIF_buffer[index]); + if (!Write_bytes(file, GIF_buffer, (size_t)gif->remainder_byte + 1)) + 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))) { - setvbuf(GIF_file, NULL, _IOFBF, 64*1024); - // On écrit la signature du fichier if (Write_bytes(GIF_file,"GIF89a",6)) {