shithub: riscv

Download patch

ref: b6b5fd6da79aff13f7ebded1ae49124743411271
parent: 31a6f6c83db8e845bc5bf2f0927685a6c2bdfdb2
author: cinap_lenrek <[email protected]>
date: Mon May 16 01:35:22 EDT 2016

jpg: output partial image data when available (truncated files)

--- a/sys/src/cmd/jpg/readjpg.c
+++ b/sys/src/cmd/jpg/readjpg.c
@@ -226,9 +226,9 @@
 	va_start(arg, fmt);
 	vseprint(h->err, h->err+sizeof h->err, fmt, arg);
 	va_end(arg);
-
+	if(h->image != nil)
+		fprint(2, "jpg: partial image: %s\n", h->err);
 	werrstr("%s", h->err);
-	jpgfreeall(h, 1);
 	longjmp(h->errlab, 1);
 }
 
@@ -258,7 +258,7 @@
 	h->fd = b;
 	errstr(buf, sizeof buf);	/* throw it away */
 	if(setjmp(h->errlab))
-		r = nil;
+		r = h->image;
 	else
 		r = readslave(h, colorspace);
 	jpgfreeall(h, 0);