summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-11-07 13:48:52 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-11-08 06:02:12 +0100
commitc049ac6503c0f0f6bb7170b68c19ccb400c525f7 (patch)
tree1c24a8d91ec6690dbf0eed5403d7b91cc52161ac
parent1f27c361531af17a13510deb86f0b8917d4d4276 (diff)
loplugin:fieldcast in CUPSManager
Change-Id: I97cf8b9dc0553b9771209bde3fd9ae0301012186 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159086 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--vcl/inc/unx/cupsmgr.hxx4
-rw-r--r--vcl/unx/generic/printer/cupsmgr.cxx12
2 files changed, 9 insertions, 7 deletions
diff --git a/vcl/inc/unx/cupsmgr.hxx b/vcl/inc/unx/cupsmgr.hxx
index 36d837d558b7..096efdea6e77 100644
--- a/vcl/inc/unx/cupsmgr.hxx
+++ b/vcl/inc/unx/cupsmgr.hxx
@@ -24,6 +24,8 @@
#include <osl/thread.h>
#include <osl/mutex.hxx>
+class cups_dest_s;
+
namespace psp
{
@@ -39,7 +41,7 @@ class CUPSManager final : public PrinterInfoManager
{
std::unordered_map< FILE*, OString, FPtrHash > m_aSpoolFiles;
int m_nDests;
- void* m_pDests;
+ cups_dest_s* m_pDests;
bool m_bNewDests;
std::unordered_map< OUString, int > m_aCUPSDestMap;
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index b81f630cd788..1fab7a172353 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -214,7 +214,7 @@ CUPSManager::~CUPSManager()
}
if (m_nDests && m_pDests)
- cupsFreeDests( m_nDests, static_cast<cups_dest_t*>(m_pDests) );
+ cupsFreeDests( m_nDests, m_pDests );
}
void CUPSManager::runDestThread( void* pThis )
@@ -325,7 +325,7 @@ void CUPSManager::initialize()
// introduced in dests with 1.2
// this is needed to check for %%IncludeFeature support
// (#i65684#, #i65491#)
- cups_dest_t* pDest = static_cast<cups_dest_t*>(m_pDests);
+ cups_dest_t* pDest = m_pDests;
rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
int nPrinter = m_nDests;
@@ -338,7 +338,7 @@ void CUPSManager::initialize()
// with the same name as a CUPS printer, overwrite it
while( nPrinter-- )
{
- pDest = static_cast<cups_dest_t*>(m_pDests)+nPrinter;
+ pDest = m_pDests+nPrinter;
OUString aPrinterName = OStringToOUString( pDest->name, aEncoding );
if( pDest->instance && *pDest->instance )
{
@@ -470,7 +470,7 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter )
m_aCUPSDestMap.find( aPrinter );
if( dest_it != m_aCUPSDestMap.end() )
{
- cups_dest_t* pDest = static_cast<cups_dest_t*>(m_pDests) + dest_it->second;
+ cups_dest_t* pDest = m_pDests + dest_it->second;
OString aPPDFile = threadedCupsGetPPD( pDest->name );
SAL_INFO("vcl.unx.print",
"PPD for " << aPrinter << " is " << aPPDFile);
@@ -890,7 +890,7 @@ bool CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTi
sJobName = OUStringToOString(rFaxNumber, aEnc);
}
- cups_dest_t* pDest = static_cast<cups_dest_t*>(m_pDests) + dest_it->second;
+ cups_dest_t* pDest = m_pDests + dest_it->second;
nJobID = cupsPrintFile(pDest->name,
it->second.getStr(),
sJobName.getStr(),
@@ -943,7 +943,7 @@ bool CUPSManager::checkPrintersChanged( bool bWait )
// there is no way to query CUPS whether the printer list has changed
// so get the dest list anew
if( m_nDests && m_pDests )
- cupsFreeDests( m_nDests, static_cast<cups_dest_t*>(m_pDests) );
+ cupsFreeDests( m_nDests, m_pDests );
m_nDests = 0;
m_pDests = nullptr;
runDests();