From 9d121972d02ad6b589442785d3f8614d60fef929 Mon Sep 17 00:00:00 2001
From: Pompolic <pompolic@special-circumstanc.es>
Date: Thu, 22 Jul 2021 18:41:18 +0200
Subject: [PATCH] Fix assert fail

- off by one error in for loop
- fix error introduced in previous commit (too many arguments to printf)
---
 pdf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pdf.c b/pdf.c
index 1e55c3f..b9b0c05 100644
--- a/pdf.c
+++ b/pdf.c
@@ -482,8 +482,8 @@ act_a85partial3group(const HParseResult *p, void *u)
 	// 2 bytes output
 	uint8_t *bytes = h_arena_malloc(p->arena, sizeof(uint8_t) * 2);
 
-	for (int i=0; i<4; i++) {
-		assert(digits[i]->token_type == TT_SEQUENCE); // XXX assert fails on test input A85(Hello, World!a) -> 87cURD_*#4DfTZ)+^k~>
+	for (int i=0; i<3; i++) {
+		assert(digits[i]->token_type == TT_SEQUENCE);
 		fourbytes = fourbytes * 85 + H_CAST_UINT(digits[i]->seq->elements[0]);
 	}
 
@@ -531,7 +531,7 @@ act_a85partial4group(const HParseResult *p, void *u)
 	bytes[1] = (fourbytes & 0x00FF0000) >> 16;
 	bytes[2] = (fourbytes & 0x0000FF00) >> 8;
 
-	fprintf(stdout, "act_a85partial4group: %4x (%d) ==> %2x %2x \n", fourbytes, fourbytes, bytes[0], bytes[1], bytes[2]); // XXX debug
+	fprintf(stdout, "act_a85partial4group: %4x (%d) ==> %2x %2x %2x\n", fourbytes, fourbytes, bytes[0], bytes[1], bytes[2]); // XXX debug
 
 	return H_MAKE_BYTES(bytes, 3);
 }
-- 
GitLab