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