From f0ac1e5a7ec5853a23c490ef55e1665e61c78918 Mon Sep 17 00:00:00 2001 From: Michael Pfeiffer Date: Thu, 26 Sep 2002 23:26:46 +0000 Subject: [PATCH] Bug fix for HP PCL3 printer add-on. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1197 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/print/Printer.cpp | 24 ++++++++++-------------- src/servers/print/Printer.h | 2 +- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/servers/print/Printer.cpp b/src/servers/print/Printer.cpp index da58df4368..8f4b7a2f3a 100644 --- a/src/servers/print/Printer.cpp +++ b/src/servers/print/Printer.cpp @@ -358,7 +358,7 @@ void Printer::CloseJob() { fJob->Release(); } -status_t Printer::PrintSpooledJob(BFile* spoolFile, const BMessage& settings) +status_t Printer::PrintSpooledJob(BFile* spoolFile) { take_job_func_t func; image_id id; @@ -367,8 +367,13 @@ status_t Printer::PrintSpooledJob(BFile* spoolFile, const BMessage& settings) if ((rc=LoadPrinterAddon(id)) == B_OK) { // Addon was loaded, so try and get the take_job symbol if ((rc=get_image_symbol(id, "take_job", B_SYMBOL_TYPE_TEXT, (void**)&func)) == B_OK) { + // This seems to be required for legacy? + // HP PCL3 add-on crashes without it! + BMessage params('_RRC'); + params.AddInt32("file", (int32)spoolFile); + params.AddInt32("printer", (int32)&fNode); // call the function and check its result - BMessage* result = (*func)(spoolFile, &fNode, &settings); + BMessage* result = (*func)(spoolFile, &fNode, ¶ms); if (result == NULL || result->what == 'baad') rc = B_ERROR; } @@ -382,19 +387,10 @@ status_t Printer::PrintSpooledJob(BFile* spoolFile, const BMessage& settings) void Printer::PrintThread(Job* job) { fResource->Lock(); if (!fAbort) { - BFile jobFile(&job->EntryRef(), B_READ_ONLY); + BFile jobFile(&job->EntryRef(), B_READ_WRITE); print_file_header header; - BMessage settings; - - // Read header from filestream - jobFile.Seek(0, SEEK_SET); - jobFile.Read(&header, sizeof(header)); - - // Get the printer settings - settings.Unflatten(&jobFile); - - // and tell the printer to print the spooled job - if (PrintSpooledJob(&jobFile, settings) == B_OK) { + // Tell the printer to print the spooled job + if (PrintSpooledJob(&jobFile) == B_OK) { // Remove spool file if printing was successfull. job->Remove(); } else { diff --git a/src/servers/print/Printer.h b/src/servers/print/Printer.h index 53e95fba1a..90ad4953f2 100644 --- a/src/servers/print/Printer.h +++ b/src/servers/print/Printer.h @@ -105,7 +105,7 @@ private: bool FindSpooledJob(); void CloseJob(); - status_t PrintSpooledJob(BFile* spoolFile, const BMessage& settings); + status_t PrintSpooledJob(BFile* spoolFile); void PrintThread(Job* job); static status_t print_thread(void* data); status_t StartPrintThread();