diff --git a/harbour/ChangeLog b/harbour/ChangeLog index dba9844702..ac6a28ed63 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,16 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2002-07-02 01:14 UTC-0800 Brian Hays + * contrib/rdd_ads/adsfunc.c + * Fixed issues reported by Alex Schaft: + Since AdsGetAOFOptLevel() did not attempt to return the NoOpt string + by reference anyway, I just removed the NoOpt handling. This avoids + the overflow error and removes any string buffer limitations at all. + + Fixed AdsGetAOF() AdsGetAOFNoOpt() to handle filters of any size + that ADS may return. + 2002-07-01 20:10 UTC-0300 Walter Negro * source/rtl/transfrm.c + Add @0 function. @@ -105,7 +115,7 @@ 2002-06-28 10:43 UTC+0300 Alexander Kresin * source/rdd/dbfntx/dbfntx1.c ! Bug fixed in hb_ntxPageSplit() - the created page was not released. - + 2002-06-27 15:25 UTC-0400 David G. Holm * source/rtl/gtsln/gtsln.c ! HRBNATIONCHARS fix provided by Niko Mikkila diff --git a/harbour/contrib/rdd_ads/adsfunc.c b/harbour/contrib/rdd_ads/adsfunc.c index ba44f988c4..d1abd357c7 100644 --- a/harbour/contrib/rdd_ads/adsfunc.c +++ b/harbour/contrib/rdd_ads/adsfunc.c @@ -557,36 +557,46 @@ HB_FUNC( ADSGETTABLEALIAS ) HB_FUNC( ADSGETAOF ) { ADSAREAP pArea; - UNSIGNED8 pucFilter[HARBOUR_MAX_RDD_FILTER_LENGTH+1]; + UNSIGNED8 pucFilter[HARBOUR_MAX_RDD_FILTER_LENGTH+1]; + UNSIGNED8 *pucFilter2; UNSIGNED16 pusLen = HARBOUR_MAX_RDD_FILTER_LENGTH; UNSIGNED32 ulRetVal = FAILURE; + hb_retc( "" ); pArea = (ADSAREAP) hb_rddGetCurrentWorkAreaPointer(); if( pArea ) + { ulRetVal = AdsGetAOF( pArea->hTable, pucFilter, &pusLen ); + if ( pusLen > HARBOUR_MAX_RDD_FILTER_LENGTH ) + { + pucFilter2 = (UNSIGNED8*) hb_xgrab(pusLen + 1); + ulRetVal = AdsGetAOF( pArea->hTable, pucFilter2, &pusLen ); + if ( ulRetVal == AE_SUCCESS ) + hb_retc( (char *) pucFilter2 ); + + hb_xfree( pucFilter2 ); + } + else if ( ulRetVal == AE_SUCCESS ) + { + hb_retc( (char *) pucFilter ); + } + + } else hb_errRT_DBCMD( EG_NOTABLE, 2001, NULL, "ADSGETAOF" ); - if ( ulRetVal == AE_SUCCESS ) - hb_retc( ( char * ) pucFilter ); - else - hb_retc( "" ); } HB_FUNC( ADSGETAOFOPTLEVEL ) { - ADSAREAP pArea; + ADSAREAP pArea; UNSIGNED16 pusOptLevel; - UNSIGNED8 pucNonOpt[1]; - UNSIGNED16 pusLen = 0; UNSIGNED32 ulRetVal; pArea = (ADSAREAP) hb_rddGetCurrentWorkAreaPointer(); if( pArea ) { - ulRetVal = AdsGetAOF( pArea->hTable, pucNonOpt, &pusLen ); - if ( ulRetVal == AE_SUCCESS ) - ulRetVal = AdsGetAOFOptLevel( pArea->hTable, &pusOptLevel, pucNonOpt, &pusLen ); + ulRetVal = AdsGetAOFOptLevel( pArea->hTable, &pusOptLevel, NULL, NULL ); hb_retni( ulRetVal == AE_SUCCESS ? pusOptLevel : ADS_OPTIMIZED_NONE ); } else @@ -595,16 +605,35 @@ HB_FUNC( ADSGETAOFOPTLEVEL ) HB_FUNC( ADSGETAOFNOOPT ) { - ADSAREAP pArea; + ADSAREAP pArea; UNSIGNED16 pusOptLevel; - UNSIGNED8 pucNonOpt[HARBOUR_MAX_RDD_FILTER_LENGTH+1]; + UNSIGNED8 pucNonOpt[HARBOUR_MAX_RDD_FILTER_LENGTH+1]; + UNSIGNED8 *pucNonOpt2; UNSIGNED16 pusLen = HARBOUR_MAX_RDD_FILTER_LENGTH; + UNSIGNED32 ulRetVal; pArea = (ADSAREAP) hb_rddGetCurrentWorkAreaPointer(); if( pArea ) { - AdsGetAOFOptLevel( pArea->hTable, &pusOptLevel, pucNonOpt, &pusLen ); - hb_retc( ( char * ) pucNonOpt ); + ulRetVal = AdsGetAOFOptLevel( pArea->hTable, &pusOptLevel, pucNonOpt, &pusLen ); + + if ( pusLen > HARBOUR_MAX_RDD_FILTER_LENGTH ) + { + pucNonOpt2 = (UNSIGNED8*) hb_xgrab(pusLen + 1); + ulRetVal = AdsGetAOFOptLevel( pArea->hTable, &pusOptLevel, pucNonOpt2, &pusLen ); + if ( ulRetVal == AE_SUCCESS ) + hb_retc( (char *) pucNonOpt2 ); + else + hb_retc( "" ); + + hb_xfree( pucNonOpt2 ); + } + else if ( ulRetVal == AE_SUCCESS ) + hb_retc( ( char * ) pucNonOpt ); + + else + hb_retc( "" ); + } else hb_errRT_DBCMD( EG_NOTABLE, 2001, NULL, "ADSGETAOFNOOPT" );