diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx index 8a2df8dcf83e..690b84b5ca30 100644 --- a/basic/source/sbx/sbxdec.cxx +++ b/basic/source/sbx/sbxdec.cxx @@ -324,7 +324,7 @@ SbxDecimal::CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight { (void)rLeft; (void)rRight; - return (SbxDecimal::CmpResult)0; + return SbxDecimal::CmpResult::LT; } void SbxDecimal::setChar( sal_Unicode val ) { (void)val; } diff --git a/basic/source/sbx/sbxdec.hxx b/basic/source/sbx/sbxdec.hxx index 2bc201be634c..4d80b253f0ed 100644 --- a/basic/source/sbx/sbxdec.hxx +++ b/basic/source/sbx/sbxdec.hxx @@ -95,7 +95,8 @@ public: bool isZero(); - enum CmpResult { LT, EQ, GT }; + // must match the return values of the Microsoft VarDecCmp Automation function + enum class CmpResult { LT, EQ, GT }; friend CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight ); }; diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 41713209e622..f4bc90578e96 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -1293,17 +1293,17 @@ bool SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const switch( eOp ) { case SbxEQ: - bRes = ( eRes == SbxDecimal::EQ ); break; + bRes = ( eRes == SbxDecimal::CmpResult::EQ ); break; case SbxNE: - bRes = ( eRes != SbxDecimal::EQ ); break; + bRes = ( eRes != SbxDecimal::CmpResult::EQ ); break; case SbxLT: - bRes = ( eRes == SbxDecimal::LT ); break; + bRes = ( eRes == SbxDecimal::CmpResult::LT ); break; case SbxGT: - bRes = ( eRes == SbxDecimal::GT ); break; + bRes = ( eRes == SbxDecimal::CmpResult::GT ); break; case SbxLE: - bRes = ( eRes != SbxDecimal::GT ); break; + bRes = ( eRes != SbxDecimal::CmpResult::GT ); break; case SbxGE: - bRes = ( eRes != SbxDecimal::LT ); break; + bRes = ( eRes != SbxDecimal::CmpResult::LT ); break; default: SetError( ERRCODE_SBX_NOTIMP ); }