From 747867b9e257e38968df5ac0f8b4116046922909 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 3 Feb 2018 19:05:58 +0100 Subject: [PATCH] Load_IFF() translate comments, break in failed for loops --- src/fileformats.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/fileformats.c b/src/fileformats.c index b10ca2e3..6e2c1c87 100644 --- a/src/fileformats.c +++ b/src/fileformats.c @@ -867,9 +867,13 @@ printf("%d x %d = %d %d\n", tiny_width, tiny_height, tiny_width*tiny_height, s File_error=22; break; } - // Si temp_byte > 127 alors il faut répéter 256-'temp_byte' fois la couleur de l'octet suivant - // Si temp_byte <= 127 alors il faut afficher directement les 'temp_byte' octets suivants - if (temp_byte>127) + // temp_byte > 127 => repeat (256-temp_byte) the next byte + // temp_byte <= 127 => copy (temp_byte' + 1) bytes + if(temp_byte == 128) // 128 = NOP ! + { + Warning("NOP in packbits stream"); + } + else if (temp_byte>127) { if(Read_byte(IFF_file, &color)!=1) { @@ -878,15 +882,25 @@ printf("%d x %d = %d %d\n", tiny_width, tiny_height, tiny_width*tiny_height, s } b256=(short)(256-temp_byte); for (counter=0; counter<=b256; counter++) + { if (x_pos=line_size || Read_byte(IFF_file, &(buffer[x_pos++]))!=1) + { File_error=25; + break; + } + } } if (!File_error) {