| @@ -298,7 +298,8 @@ tslead(Op *op, Page *p) · 297 unmodified lines |
| 298 | 298 | int d = arrayget(p->stack, 0)->num.d / 20; |
| 299 | 299 | while(d > 0){ |
| 300 | 300 | d -= 1; |
| 301 | | − fprint(1, "\n"); |
| 301 | + if(bufput(&p->buf, (uchar*)"\n", 1) == -1) |
| 302 | + sysfatal("OOM"); |
| 302 | 303 | } |
| 303 | 304 | USED(op, p); |
| 304 | 305 | return 0; |
| @@ -345,10 +346,13 @@ tpmove(Op *op, Page *p) · 40 unmodified lines |
| 345 | 346 | Object *x, *y; |
| 346 | 347 | x = arrayget(p->stack, 0); |
| 347 | 348 | y = arrayget(p->stack, 1); |
| 348 | | − if(y->num.d != 0) |
| 349 | | − fprint(1, "\n"); |
| 349 | + if(y->num.d != 0){ |
| 350 | + if(bufput(&p->buf, (uchar*)"\n", 1) == -1) |
| 351 | + sysfatal("OOM"); |
| 352 | + } |
| 350 | 353 | else if(x->num.d < 50) |
| 351 | | − fprint(1, " "); |
| 354 | + if(bufput(&p->buf, (uchar*)" ", 1) == -1) |
| 355 | + sysfatal("OOM"); |
| 352 | 356 | USED(op, p); |
| 353 | 357 | return 0; |
| 354 | 358 | } |
| @@ -364,7 +368,8 @@ static int · 9 unmodified lines |
| 364 | 368 | tpmove0(Op *op, Page *p) |
| 365 | 369 | { |
| 366 | 370 | USED(op, p); |
| 367 | | − fprint(1, "\n"); |
| 371 | + if(bufput(&p->buf, (uchar*)"\n", 1) == -1) |
| 372 | + sysfatal("OOM"); |
| 368 | 373 | return 0; |
| 369 | 374 | } |
| 370 | 375 | |
| @@ -383,10 +388,14 @@ thshowarr(Op *op, Page *p) · 12 unmodified lines |
| 383 | 388 | int i; |
| 384 | 389 | for(i = 0; i < arraylen(arr); i += 1){ |
| 385 | 390 | o = arrayget(arr, i); |
| 386 | | − if(o->type == Ostr) |
| 387 | | − fprint(1, "%s", o->str); |
| 388 | | − else if(o->num.d < -150) |
| 389 | | − fprint(1, " "); |
| 391 | + if(o->type == Ostr){ |
| 392 | + if(bufput(&p->buf, (uchar*)o->str, o->len) == -1) |
| 393 | + sysfatal("OOM"); |
| 394 | + } |
| 395 | + else if(o->num.d < -150){ |
| 396 | + if(bufput(&p->buf, (uchar*)" ", 1) == -1) |
| 397 | + sysfatal("OOM"); |
| 398 | + } |
| 390 | 399 | } |
| 391 | 400 | USED(op); |
| 392 | 401 | return 0; |
| @@ -905,7 +914,7 @@ opfind(Stream *s) · 512 unmodified lines |
| 905 | 914 | void |
| 906 | 915 | pageinit(Page *page) |
| 907 | 916 | { |
| 908 | | − page->text = nil; |
| 917 | + bufinit(&page->buf, 0, 0); |
| 909 | 918 | // Stack is per-content-stream, so we don't create it here |
| 910 | 919 | page->stack = nil; |
| 911 | 920 | } |
| @@ -913,7 +922,7 @@ pageinit(Page *page) · 1 unmodified line |
| 913 | 922 | void |
| 914 | 923 | pagefree(Page *p) |
| 915 | 924 | { |
| 916 | | − free(p->text); |
| 925 | + buffree(&p->buf); |
| 917 | 926 | pdfobjfree(p->stack); |
| 918 | 927 | } |
| 919 | 928 | |
| @@ -963,7 +972,8 @@ pagerendercontent(Page *p, Object *content) · 43 unmodified lines |
| 963 | 972 | } |
| 964 | 973 | } |
| 965 | 974 | } |
| 966 | | − fprint(1, "\n"); |
| 975 | + if(bufput(&p->buf, (uchar*)"\n", 1) == -1) |
| 976 | + sysfatal("OOM"); |
| 967 | 977 | Sclose(s); |
| 968 | 978 | } |
| 969 | 979 | |
| @@ -978,5 +988,5 @@ pagerender(Page *p, Object *o) · 8 unmodified lines |
| 978 | 988 | pagerendercontent(p, arrayget(content, i)); |
| 979 | 989 | else if(content->type != Onull) |
| 980 | 990 | pagerendercontent(p, content); |
| 981 | | − return 0; |
| 991 | + return 1; |
| 982 | 992 | } |