comparison tools/libgfx.c @ 1900:8c6040d5b930

Fix IFF chunk padding.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 26 Jun 2018 04:46:49 +0300
parents 54baa688425b
children 636d3c8bcd35
comparison
equal deleted inserted replaced
1899:54baa688425b 1900:8c6040d5b930
1929 off_t curr = dmftell(fp); 1929 off_t curr = dmftell(fp);
1930 if (curr < 0) 1930 if (curr < 0)
1931 return dmferror(fp); 1931 return dmferror(fp);
1932 1932
1933 chunk->size = curr - chunk->offs - (sizeof(Uint32) * 2); 1933 chunk->size = curr - chunk->offs - (sizeof(Uint32) * 2);
1934 if ((chunk->size & 1) && !dmf_write_byte(fp, 0)) 1934 if (chunk->size & 1)
1935 return dmferror(fp); 1935 {
1936 if (!dmf_write_byte(fp, 0))
1937 return dmferror(fp);
1938
1939 chunk->size++;
1940 }
1936 1941
1937 if (dmfseek(fp, chunk->offs, SEEK_SET) < 0) 1942 if (dmfseek(fp, chunk->offs, SEEK_SET) < 0)
1938 return dmferror(fp); 1943 return dmferror(fp);
1939 1944
1940 if (!dmf_write_be32(fp, chunk->id) || 1945 if (!dmf_write_be32(fp, chunk->id) ||