shithub: pdffs

Download patch

ref: c1a1aefe63fa28941bf2fdb8f67950e43df83d32
parent: 71faea8a526080f9912ed7b0d14980246998ae4c
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Fri Aug 11 10:33:20 EDT 2023

more style

--- a/array.c
+++ b/array.c
@@ -68,7 +68,7 @@
 		return 0;
 	arr->array.e = a;
 	a[arr->array.ne] = o;
-	arr->array.ne += 1;
+	arr->array.ne++;
 	return 1;
 }
 
--- a/object.c
+++ b/object.c
@@ -37,7 +37,7 @@
 	int sz, c;
 	char buf[8];
 
-	for(sz = 0; sz < 7; sz += 1){
+	for(sz = 0; sz < 7; sz++){
 		c = Sgetc(s);
 		if(c < 0)
 			break;
--- a/op.c
+++ b/op.c
@@ -99,7 +99,7 @@
 	if(r == nil)
 		return 0;
 	p->GS = r;
-	p->nGS += 1;
+	p->nGS++;
 	p->GSactive = &p->GS[p->nGS - 1];
 	*(p->GSactive) = p->GS[p->nGS - 2];
 	if(p->GSactive->Font.widths != nil){
@@ -140,7 +140,7 @@
 {
 	double input[6];
 	int i;
-	for(i = 0; i < 6; i += 1)
+	for(i = 0; i < 6; i++)
 		input[i] = arrayget(p->stack, i)->num.d;
 	matmult(input, p->GSactive->CTM, p->GSactive->CTM);
 	return flagless(op);
@@ -368,7 +368,7 @@
 	char *s = arrayget(p->stack, 0)->name;
 	Object *o;
 	int i;
-	for(i = 0; i < 3; i += 1)
+	for(i = 0; i < 3; i++)
 		if(strcmp(s, colorspacedevices[i]) == 0){
 			*c = i;
 			*color = i == 2 ? 0xFF : 0;
@@ -426,7 +426,7 @@
 		p->GSactive->SCS = DeviceGray;
 	}
 	*color = 0;
-	for(i = 0; i < 3; i += 1)
+	for(i = 0; i < 3; i++)
 		*color = (*color | value) << 8;
 	*color |= 255;
 	return 1;
@@ -531,7 +531,7 @@
 	o = dictget(p->GSactive->Font.font, "Widths");
 	if(o == nil)
 		return 0;
-	for(i = 0; i < arraylen(o); i += 1)
+	for(i = 0; i < arraylen(o); i++)
 		p->GSactive->Font.widths[i] = arrayget(o, i)->num.i;
 	o = dictget(p->GSactive->Font.font, "FontDescriptor");
 	p->GSactive->Font.defwidth = dictget(o, "MissingWidth")->num.i;
@@ -618,7 +618,7 @@
 tpmatrix(Op *op, Page *p)
 {
 	int i;
-	for(i = 0; i < 6; i += 1){
+	for(i = 0; i < 6; i++){
 		p->TS.Tm[i] = arrayget(p->stack, i)->num.d;
 		p->TS.Tlm[i] = p->TS.Tm[i];
 	}
@@ -640,7 +640,7 @@
 	Object *o;
 	if(p->GSactive->Font.enc != nil){
 		len = arraylen(p->GSactive->Font.enc);
-		for(i = 0; i < len; i += 1){
+		for(i = 0; i < len; i++){
 			o = arrayget(p->GSactive->Font.enc, i);
 			if(o->type == Onum)
 				d = o->num.i;
@@ -715,7 +715,7 @@
 					return bufput(&p->buf, (uchar*)"→", strlen("→")) == strlen("→");
 				break;
 			} else
-				d += 1;
+				d++;
 		}
 	}
 	return bufput(&p->buf, (uchar*)&c, 1) == 1;
@@ -759,7 +759,7 @@
 	// Check if whitespace is needed
 	if(p->buf.sz > 1){
 		if(p->TS.y != Trm[5]){
-			for(i = 0; i < (int)((Trm[5] - p->TS.y) / p->GSactive->Font.size / 1.5) && i < 2; i += 1)
+			for(i = 0; i < (int)((Trm[5] - p->TS.y) / p->GSactive->Font.size / 1.5) && i < 2; i++)
 				if(bufput(&p->buf, (uchar*)"\n", 1) != 1)
 					return 0;
 		} else if(Trm[4] - p->TS.x > 5) {
@@ -795,7 +795,7 @@
 tstr(Page *p, char *str, ulong len)
 {
 	ulong i;
-	for(i = 0; i < len; i += 1)
+	for(i = 0; i < len; i++)
 		if(!tchar(p, str[i]))
 			return 0;
 	return 1;
@@ -821,7 +821,7 @@
 {
 	Object *o, *arr = arrayget(p->stack, 0);
 	int i;
-	for(i = 0; i < arraylen(arr); i += 1){
+	for(i = 0; i < arraylen(arr); i++){
 		o = arrayget(arr, i);
 		if(o->type == Ostr){
 			if(!tstr(p, o->str, o->len))
@@ -1341,7 +1341,7 @@
 		op = &ops[i];
 		if(strcmp(op->s, name) == 0)
 			return op;
-		i += 1;
+		i++;
 	}
 	return nil;
 }
@@ -1428,7 +1428,7 @@
 	int i;
 	if(p->GSactive != nil){
 		p->GSactive = nil;
-		for(i = 0; i < p->nGS; i += 1)
+		for(i = 0; i < p->nGS; i++)
 			gsfree(p->GS[i]);
 		free(p->GS);
 		p->GS = nil;
@@ -1468,7 +1468,7 @@
 		return 0;
 	while(s->buf.off != s->buf.sz){
 		while(isws(s->buf.b[s->buf.off]) && s->buf.off != s->buf.sz)
-			s->buf.off += 1;
+			s->buf.off++;
 		if(s->buf.off == s->buf.sz)
 			break;
 		o = pdfobj(content->pdf, s, 0);
@@ -1526,7 +1526,7 @@
 	memfillcolor(p->image, 0xFFFFFFFF);
 	content = dictget(p->obj, "Contents");
 	if(content->type == Oarray){
-		for(i = 0; i < arraylen(content); i += 1)
+		for(i = 0; i < arraylen(content); i++)
 			if(!pagerendercontent(p, arrayget(content, i)))
 				return 0;
 	}