Branch: Tag:

2007-12-12

2007-12-12 15:45:21 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Now uses a temporary backend instead of the default backend.

Rev: lib/modules/_Image_PS.pmod:1.14

166:    fd->close();    fd4->close();    -  // FIXME: Create a new backend instead of using the default. +  // Backend to use. +  Pike.Backend be = Pike.Backend();       // Kill the gs binary after 30 seconds in case it hangs. -  mixed co = call_out(lambda(Process.Process pid) { +  mixed co = +  be->call_out(lambda(Process.Process pid) {    if (!pid->status()) {    pid->kill(9);    }
178:    {    if(!has_value(data, "showpage"))    data += "\nshowpage\n"; +  be->add_file(fd2);    Stdio.sendfile(({ data }), 0, 0, sizeof(data), 0, fd2,    lambda(int n) {    fd2->close();
186:    fd2->close();    }    string output = ""; +  be->add_file(fd3);    fd3->set_nonblocking(lambda(mixed ignored, string s) {    output += s;    }, 0,
195:    });    mixed err = catch {    while (fd3) { -  Pike.DefaultBackend(1.0); +  be(1.0);    }    };   #if 0
203: Inside #if 0
   werror("Backend failed: %s\n", describe_backtrace(err));    }   #endif -  remove_call_out(co); +  be->remove_call_out(co);    int ret_code = pid->wait();    if(ret_code)    error("Ghostscript failed with exit code: %O:\n%s\n", ret_code, output);
211:       if (data) {    -  if(data && sscanf(data, "%*s\n%%%%BoundingBox: %s\n", string bbox) == 2 && !options->eps_crop) +  if(data && sscanf(data, "%*s\n%%%%BoundingBox: %s\n", string bbox) == 2 && +  !options->eps_crop)    {    int x0,x1,y0,y1;    sscanf(bbox, "%d %d %d %d", x0,y0,x1,y1 );