shithub: pdffs

Download patch

ref: 173645da0f0143930ee7803f5a70e3d051727218
parent: 4b30ac15e8e98f7e8d6ccd130ad21890086a501e
author: Noam Preil <[email protected]>
date: Fri Apr 8 14:07:54 EDT 2022

gsstate: dictgen returns &null, not nil

--- a/op.c
+++ b/op.c
@@ -216,22 +216,22 @@
 {
 	char *name = arrayget(p->stack, 0)->name;
 	Object *gs, *o;
-	if((gs = dictget(dictget(dictget(p->obj, "Resources"), "ExtGState"), name)) == nil){
+	if((gs = dictget(dictget(dictget(p->obj, "Resources"), "ExtGState"), name)) == &null){
 		werrstr("extgstate dictionary not found: %s", name);
 		return 0;
 	}
-	if((o = dictget(gs, "Type")) != nil && strcmp(o->name, "ExtGState") != 0){
+	if((o = dictget(gs, "Type")) != &null && strcmp(o->name, "ExtGState") != 0){
 		werrstr("invalid type on ExtGState object: %s", o->name);
 		return 0;
 	}
-	if((o = dictget(gs, "LW")) != nil){
+	if((o = dictget(gs, "LW")) != &null){
 		if(o->type != Onum){
-			werrstr("line width must be a number");
+			werrstr("line width must be a number, %d", o->type);
 			return 0;
 		}
 		p->GSactive->LW = o->num.d;
 	}
-	if((o = dictget(gs, "LC")) != nil){
+	if((o = dictget(gs, "LC")) != &null){
 		if(o->type != Onum){
 			werrstr("line cap must be a number");
 			return 0;
@@ -238,7 +238,7 @@
 		}
 		p->GSactive->LC = o->num.i;
 	}
-	if((o = dictget(gs, "LJ")) != nil){
+	if((o = dictget(gs, "LJ")) != &null){
 		if(o->type != Onum){
 			werrstr("line join must be a number");
 			return 0;
@@ -245,7 +245,7 @@
 		}
 		p->GSactive->LJ = o->num.i;
 	}
-	if((o = dictget(gs, "ML")) != nil){
+	if((o = dictget(gs, "ML")) != &null){
 		if(o->type != Onum){
 			werrstr("miter limit must be a number");
 			return 0;