Showing the changes to array.c (1 of 16 files). Show all
Unified · Split
| @@ -1,12 +1,11 @@ | |||
| 1 | #include <u.h> | 1 | #include <u.h> |
| 2 | #include <libc.h> | 2 | #include <libc.h> |
| 3 | #include <bio.h> | ||
| 4 | #include "pdf.h" | 3 | #include "pdf.h" |
| 5 | 4 | ||
| 6 | /* 7.3.6 Array Objects */ | 5 | /* 7.3.6 Array Objects */ |
| 7 | 6 | ||
| 8 | Object * | 7 | Object * |
| 9 | pdfarray(Pdf *pdf, Biobuf *b) | 8 | pdfarray(Pdf *pdf, Stream *s) |
| 10 | { | 9 | { |
| 11 | Object *o, *m; | 10 | Object *o, *m; |
| 12 | Object **a; | 11 | Object **a; |
| @@ -15,18 +14,18 @@ pdfarray(Pdf *pdf, Biobuf *b) · 2 unmodified lines | |||
| 15 | o = calloc(1, sizeof(*o)); | 14 | o = calloc(1, sizeof(*o)); |
| 16 | o->pdf = pdf; | 15 | o->pdf = pdf; |
| 17 | o->type = Oarray; | 16 | o->type = Oarray; |
| 18 | Bgetc(b); /* throw away '[' */ | 17 | Sgetc(s); /* throw away '[' */ |
| 19 | 18 | ||
| 20 | for(noel = 0;;){ | 19 | for(noel = 0;;){ |
| 21 | if((c = Bgetc(b)) < 0 || c == ']') | 20 | if((c = Sgetc(s)) < 0 || c == ']') |
| 22 | break; | 21 | break; |
| 23 | if(noel){ | 22 | if(noel){ |
| 24 | werrstr("no ']'"); | 23 | werrstr("no ']'"); |
| 25 | goto err; | 24 | goto err; |
| 26 | } | 25 | } |
| 27 | 26 | ||
| 28 | Bungetc(b); | 27 | Sungetc(s); |
| 29 | if((m = pdfobj(pdf, b)) == nil){ | 28 | if((m = pdfobj(pdf, s)) == nil){ |
| 30 | noel = 1; | 29 | noel = 1; |
| 31 | continue; | 30 | continue; |
| 32 | } | 31 | } |
| @@ -65,7 +64,9 @@ arrayget(Object *o, int i) · 32 unmodified lines | |||
| 65 | { | 64 | { |
| 66 | if(arraylen(o) <= i) | 65 | if(arraylen(o) <= i) |
| 67 | sysfatal("array: indexing out of range"); | 66 | 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); | ||
| 69 | } | 70 | } |
| 70 | 71 | ||
| 71 | int | 72 | int |