From 2601f8b40b2dbddc02816c1f29113b8a527b9416 Mon Sep 17 00:00:00 2001 From: Mindaugas Kavaliauskas Date: Fri, 30 Oct 2009 19:53:10 +0000 Subject: [PATCH] 2009-10-30 21:50 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) * harbour/contrib/rddads/ads1.c * added ADS function return value check in a few places --- harbour/ChangeLog | 4 ++++ harbour/contrib/rddads/ads1.c | 22 +++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c77ec804c3..89a6ddaed4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,10 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-10-30 21:50 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) + * harbour/contrib/rddads/ads1.c + * added ADS function return value check in a few places + 2009-10-30 17:54 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/common/hbffind.c * small buffer size fix diff --git a/harbour/contrib/rddads/ads1.c b/harbour/contrib/rddads/ads1.c index 084d359f96..caa73195e4 100644 --- a/harbour/contrib/rddads/ads1.c +++ b/harbour/contrib/rddads/ads1.c @@ -2857,6 +2857,7 @@ static HB_ERRCODE adsCreate( ADSAREAP pArea, LPDBOPENINFO pCreateInfo ) if( uRetVal != AE_SUCCESS ) { HB_TRACE(HB_TR_INFO, ("adsCreate() error")); + commonError( pArea, EG_CREATE, ( USHORT ) uRetVal, 0, pCreateInfo->abName, 0, NULL ); return HB_FAILURE; } /* @@ -3887,6 +3888,7 @@ static HB_ERRCODE adsOrderInfo( ADSAREAP pArea, USHORT uiIndex, LPDBORDERINFO pO UNSIGNED16 u16len = MAX_STR_LEN; UNSIGNED16 u16 = 0; UNSIGNED32 u32 = 0; + UNSIGNED32 u32RetVal; HB_TRACE(HB_TR_DEBUG, ("adsOrderInfo(%p, %hu, %p)", pArea, uiIndex, pOrderInfo)); @@ -3899,7 +3901,7 @@ static HB_ERRCODE adsOrderInfo( ADSAREAP pArea, USHORT uiIndex, LPDBORDERINFO pO /* all others need an index handle */ if( uiIndex != DBOI_ORDERCOUNT && pOrderInfo->itmOrder && !HB_IS_NIL( pOrderInfo->itmOrder ) ) { - UNSIGNED32 u32RetVal = AE_SUCCESS; + u32RetVal = AE_SUCCESS; if( HB_IS_STRING( pOrderInfo->itmOrder ) ) { @@ -4152,6 +4154,8 @@ static HB_ERRCODE adsOrderInfo( ADSAREAP pArea, USHORT uiIndex, LPDBORDERINFO pO TODO: If there are child areas that are not at the top of scope, Skip movement may move them to first related record */ + u32RetVal = AE_SUCCESS; + if( hIndex ) { if( pArea->area.dbfi.itmCobExpr ) @@ -4183,19 +4187,27 @@ static HB_ERRCODE adsOrderInfo( ADSAREAP pArea, USHORT uiIndex, LPDBORDERINFO pO SELF_GOTO( ( AREAP ) pArea, ulRecNo ); } else /* no scope set */ - AdsGetRecordCount( hIndex, ADS_RESPECTFILTERS, &u32 ); + u32RetVal = AdsGetRecordCount( hIndex, ADS_RESPECTFILTERS, &u32 ); } else /* no filter set */ - AdsGetRecordCount( hIndex, ADS_RESPECTSCOPES, &u32 ); + u32RetVal = AdsGetRecordCount( hIndex, ADS_RESPECTSCOPES, &u32 ); } else - AdsGetRecordCount( pArea->hTable, ADS_RESPECTFILTERS, &u32 ); + u32RetVal = AdsGetRecordCount( pArea->hTable, ADS_RESPECTFILTERS, &u32 ); + if( u32RetVal != AE_SUCCESS ) + { + commonError( pArea, EG_CORRUPTION, ( USHORT ) u32RetVal, 0, NULL, 0, NULL ); + } hb_itemPutNL( pOrderInfo->itmResult, u32 ); break; case DBOI_KEYCOUNTRAW : /* ignore filter but RESPECT SCOPE */ - AdsGetRecordCount( (hIndex ? hIndex : pArea->hTable), ADS_RESPECTSCOPES, &u32 ); + u32RetVal = AdsGetRecordCount( (hIndex ? hIndex : pArea->hTable), ADS_RESPECTSCOPES, &u32 ); + if( u32RetVal != AE_SUCCESS ) + { + commonError( pArea, EG_CORRUPTION, ( USHORT ) u32RetVal, 0, NULL, 0, NULL ); + } hb_itemPutNL( pOrderInfo->itmResult, u32 ); break;