From 27ec6a8ef39e95a7094503aa3036f268f62408ad Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 7 Oct 2015 12:05:17 +0200 Subject: Sane::SetOptionValue return values are unused Change-Id: Ie9310be6508fe828ca1ef36372d56596a02085aa --- extensions/source/scanner/sane.cxx | 43 +++++++++++++------------------------- extensions/source/scanner/sane.hxx | 8 +++---- 2 files changed, 18 insertions(+), 33 deletions(-) (limited to 'extensions') diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx index e95446af369a..d2d3e4ba655d 100644 --- a/extensions/source/scanner/sane.cxx +++ b/extensions/source/scanner/sane.cxx @@ -410,46 +410,37 @@ bool Sane::GetOptionValue( int n, double* pSet ) return true; } -bool Sane::SetOptionValue( int n, bool bSet ) +void Sane::SetOptionValue( int n, bool bSet ) { if( ! maHandle || mppOptions[n]->type != SANE_TYPE_BOOL ) - return false; + return; SANE_Word nRet = bSet ? SANE_TRUE : SANE_FALSE; - SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, &nRet ); - if( nStatus != SANE_STATUS_GOOD ) - return false; - return true; + ControlOption( n, SANE_ACTION_SET_VALUE, &nRet ); } -bool Sane::SetOptionValue( int n, const OUString& rSet ) +void Sane::SetOptionValue( int n, const OUString& rSet ) { if( ! maHandle || mppOptions[n]->type != SANE_TYPE_STRING ) - return false; + return; OString aSet(OUStringToOString(rSet, osl_getThreadTextEncoding())); - SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, const_cast(aSet.getStr()) ); - if( nStatus != SANE_STATUS_GOOD ) - return false; - return true; + ControlOption( n, SANE_ACTION_SET_VALUE, const_cast(aSet.getStr()) ); } -bool Sane::SetOptionValue( int n, double fSet, int nElement ) +void Sane::SetOptionValue( int n, double fSet, int nElement ) { - bool bSuccess = false; - if( ! maHandle || ( mppOptions[n]->type != SANE_TYPE_INT && mppOptions[n]->type != SANE_TYPE_FIXED ) ) - return false; + return; - SANE_Status nStatus; if( mppOptions[n]->size/sizeof(SANE_Word) > 1 ) { std::unique_ptr pSet(new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]); - nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pSet.get() ); + SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pSet.get() ); if( nStatus == SANE_STATUS_GOOD ) { pSet[nElement] = mppOptions[n]->type == SANE_TYPE_INT ? (SANE_Word)fSet : SANE_FIX( fSet ); - nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, pSet.get() ); + ControlOption( n, SANE_ACTION_SET_VALUE, pSet.get() ); } } else @@ -458,18 +449,15 @@ bool Sane::SetOptionValue( int n, double fSet, int nElement ) mppOptions[n]->type == SANE_TYPE_INT ? (SANE_Word)fSet : SANE_FIX( fSet ); - nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, &nSetTo ); - if( nStatus == SANE_STATUS_GOOD ) - bSuccess = true; + ControlOption( n, SANE_ACTION_SET_VALUE, &nSetTo ); } - return bSuccess; } -bool Sane::SetOptionValue( int n, double* pSet ) +void Sane::SetOptionValue( int n, double* pSet ) { if( ! maHandle || ( mppOptions[n]->type != SANE_TYPE_INT && mppOptions[n]->type != SANE_TYPE_FIXED ) ) - return false; + return; std::unique_ptr pFixedSet(new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]); for( size_t i = 0; i < mppOptions[n]->size/sizeof(SANE_Word); i++ ) { @@ -478,10 +466,7 @@ bool Sane::SetOptionValue( int n, double* pSet ) else pFixedSet[i] = (SANE_Word)pSet[i]; } - SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, pFixedSet.get() ); - if( nStatus != SANE_STATUS_GOOD ) - return false; - return true; + ControlOption( n, SANE_ACTION_SET_VALUE, pFixedSet.get() ); } enum FrameStyleType { diff --git a/extensions/source/scanner/sane.hxx b/extensions/source/scanner/sane.hxx index 7f204f6f5544..4f755e6edc4d 100644 --- a/extensions/source/scanner/sane.hxx +++ b/extensions/source/scanner/sane.hxx @@ -150,10 +150,10 @@ public: bool GetOptionValue( int, double&, int nElement = 0 ); bool GetOptionValue( int, double* ); - bool SetOptionValue( int, bool ); - bool SetOptionValue( int, const OUString& ); - bool SetOptionValue( int, double, int nElement = 0 ); - bool SetOptionValue( int, double* ); + void SetOptionValue( int, bool ); + void SetOptionValue( int, const OUString& ); + void SetOptionValue( int, double, int nElement = 0 ); + void SetOptionValue( int, double* ); bool ActivateButtonOption( int ); -- cgit