diff options
author | Oliver Bolte <obo@openoffice.org> | 2006-10-12 13:33:50 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2006-10-12 13:33:50 +0000 |
commit | ba13fa22b5f87071aa9df5398f0e316b3e27d134 (patch) | |
tree | bbfb041935cb10be85491ebef6b496b044707c51 /basic/source/sbx/sbxsng.cxx | |
parent | INTEGRATION: CWS sb59 (1.6.22); FILE MERGED (diff) | |
download | core-ba13fa22b5f87071aa9df5398f0e316b3e27d134.tar.gz core-ba13fa22b5f87071aa9df5398f0e316b3e27d134.zip |
INTEGRATION: CWS sb59 (1.3.118); FILE MERGED
2006/08/11 15:04:32 sb 1.3.118.1: #i67487# Made code warning-free (wntmsci10).
Diffstat (limited to 'basic/source/sbx/sbxsng.cxx')
-rw-r--r-- | basic/source/sbx/sbxsng.cxx | 59 |
1 files changed, 42 insertions, 17 deletions
diff --git a/basic/source/sbx/sbxsng.cxx b/basic/source/sbx/sbxsng.cxx index 907e1778bc4e..2f4d692d7b14 100644 --- a/basic/source/sbx/sbxsng.cxx +++ b/basic/source/sbx/sbxsng.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sbxsng.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: obo $ $Date: 2006-09-17 10:11:44 $ + * last change: $Author: obo $ $Date: 2006-10-12 14:33:50 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -98,19 +98,23 @@ start: if( dVal > SbxMAXSNG ) { - SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXSNG; + SbxBase::SetError( SbxERR_OVERFLOW ); + nRes = static_cast< float >(SbxMAXSNG); } else if( dVal < SbxMINSNG ) { - SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINSNG; + SbxBase::SetError( SbxERR_OVERFLOW ); + nRes = static_cast< float >(SbxMINSNG); } else if( dVal > 0 && dVal < SbxMAXSNG2 ) { - SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXSNG2; + SbxBase::SetError( SbxERR_OVERFLOW ); + nRes = static_cast< float >(SbxMAXSNG2); } else if( dVal < 0 && dVal > SbxMINSNG2 ) { - SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINSNG2; + SbxBase::SetError( SbxERR_OVERFLOW ); + nRes = static_cast< float >(SbxMINSNG2); } else nRes = (float) dVal; @@ -129,11 +133,13 @@ start: nRes = 0; else if( d > SbxMAXSNG ) { - SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXSNG; + SbxBase::SetError( SbxERR_OVERFLOW ); + nRes = static_cast< float >(SbxMAXSNG); } else if( d < SbxMINSNG ) { - SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINSNG; + SbxBase::SetError( SbxERR_OVERFLOW ); + nRes = static_cast< float >(SbxMINSNG); } else nRes = (float) d; @@ -299,25 +305,39 @@ start: } *p->pUShort = (UINT16) n; break; case SbxBYREF | SbxLONG: + { + INT32 i; if( n > SbxMAXLNG ) { - SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXLNG; + SbxBase::SetError( SbxERR_OVERFLOW ); i = SbxMAXLNG; } else if( n < SbxMINLNG ) { - SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINLNG; + SbxBase::SetError( SbxERR_OVERFLOW ); i = SbxMINLNG; } - *p->pLong = (INT32) n; break; + else + { + i = sal::static_int_cast< INT32 >(n); + } + *p->pLong = i; break; + } case SbxBYREF | SbxULONG: + { + UINT32 i; if( n > SbxMAXULNG ) { - SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXULNG; + SbxBase::SetError( SbxERR_OVERFLOW ); i = SbxMAXULNG; } else if( n < 0 ) { - SbxBase::SetError( SbxERR_OVERFLOW ); n = 0; + SbxBase::SetError( SbxERR_OVERFLOW ); i = 0; + } + else + { + i = sal::static_int_cast< UINT32 >(n); } - *p->pULong = (UINT32) n; break; + *p->pULong = i; break; + } case SbxBYREF | SbxSINGLE: *p->pSingle = n; break; case SbxBYREF | SbxDATE: @@ -328,15 +348,20 @@ start: case SbxBYREF | SbxSALUINT64: *p->puInt64 = ImpDoubleToSalUInt64( (double) n ); break; case SbxBYREF | SbxCURRENCY: + double d; if( n > SbxMAXCURR ) { - SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMAXCURR; + SbxBase::SetError( SbxERR_OVERFLOW ); d = SbxMAXCURR; } else if( n < SbxMINCURR ) { - SbxBase::SetError( SbxERR_OVERFLOW ); n = SbxMINCURR; + SbxBase::SetError( SbxERR_OVERFLOW ); d = SbxMINCURR; + } + else + { + d = n; } - *p->pLong64 = ImpDoubleToCurrency( (double)n ); break; + *p->pLong64 = ImpDoubleToCurrency( n ); break; default: SbxBase::SetError( SbxERR_CONVERSION ); |