merge the formfield patch from ooo-build
[ooovba.git] / basic / source / sbx / sbxdec.cxx
blob0ca63122e3c0e1ff890e2f0b035237e0c70cd403
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sbxdec.cxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_basic.hxx"
33 #include <tools/errcode.hxx>
35 #include <basic/sbx.hxx>
36 #include "sbxconv.hxx"
38 #include <com/sun/star/bridge/oleautomation/Decimal.hpp>
41 // int GnDecCounter = 0;
43 // Implementation SbxDecimal
44 SbxDecimal::SbxDecimal( void )
46 setInt( 0 );
47 mnRefCount = 0;
48 // GnDecCounter++;
51 SbxDecimal::SbxDecimal( const SbxDecimal& rDec )
53 #ifdef WIN32
54 maDec = rDec.maDec;
55 #else
56 (void)rDec;
57 #endif
58 mnRefCount = 0;
59 // GnDecCounter++;
62 SbxDecimal::SbxDecimal
63 ( const com::sun::star::bridge::oleautomation::Decimal& rAutomationDec )
65 #ifdef WIN32
66 maDec.scale = rAutomationDec.Scale;
67 maDec.sign = rAutomationDec.Sign;
68 maDec.Lo32 = rAutomationDec.LowValue;
69 maDec.Mid32 = rAutomationDec.MiddleValue;
70 maDec.Hi32 = rAutomationDec.HighValue;
71 #else
72 (void)rAutomationDec;
73 #endif
74 mnRefCount = 0;
75 // GnDecCounter++;
78 void SbxDecimal::fillAutomationDecimal
79 ( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec )
81 #ifdef WIN32
82 rAutomationDec.Scale = maDec.scale;
83 rAutomationDec.Sign = maDec.sign;
84 rAutomationDec.LowValue = maDec.Lo32;
85 rAutomationDec.MiddleValue = maDec.Mid32;
86 rAutomationDec.HighValue = maDec.Hi32;
87 #else
88 (void)rAutomationDec;
89 #endif
92 SbxDecimal::~SbxDecimal()
94 // GnDecCounter--;
97 void releaseDecimalPtr( SbxDecimal*& rpDecimal )
99 if( rpDecimal )
101 rpDecimal->mnRefCount--;
102 if( rpDecimal->mnRefCount == 0 )
104 delete rpDecimal;
105 rpDecimal = NULL;
110 #ifdef WIN32
112 bool SbxDecimal::operator -= ( const SbxDecimal &r )
114 HRESULT hResult = VarDecSub( &maDec, (LPDECIMAL)&r.maDec, &maDec );
115 bool bRet = ( hResult == S_OK );
116 return bRet;
119 bool SbxDecimal::operator += ( const SbxDecimal &r )
121 HRESULT hResult = VarDecAdd( &maDec, (LPDECIMAL)&r.maDec, &maDec );
122 bool bRet = ( hResult == S_OK );
123 return bRet;
126 bool SbxDecimal::operator /= ( const SbxDecimal &r )
128 HRESULT hResult = VarDecDiv( &maDec, (LPDECIMAL)&r.maDec, &maDec );
129 bool bRet = ( hResult == S_OK );
130 return bRet;
133 bool SbxDecimal::operator *= ( const SbxDecimal &r )
135 HRESULT hResult = VarDecMul( &maDec, (LPDECIMAL)&r.maDec, &maDec );
136 bool bRet = ( hResult == S_OK );
137 return bRet;
140 bool SbxDecimal::neg( void )
142 HRESULT hResult = VarDecNeg( &maDec, &maDec );
143 bool bRet = ( hResult == S_OK );
144 return bRet;
147 bool SbxDecimal::isZero( void )
149 SbxDecimal aZeroDec;
150 aZeroDec.setLong( 0 );
151 bool bZero = ( EQ == compare( *this, aZeroDec ) );
152 return bZero;
155 SbxDecimal::CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight )
157 HRESULT hResult = VarDecCmp( (LPDECIMAL)&rLeft.maDec, (LPDECIMAL)&rRight.maDec );
158 SbxDecimal::CmpResult eRes = (SbxDecimal::CmpResult)hResult;
159 return eRes;
162 void SbxDecimal::setChar( sal_Unicode val )
164 VarDecFromUI2( (USHORT)val, &maDec );
167 void SbxDecimal::setByte( BYTE val )
169 VarDecFromUI1( (BYTE)val, &maDec );
172 void SbxDecimal::setShort( INT16 val )
174 VarDecFromI2( (short)val, &maDec );
177 void SbxDecimal::setLong( INT32 val )
179 VarDecFromI4( (long)val, &maDec );
182 void SbxDecimal::setUShort( UINT16 val )
184 VarDecFromUI2( (USHORT)val, &maDec );
187 void SbxDecimal::setULong( UINT32 val )
189 VarDecFromUI4( (ULONG)val, &maDec );
192 bool SbxDecimal::setSingle( float val )
194 bool bRet = ( VarDecFromR4( val, &maDec ) == S_OK );
195 return bRet;
198 bool SbxDecimal::setDouble( double val )
200 bool bRet = ( VarDecFromR8( val, &maDec ) == S_OK );
201 return bRet;
204 void SbxDecimal::setInt( int val )
206 setLong( (INT32)val );
209 void SbxDecimal::setUInt( unsigned int val )
211 setULong( (UINT32)val );
214 // sbxscan.cxx
215 void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep );
217 bool SbxDecimal::setString( String* pString )
219 static LCID nLANGID = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US );
221 // Convert delimiter
222 sal_Unicode cDecimalSep;
223 sal_Unicode cThousandSep;
224 ImpGetIntntlSep( cDecimalSep, cThousandSep );
226 bool bRet = false;
227 HRESULT hResult;
228 if( cDecimalSep != '.' || cThousandSep != ',' )
230 int nLen = pString->Len();
231 sal_Unicode* pBuffer = new sal_Unicode[nLen + 1];
232 pBuffer[nLen] = 0;
234 const sal_Unicode* pSrc = pString->GetBuffer();
235 int i;
236 for( i = 0 ; i < nLen ; ++i )
237 pBuffer[i] = pSrc[i];
239 sal_Unicode c;
240 i = 0;
241 while( (c = pBuffer[i]) != 0 )
243 if( c == cDecimalSep )
244 pBuffer[i] = '.';
245 else if( c == cThousandSep )
246 pBuffer[i] = ',';
247 i++;
249 hResult = VarDecFromStr( (OLECHAR*)pBuffer, nLANGID, 0, &maDec );
250 delete pBuffer;
252 else
254 hResult = VarDecFromStr( (OLECHAR*)pString->GetBuffer(), nLANGID, 0, &maDec );
256 bRet = ( hResult == S_OK );
257 return bRet;
261 bool SbxDecimal::getChar( sal_Unicode& rVal )
263 bool bRet = ( VarUI2FromDec( &maDec, &rVal ) == S_OK );
264 return bRet;
267 bool SbxDecimal::getByte( BYTE& rVal )
269 bool bRet = ( VarUI1FromDec( &maDec, &rVal ) == S_OK );
270 return bRet;
273 bool SbxDecimal::getShort( INT16& rVal )
275 bool bRet = ( VarI2FromDec( &maDec, &rVal ) == S_OK );
276 return bRet;
279 bool SbxDecimal::getLong( INT32& rVal )
281 bool bRet = ( VarI4FromDec( &maDec, &rVal ) == S_OK );
282 return bRet;
285 bool SbxDecimal::getUShort( UINT16& rVal )
287 bool bRet = ( VarUI2FromDec( &maDec, &rVal ) == S_OK );
288 return bRet;
291 bool SbxDecimal::getULong( UINT32& rVal )
293 bool bRet = ( VarUI4FromDec( &maDec, &rVal ) == S_OK );
294 return bRet;
297 bool SbxDecimal::getSingle( float& rVal )
299 bool bRet = ( VarR4FromDec( &maDec, &rVal ) == S_OK );
300 return bRet;
303 bool SbxDecimal::getDouble( double& rVal )
305 bool bRet = ( VarR8FromDec( &maDec, &rVal ) == S_OK );
306 return bRet;
309 bool SbxDecimal::getInt( int& rVal )
311 INT32 TmpVal;
312 bool bRet = getLong( TmpVal );
313 rVal = TmpVal;
314 return bRet;
317 bool SbxDecimal::getUInt( unsigned int& rVal )
319 UINT32 TmpVal;
320 bool bRet = getULong( TmpVal );
321 rVal = TmpVal;
322 return bRet;
325 #else
326 // !WIN32
328 bool SbxDecimal::operator -= ( const SbxDecimal &r )
330 (void)r;
331 return false;
334 bool SbxDecimal::operator += ( const SbxDecimal &r )
336 (void)r;
337 return false;
340 bool SbxDecimal::operator /= ( const SbxDecimal &r )
342 (void)r;
343 return false;
346 bool SbxDecimal::operator *= ( const SbxDecimal &r )
348 (void)r;
349 return false;
352 bool SbxDecimal::neg( void )
354 return false;
357 bool SbxDecimal::isZero( void )
359 return false;
362 SbxDecimal::CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight )
364 (void)rLeft;
365 (void)rRight;
366 return (SbxDecimal::CmpResult)0;
369 void SbxDecimal::setChar( sal_Unicode val ) { (void)val; }
370 void SbxDecimal::setByte( BYTE val ) { (void)val; }
371 void SbxDecimal::setShort( INT16 val ) { (void)val; }
372 void SbxDecimal::setLong( INT32 val ) { (void)val; }
373 void SbxDecimal::setUShort( UINT16 val ) { (void)val; }
374 void SbxDecimal::setULong( UINT32 val ) { (void)val; }
375 bool SbxDecimal::setSingle( float val ) { (void)val; return false; }
376 bool SbxDecimal::setDouble( double val ) { (void)val; return false; }
377 void SbxDecimal::setInt( int val ) { (void)val; }
378 void SbxDecimal::setUInt( unsigned int val ) { (void)val; }
379 bool SbxDecimal::setString( String* pString ) { (void)pString; return false; }
381 bool SbxDecimal::getChar( sal_Unicode& rVal ) { (void)rVal; return false; }
382 bool SbxDecimal::getByte( BYTE& rVal ) { (void)rVal; return false; }
383 bool SbxDecimal::getShort( INT16& rVal ) { (void)rVal; return false; }
384 bool SbxDecimal::getLong( INT32& rVal ) { (void)rVal; return false; }
385 bool SbxDecimal::getUShort( UINT16& rVal ) { (void)rVal; return false; }
386 bool SbxDecimal::getULong( UINT32& rVal ) { (void)rVal; return false; }
387 bool SbxDecimal::getSingle( float& rVal ) { (void)rVal; return false; }
388 bool SbxDecimal::getDouble( double& rVal ) { (void)rVal; return false; }
389 bool SbxDecimal::getInt( int& rVal ) { (void)rVal; return false; }
390 bool SbxDecimal::getUInt( unsigned int& rVal ) { (void)rVal; return false; }
392 #endif
394 bool SbxDecimal::getString( String& rString )
396 #ifdef WIN32
397 static LCID nLANGID = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US );
399 bool bRet = false;
401 OLECHAR sz[100];
402 BSTR aBStr = SysAllocString( sz );
403 if( aBStr != NULL )
405 HRESULT hResult = VarBstrFromDec( &maDec, nLANGID, 0, &aBStr );
406 bRet = ( hResult == S_OK );
407 if( bRet )
409 // Convert delimiter
410 sal_Unicode cDecimalSep;
411 sal_Unicode cThousandSep;
412 ImpGetIntntlSep( cDecimalSep, cThousandSep );
414 if( cDecimalSep != '.' || cThousandSep != ',' )
416 sal_Unicode c;
417 int i = 0;
418 while( (c = aBStr[i]) != 0 )
420 if( c == '.' )
421 aBStr[i] = cDecimalSep;
422 else if( c == ',' )
423 aBStr[i] = cThousandSep;
424 i++;
427 rString = reinterpret_cast<const sal_Unicode*>(aBStr);
430 SysFreeString( aBStr );
432 return bRet;
433 #else
434 (void)rString;
435 return false;
436 #endif
439 SbxDecimal* ImpCreateDecimal( SbxValues* p )
441 #ifdef WIN32
442 if( !p )
443 return NULL;
445 SbxDecimal*& rpDecimal = p->pDecimal;
446 if( rpDecimal == NULL )
448 rpDecimal = new SbxDecimal();
449 rpDecimal->addRef();
451 return rpDecimal;
452 #else
453 (void)p;
454 return NULL;
455 #endif
458 SbxDecimal* ImpGetDecimal( const SbxValues* p )
460 #ifdef WIN32
461 SbxValues aTmp;
462 SbxDecimal* pnDecRes;
464 SbxDataType eType = p->eType;
465 if( eType == SbxDECIMAL && p->pDecimal )
467 pnDecRes = new SbxDecimal( *p->pDecimal );
468 pnDecRes->addRef();
469 return pnDecRes;
471 pnDecRes = new SbxDecimal();
472 pnDecRes->addRef();
474 start:
475 switch( +eType )
477 case SbxNULL:
478 SbxBase::SetError( SbxERR_CONVERSION );
479 case SbxEMPTY:
480 pnDecRes->setShort( 0 ); break;
481 case SbxCHAR:
482 pnDecRes->setChar( p->nChar ); break;
483 case SbxBYTE:
484 pnDecRes->setByte( p->nByte ); break;
485 case SbxINTEGER:
486 case SbxBOOL:
487 pnDecRes->setInt( p->nInteger ); break;
488 case SbxERROR:
489 case SbxUSHORT:
490 pnDecRes->setUShort( p->nUShort ); break;
491 case SbxLONG:
492 pnDecRes->setLong( p->nLong ); break;
493 case SbxULONG:
494 pnDecRes->setULong( p->nULong ); break;
495 case SbxSINGLE:
496 if( !pnDecRes->setSingle( p->nSingle ) )
497 SbxBase::SetError( SbxERR_OVERFLOW );
498 break;
499 case SbxSALINT64:
501 double d = (double)p->nInt64;
502 pnDecRes->setDouble( d );
503 break;
505 case SbxSALUINT64:
507 double d = ImpSalUInt64ToDouble( p->uInt64 );
508 pnDecRes->setDouble( d );
509 break;
511 case SbxDATE:
512 case SbxDOUBLE:
513 case SbxLONG64:
514 case SbxULONG64:
515 case SbxCURRENCY:
517 double dVal;
518 if( p->eType == SbxCURRENCY )
519 dVal = ImpCurrencyToDouble( p->nLong64 );
520 else if( p->eType == SbxLONG64 )
521 dVal = ImpINT64ToDouble( p->nLong64 );
522 else if( p->eType == SbxULONG64 )
523 dVal = ImpUINT64ToDouble( p->nULong64 );
524 else
525 dVal = p->nDouble;
527 if( !pnDecRes->setDouble( dVal ) )
528 SbxBase::SetError( SbxERR_OVERFLOW );
529 break;
531 case SbxLPSTR:
532 case SbxSTRING:
533 case SbxBYREF | SbxSTRING:
534 pnDecRes->setString( p->pString ); break;
535 case SbxOBJECT:
537 SbxValue* pVal = PTR_CAST(SbxValue,p->pObj);
538 if( pVal )
539 pnDecRes->setDecimal( pVal->GetDecimal() );
540 else
542 SbxBase::SetError( SbxERR_NO_OBJECT );
543 pnDecRes->setShort( 0 );
545 break;
548 case SbxBYREF | SbxCHAR:
549 pnDecRes->setChar( *p->pChar ); break;
550 case SbxBYREF | SbxBYTE:
551 pnDecRes->setByte( *p->pByte ); break;
552 case SbxBYREF | SbxINTEGER:
553 case SbxBYREF | SbxBOOL:
554 pnDecRes->setInt( *p->pInteger ); break;
555 case SbxBYREF | SbxLONG:
556 pnDecRes->setLong( *p->pLong ); break;
557 case SbxBYREF | SbxULONG:
558 pnDecRes->setULong( *p->pULong ); break;
559 case SbxBYREF | SbxERROR:
560 case SbxBYREF | SbxUSHORT:
561 pnDecRes->setUShort( *p->pUShort ); break;
563 // ab hier muss getestet werden
564 case SbxBYREF | SbxSINGLE:
565 aTmp.nSingle = *p->pSingle; goto ref;
566 case SbxBYREF | SbxDATE:
567 case SbxBYREF | SbxDOUBLE:
568 aTmp.nDouble = *p->pDouble; goto ref;
569 case SbxBYREF | SbxULONG64:
570 aTmp.nULong64 = *p->pULong64; goto ref;
571 case SbxBYREF | SbxLONG64:
572 case SbxBYREF | SbxCURRENCY:
573 aTmp.nLong64 = *p->pLong64; goto ref;
574 case SbxBYREF | SbxSALINT64:
575 aTmp.nInt64 = *p->pnInt64; goto ref;
576 case SbxBYREF | SbxSALUINT64:
577 aTmp.uInt64 = *p->puInt64; goto ref;
578 ref:
579 aTmp.eType = SbxDataType( p->eType & 0x0FFF );
580 p = &aTmp; goto start;
582 default:
583 SbxBase::SetError( SbxERR_CONVERSION ); pnDecRes->setShort( 0 );
585 return pnDecRes;
586 #else
587 (void)p;
588 return NULL;
589 #endif
593 void ImpPutDecimal( SbxValues* p, SbxDecimal* pDec )
595 #ifdef WIN32
596 if( !pDec )
597 return;
599 SbxValues aTmp;
600 start:
601 switch( +p->eType )
603 // hier muss getestet werden
604 case SbxCHAR:
605 aTmp.pChar = &p->nChar; goto direct;
606 case SbxBYTE:
607 aTmp.pByte = &p->nByte; goto direct;
608 case SbxULONG:
609 aTmp.pULong = &p->nULong; goto direct;
610 case SbxERROR:
611 case SbxUSHORT:
612 aTmp.pUShort = &p->nUShort; goto direct;
613 case SbxSALUINT64:
614 aTmp.puInt64 = &p->uInt64; goto direct;
615 case SbxINTEGER:
616 case SbxBOOL:
617 aTmp.pInteger = &p->nInteger; goto direct;
618 case SbxLONG:
619 aTmp.pLong = &p->nLong; goto direct;
620 case SbxSALINT64:
621 aTmp.pnInt64 = &p->nInt64; goto direct;
622 case SbxCURRENCY:
623 aTmp.pLong64 = &p->nLong64; goto direct;
624 direct:
625 aTmp.eType = SbxDataType( p->eType | SbxBYREF );
626 p = &aTmp; goto start;
628 // ab hier nicht mehr
629 case SbxDECIMAL:
630 case SbxBYREF | SbxDECIMAL:
632 if( pDec != p->pDecimal )
634 releaseDecimalPtr( p->pDecimal );
635 // if( p->pDecimal )
636 // p->pDecimal->ReleaseRef();
637 p->pDecimal = pDec;
638 if( pDec )
639 pDec->addRef();
641 break;
643 case SbxSINGLE:
645 float f;
646 pDec->getSingle( f );
647 p->nSingle = f;
648 break;
650 case SbxDATE:
651 case SbxDOUBLE:
653 double d;
654 pDec->getDouble( d );
655 p->nDouble = d;
656 break;
658 case SbxULONG64:
660 double d;
661 pDec->getDouble( d );
662 p->nULong64 = ImpDoubleToUINT64( d );
663 break;
665 case SbxLONG64:
667 double d;
668 pDec->getDouble( d );
669 p->nLong64 = ImpDoubleToINT64( d );
670 break;
673 case SbxLPSTR:
674 case SbxSTRING:
675 case SbxBYREF | SbxSTRING:
676 if( !p->pString )
677 p->pString = new XubString;
678 // ImpCvtNum( (double) n, 0, *p->pString );
679 pDec->getString( *p->pString );
680 break;
681 case SbxOBJECT:
683 SbxValue* pVal = PTR_CAST(SbxValue,p->pObj);
684 if( pVal )
685 pVal->PutDecimal( pDec );
686 else
687 SbxBase::SetError( SbxERR_NO_OBJECT );
688 break;
691 case SbxBYREF | SbxCHAR:
692 if( !pDec->getChar( *p->pChar ) )
694 SbxBase::SetError( SbxERR_OVERFLOW );
695 *p->pChar = 0;
697 break;
698 case SbxBYREF | SbxBYTE:
699 if( !pDec->getChar( *p->pChar ) )
701 SbxBase::SetError( SbxERR_OVERFLOW );
702 *p->pByte = 0;
704 break;
705 case SbxBYREF | SbxINTEGER:
706 case SbxBYREF | SbxBOOL:
707 if( !pDec->getShort( *p->pInteger ) )
709 SbxBase::SetError( SbxERR_OVERFLOW );
710 *p->pInteger = 0;
712 break;
713 // *p->pInteger = n; break;
714 case SbxBYREF | SbxERROR:
715 case SbxBYREF | SbxUSHORT:
716 if( !pDec->getUShort( *p->pUShort ) )
718 SbxBase::SetError( SbxERR_OVERFLOW );
719 *p->pUShort = 0;
721 break;
722 case SbxBYREF | SbxLONG:
723 if( !pDec->getLong( *p->pLong ) )
725 SbxBase::SetError( SbxERR_OVERFLOW );
726 *p->pLong = 0;
728 break;
729 case SbxBYREF | SbxULONG:
730 if( !pDec->getULong( *p->pULong ) )
732 SbxBase::SetError( SbxERR_OVERFLOW );
733 *p->pULong = 0;
735 break;
736 case SbxBYREF | SbxSALINT64:
738 double d;
739 if( !pDec->getDouble( d ) )
740 SbxBase::SetError( SbxERR_OVERFLOW );
741 else
742 *p->pnInt64 = ImpDoubleToSalInt64( d );
743 break;
745 case SbxBYREF | SbxSALUINT64:
747 double d;
748 if( !pDec->getDouble( d ) )
749 SbxBase::SetError( SbxERR_OVERFLOW );
750 else
751 *p->puInt64 = ImpDoubleToSalUInt64( d );
752 break;
754 case SbxBYREF | SbxSINGLE:
755 if( !pDec->getSingle( *p->pSingle ) )
757 SbxBase::SetError( SbxERR_OVERFLOW );
758 *p->pSingle = 0;
760 break;
761 // *p->pSingle = (float) n; break;
762 case SbxBYREF | SbxDATE:
763 case SbxBYREF | SbxDOUBLE:
764 if( !pDec->getDouble( *p->pDouble ) )
766 SbxBase::SetError( SbxERR_OVERFLOW );
767 *p->pDouble = 0;
769 break;
770 case SbxBYREF | SbxULONG64:
772 double d;
773 pDec->getDouble( d );
774 *p->pULong64 = ImpDoubleToUINT64( d );
775 break;
777 case SbxBYREF | SbxLONG64:
779 double d;
780 pDec->getDouble( d );
781 *p->pLong64 = ImpDoubleToINT64( d );
782 break;
784 case SbxBYREF | SbxCURRENCY:
786 double d;
787 pDec->getDouble( d );
788 *p->pLong64 = ImpDoubleToCurrency( d );
789 break;
792 default:
793 SbxBase::SetError( SbxERR_CONVERSION );
795 #else
796 (void)p;
797 (void)pDec;
798 #endif