comparison src/dmgrowbuf.c @ 1707:a0986cfd6f9d

More consistently use DMGrowBuf in the lib64gfx APIs, and implement "backwards" RLE decoding and encoding (optionally regards input/output). Not tested very much yet, there may be bugs.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 05 Jun 2018 21:58:10 +0300
parents 311b14855a1e
children e40227e994e2
comparison
equal deleted inserted replaced
1706:311b14855a1e 1707:a0986cfd6f9d
216 { 216 {
217 if (!dmGrowBufRealloc(buf, nsize + buf->mingrow, TRUE)) 217 if (!dmGrowBufRealloc(buf, nsize + buf->mingrow, TRUE))
218 return FALSE; 218 return FALSE;
219 } 219 }
220 220
221 buf->len = nsize; 221 if (nsize > buf->len)
222 buf->len = nsize;
223
222 return TRUE; 224 return TRUE;
223 } 225 }
224 226
225 227
226 static void dmGrowBufUpdate(DMGrowBuf *buf) 228 static void dmGrowBufUpdate(DMGrowBuf *buf)