From 2dae70268e8f53b11301c4c8490efea57b0cc51c Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 9 Jan 2014 23:09:12 +0100 Subject: [PATCH] every even numbered print job is reported as failed because of. bool bSuccess; ... bSuccess &= ...endSpool(...); in PspSalPrinter::StartJob was... endSpool return value is effectively success flag, not job ID (cherry picked from commit e6323214830895d1c76ec44ee53990bf577fbda2) Change-Id: I5b96eeff80ca29f0f8f24ee6da7a2ca76cbb05ce --- include/vcl/printerinfomanager.hxx | 4 ++-- vcl/generic/print/printerjob.cxx | 2 +- vcl/inc/cupsmgr.hxx | 2 +- vcl/null/printerinfomanager.cxx | 2 +- vcl/unx/generic/printer/cupsmgr.cxx | 4 ++-- vcl/unx/generic/printer/printerinfomanager.cxx | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/vcl/printerinfomanager.hxx b/include/vcl/printerinfomanager.hxx index 96e7846..7e3ccd6 100644 --- a/include/vcl/printerinfomanager.hxx +++ b/include/vcl/printerinfomanager.hxx @@ -211,8 +211,8 @@ public: // close the FILE* returned by startSpool and does the actual spooling // set bBanner to "false" will attempt to suppress banner printing // set bBanner to "true" will rely on the system default - // returns a numerical job id - virtual int endSpool( const OUString& rPrinterName, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner ); + // returns true on success + virtual bool endSpool( const OUString& rPrinterName, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner ); // for spadmin: whether adding or removing a printer is possible virtual bool addOrRemovePossible() const; diff --git a/vcl/generic/print/printerjob.cxx b/vcl/generic/print/printerjob.cxx index 7c1b359..f611c26 100644 --- a/vcl/generic/print/printerjob.cxx +++ b/vcl/generic/print/printerjob.cxx @@ -530,7 +530,7 @@ PrinterJob::EndJob () else { PrinterInfoManager& rPrinterInfoManager = PrinterInfoManager::get(); - if (0 == rPrinterInfoManager.endSpool( m_aLastJobData.m_aPrinterName, + if (!rPrinterInfoManager.endSpool( m_aLastJobData.m_aPrinterName, maJobTitle, pDestFILE, m_aDocumentJobData, true )) { bSuccess = sal_False; diff --git a/vcl/inc/cupsmgr.hxx b/vcl/inc/cupsmgr.hxx index 8c659fe..a8c06bb 100644 --- a/vcl/inc/cupsmgr.hxx +++ b/vcl/inc/cupsmgr.hxx @@ -78,7 +78,7 @@ public: const char* authenticateUser( const char* ); virtual FILE* startSpool( const OUString& rPrinterName, bool bQuickCommand ); - virtual int endSpool( const OUString& rPrinterName, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner ); + virtual bool endSpool( const OUString& rPrinterName, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner ); virtual void setupJobContextData( JobData& rData ); /// changes the info about a named printer diff --git a/vcl/null/printerinfomanager.cxx b/vcl/null/printerinfomanager.cxx index a480856..4845ec3 100644 --- a/vcl/null/printerinfomanager.cxx +++ b/vcl/null/printerinfomanager.cxx @@ -147,7 +147,7 @@ FILE* PrinterInfoManager::startSpool( const OUString& /* rPrintername */, bool / return NULL; } -int PrinterInfoManager::endSpool( const OUString& /*rPrintername*/, const OUString& /*rJobTitle*/, FILE* /* pFile */, const JobData& /*rDocumentJobData*/, bool /*bBanner*/ ) +bool PrinterInfoManager::endSpool( const OUString& /*rPrintername*/, const OUString& /*rJobTitle*/, FILE* /* pFile */, const JobData& /*rDocumentJobData*/, bool /*bBanner*/ ) { return true; } diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index 069df7d..ecf44e7 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -640,7 +640,7 @@ void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner } } -int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner ) +bool CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner ) { OSL_TRACE( "endSpool: %s, %s, copy count = %d", OUStringToOString( rPrintername, RTL_TEXTENCODING_UTF8 ).getStr(), @@ -699,7 +699,7 @@ int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTit cupsFreeOptions( nNumOptions, pOptions ); } - return nJobID; + return nJobID != 0; } diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index 4f8f56e..45b9f62 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -1117,7 +1117,7 @@ FILE* PrinterInfoManager::startSpool( const OUString& rPrintername, bool bQuickC return popen (aShellCommand.getStr(), "w"); } -int PrinterInfoManager::endSpool( const OUString& /*rPrintername*/, const OUString& /*rJobTitle*/, FILE* pFile, const JobData& /*rDocumentJobData*/, bool /*bBanner*/ ) +bool PrinterInfoManager::endSpool( const OUString& /*rPrintername*/, const OUString& /*rJobTitle*/, FILE* pFile, const JobData& /*rDocumentJobData*/, bool /*bBanner*/ ) { return (0 == pclose( pFile )); } -- 1.9.0