if (GD_drawing(g)->dpi != 0) {
job->dpi.x = job->dpi.y = (double)(GD_drawing(g)->dpi);
}
- else if (firstjob->device_sets_dpi) {
+ else if (firstjob && firstjob->device_sets_dpi) {
job->dpi = firstjob->device_dpi; /* some devices set dpi in initialize() */
}
else {
/* if we already have an active job list and the device doesn't support mutiple output files, or we are about to write to a different output device */
firstjob = gvc->active_jobs;
- if (firstjob
- && (!(firstjob->flags & GVDEVICE_DOES_PAGES)
- || (strcmp(job->output_langname,firstjob->output_langname)))) {
+ if (firstjob) {
+ if (! (firstjob->flags & GVDEVICE_DOES_PAGES)
+ || (strcmp(job->output_langname,firstjob->output_langname))) {
- gvrender_end_job(firstjob);
- gvdevice_finalize(firstjob); /* finalize previous jobs */
+ gvrender_end_job(firstjob);
+ gvdevice_finalize(firstjob); /* finalize previous jobs */
- gvc->active_jobs = NULL; /* clear active list */
- gvc->common.viewNum = 0;
+ gvc->active_jobs = NULL; /* clear active list */
+ gvc->common.viewNum = 0;
+ prevjob = NULL;
+ }
+ }
+ else {
prevjob = NULL;
}
{
int rc;
GVJ_t *job;
- GVJ_t *firstjob;
g = g->root;
if (out == NULL)
job->flags |= OUTPUT_NOT_REQUIRED;
gvRenderJobs(gvc, g);
- firstjob = gvc->active_jobs;
- if (firstjob) {
- gvrender_end_job(firstjob);
- gvdevice_finalize(firstjob);
- }
+ gvrender_end_job(job);
+ gvdevice_finalize(job);
+ fflush(job->output_file);
gvjobs_delete(gvc);
return 0;
{
int rc;
GVJ_t *job;
- GVJ_t *firstjob;
g = g->root;
}
gvjobs_output_filename(gvc, filename);
gvRenderJobs(gvc, g);
- firstjob = gvc->active_jobs;
- if (firstjob) {
- gvrender_end_job(firstjob);
- gvdevice_finalize(firstjob);
- }
+ gvrender_end_job(job);
+ gvdevice_finalize(job);
+ fflush(job->output_file);
gvjobs_delete(gvc);
return 0;