commit 3cf1b4df68d92b6d8a7fe38dee882721530ab968
parent 66589683f26a2619859ad6755953a9c27334b5fe
Author: Remy Noulin <loader2x@gmail.com>
Date: Sat, 8 Sep 2018 12:08:19 +0200
update zrle for current libsheepy (fix compilation errors)
package.yml | 2 +-
zrle.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
Diffstat:
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/package.yml b/package.yml
@@ -1,6 +1,6 @@
---
name: zrle
- version: 0.0.3
+ version: 0.0.4
description: "Compress zeros using Run Length Encoding"
bin: ./zrle.c
cflags: -O3 -std=gnu11 -fPIC -pipe
diff --git a/zrle.c b/zrle.c
@@ -62,9 +62,10 @@ zrlebuft zrle(void *buf, size_t len) {
}
else {
// when count is less 3, write 0 in compressed buffer
- if (zcount < 3)
+ if (zcount < 3) {
range(j, zcount)
r.buf[dst++] = 0;
+ }
// when count is 3, write 0xfe in compressed buffer
else if (zcount == 3)
r.buf[dst++] = 0xfe;
@@ -119,9 +120,10 @@ zrlebuft zrle(void *buf, size_t len) {
// when state is ZCOUNT at the end, write last zero string
if (state == ZCOUNT) {
// when count is less 3, write 0 in compressed buffer
- if (zcount < 3)
+ if (zcount < 3) {
range(j, zcount)
r.buf[dst++] = 0;
+ }
// when count is 3, write 0xfe in compressed buffer
else if (zcount == 3)
r.buf[dst++] = 0xfe;