From 517ad9d4b6eae320b708d03a9340a22893b0cab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 29 Jan 2023 15:45:51 +0100 Subject: New upstream version 4.0.3 --- src/core/xbfields.cpp | 56 +++++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 24 deletions(-) (limited to 'src/core/xbfields.cpp') diff --git a/src/core/xbfields.cpp b/src/core/xbfields.cpp index 8cfb4e6..e683d9c 100755 --- a/src/core/xbfields.cpp +++ b/src/core/xbfields.cpp @@ -492,43 +492,50 @@ xbInt16 xbDbf::GetLogicalField( const xbString &sFieldName, xbBool &bFieldValue */ xbInt16 xbDbf::GetLongField( xbInt16 iFieldNo, xbInt32 & lFieldValue ) const { - xbInt16 rc = 0; - xbInt16 iErrorStop = 0; - char cFieldType; + xbInt16 iRc = 0; + xbInt16 iErrorStop = 0; + char cFieldType; + xbString sTemp; try{ - if(( rc = GetFieldType( iFieldNo, cFieldType )) != XB_NO_ERROR ){ - iErrorStop = 10; - throw rc; + if(( iRc = GetFieldType( iFieldNo, cFieldType )) != XB_NO_ERROR ){ + iErrorStop = 100; + throw iRc; } if( cFieldType != 'N' && cFieldType != 'F' && cFieldType != 'M' ){ - iErrorStop = 20; - rc = XB_INVALID_FIELD_TYPE; - throw rc; + iErrorStop = 110; + iRc = XB_INVALID_FIELD_TYPE; + throw iRc; } - xbString sTemp; - if(( rc = GetField( iFieldNo, sTemp, 0 )) < 0 ){ - iErrorStop = 30; - throw rc; + if(( iRc = GetField( iFieldNo, sTemp, 0 )) < 0 ){ + iErrorStop = 120; + throw iRc; } + sTemp.Trim(); - if( !sTemp.ValidNumericValue() || ((int) sTemp.Pos( '.' ) > 0)){ - iErrorStop = 40; - rc = XB_INVALID_DATA; - throw rc; + if( !sTemp.ValidNumericValue() ){ + iErrorStop = 130; + iRc = XB_INVALID_DATA; + throw iRc; + } + + if( sTemp.Pos( '.' ) > 0){ + iErrorStop = 140; + iRc = XB_INVALID_DATA; + throw iRc; } lFieldValue = atol( sTemp.Str()); } - catch (xbInt16 rc ){ + catch (xbInt16 iRc ){ xbString sMsg; - sMsg.Sprintf( "xbDbf::GetLongField() Exception Caught. Error Stop = [%d] rc = [%d]", iErrorStop, rc ); + sMsg.Sprintf( "xbDbf::GetLongField() Exception Caught. Error Stop = [%d] rc = [%d] [%s]", iErrorStop, iRc, sTemp.Str() ); xbase->WriteLogMessage( sMsg.Str() ); - xbase->WriteLogMessage( GetErrorMessage( rc )); + xbase->WriteLogMessage( GetErrorMessage( iRc )); } return XB_NO_ERROR; @@ -615,24 +622,24 @@ xbInt16 xbDbf::GetULongField( xbInt16 iFieldNo, xbUInt32 & ulFieldValue ) const try{ if(( rc = GetFieldType( iFieldNo, cFieldType )) != XB_NO_ERROR ){ - iErrorStop = 10; + iErrorStop = 100; throw rc; } if( cFieldType != 'N' && cFieldType != 'F' && cFieldType != 'M' ){ - iErrorStop = 20; + iErrorStop = 110; rc = XB_INVALID_FIELD_TYPE; throw rc; } xbString sTemp; if(( rc = GetField( iFieldNo, sTemp, 0 )) != XB_NO_ERROR ){ - iErrorStop = 30; + iErrorStop = 120; throw rc; } sTemp.Trim(); if( !sTemp.ValidNumericValue() || ((int) sTemp.Pos( '.' ) > 0)){ - iErrorStop = 40; + iErrorStop = 130; rc = XB_INVALID_DATA; throw rc; } @@ -1118,5 +1125,6 @@ xbBool xbDbf::MemoFieldExists( xbInt16 iFieldNo ) const{ } #endif + } /* namespace */ -- cgit v1.2.3