History

fix tons of bugs, use proper streaming

Sigrid Haflínudóttir committed 6 years ago

Commit 2ff084d1 parent 474117e16 files · +502 −344Browse files

Showing the changes to array.c (1 of 16 files). Show all

Unified · Split

array.c+8−7
@@ -1,12 +1,11 @@
11 #include <u.h>
22 #include <libc.h>
3−#include <bio.h>
43 #include "pdf.h"
54
65 /* 7.3.6 Array Objects */
76
87 Object *
9−pdfarray(Pdf *pdf, Biobuf *b)
8+pdfarray(Pdf *pdf, Stream *s)
109 {
1110 Object *o, *m;
1211 Object **a;
@@ -15,18 +14,18 @@ pdfarray(Pdf *pdf, Biobuf *b) · 2 unmodified lines
1514 o = calloc(1, sizeof(*o));
1615 o->pdf = pdf;
1716 o->type = Oarray;
18− Bgetc(b); /* throw away '[' */
17+ Sgetc(s); /* throw away '[' */
1918
2019 for(noel = 0;;){
21− if((c = Bgetc(b)) < 0 || c == ']')
20+ if((c = Sgetc(s)) < 0 || c == ']')
2221 break;
2322 if(noel){
2423 werrstr("no ']'");
2524 goto err;
2625 }
2726
28− Bungetc(b);
29− if((m = pdfobj(pdf, b)) == nil){
27+ Sungetc(s);
28+ if((m = pdfobj(pdf, s)) == nil){
3029 noel = 1;
3130 continue;
3231 }
@@ -65,7 +64,9 @@ arrayget(Object *o, int i) · 32 unmodified lines
6564 {
6665 if(arraylen(o) <= i)
6766 sysfatal("array: indexing out of range");
68− return o->type == Oarray ? o->array.e[i] : o;
67+ o = o->type == Oarray ? o->array.e[i] : o;
68+
69+ return pdfeval(&o);
6970 }
7071
7172 int

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t