From d899cb6ddd3077f063c50ad75cd9a874500ac421 Mon Sep 17 00:00:00 2001
From: Pompolic <pompolic@special-circumstanc.es>
Date: Mon, 14 Mar 2022 18:18:25 +0100
Subject: [PATCH] Error messages should go to stderr

Stdout is meant to produce a JSON output, inserting error messages would break it
---
 pdf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pdf.c b/pdf.c
index 89b8a81..01ebf57 100644
--- a/pdf.c
+++ b/pdf.c
@@ -3011,7 +3011,7 @@ parse_objstm_obj(struct Env *aux, size_t nr, size_t stm_nr, size_t idx)
 	}
 
 	if ((stm = ent->obj) == NULL) {
-		fprintf(stdout, "%s: error parsing object stream at position "
+		fprintf(stderr, "%s: error parsing object stream at position "
 		    "%zu (%#zx)\n", aux->infile, ent->n.offs, ent->n.offs);
 		return NULL;
 	}
@@ -5180,7 +5180,7 @@ p_stream_data__m(HAllocator *mm__, const Dict *dict, struct Env *aux)
 		 */
 		v = dictentry(dict, "Subtype");
 		if (v == NULL) {
-			fprintf(stdout, "\nFailed to parse Subtype of XObject in dictionary");
+			fprintf(stderr, "\nFailed to parse Subtype of XObject in dictionary");
 			return (NULL);
 		}
 		if (bytes_eq(v->bytes, "Form")) {
-- 
GitLab