diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ddbc79eb7b..7cb5c05aaa 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,19 @@ +2001-11-21 17:45 UTC-0800 Brian Hays + + * source/rtl/strcase.c + + added hb_strncpyUpperTrim to both upperize and trim + + * contrib/rdd_ads/ads1.c + * removed bad pointer initialization + + * source/rdd/dbcmd.c + * fieldpos() now calls hb_strncpyUpperTrim so padded + field names don't fail + + * contrib/rdd_ads/adsfunc.c + * fixed AdsGetAOFOptLevel to return correct value if there's + no AOF active + 2001-11-22 04:45 GMT+0700 Andi Jahja * contrib/libnf/getvid.c ! HB_FUNC(_V_SETVPG), use int iPage only if HB_OS_DOS is defined diff --git a/harbour/contrib/rdd_ads/ads1.c b/harbour/contrib/rdd_ads/ads1.c index 3bbe09c172..95b39e4830 100644 --- a/harbour/contrib/rdd_ads/ads1.c +++ b/harbour/contrib/rdd_ads/ads1.c @@ -2085,8 +2085,7 @@ static ERRCODE adsSetScope( ADSAREAP pArea, LPDBORDSCOPEINFO sInfo ) UNSIGNED16 pus16KeyType = 0; AdsGetKeyType(pArea->hOrdCurrent, &pus16KeyType); - /* make sure passed item has same type as index: if not leave pucScope == NULL */ - pucScope[0] = 0; + /* make sure passed item has same type as index */ switch( pus16KeyType ) { case ADS_STRING: @@ -2124,18 +2123,19 @@ static ERRCODE adsSetScope( ADSAREAP pArea, LPDBORDSCOPEINFO sInfo ) */ break; - case ADS_LOGICAL: +/* case ADS_LOGICAL: if ( sInfo->scopeValue->type == HB_IT_LOGICAL ) { bTypeError = FALSE; if ( hb_itemGetL( sInfo->scopeValue ) ) { + pucScope[0] = 1; pucScope[1] = 0; } } break; - +*/ } /* if ( bTypeError ) */ /* { */ diff --git a/harbour/contrib/rdd_ads/adsfunc.c b/harbour/contrib/rdd_ads/adsfunc.c index d833fe32c2..a095e4009c 100644 --- a/harbour/contrib/rdd_ads/adsfunc.c +++ b/harbour/contrib/rdd_ads/adsfunc.c @@ -157,14 +157,14 @@ HB_FUNC( ADSISSERVERLOADED ) nConnToCheck = adsConnectHandle; if ( !nConnToCheck ) - { - nConnToCheck = adsConnectHandle; + { + nConnToCheck = adsConnectHandle; - } - ulRetVal = AdsGetConnectionType (adsConnectHandle, &pusConnectType) ; + } + ulRetVal = AdsGetConnectionType (adsConnectHandle, &pusConnectType) ; - if ( ulRetVal != AE_SUCCESS ) - pusConnectType = 0; + if ( ulRetVal != AE_SUCCESS ) + pusConnectType = 0; hb_retnl( pusConnectType ); } */ @@ -579,13 +579,15 @@ HB_FUNC( ADSGETAOFOPTLEVEL ) UNSIGNED16 pusOptLevel; UNSIGNED8 pucNonOpt[1]; UNSIGNED16 pusLen = 0; + UNSIGNED32 ulRetVal; pArea = (ADSAREAP) hb_rddGetCurrentWorkAreaPointer(); if( pArea ) { - AdsGetAOFOptLevel( pArea->hTable, &pusOptLevel, pucNonOpt, &pusLen ); - hb_retni( pusOptLevel > 65000 ? ADS_OPTIMIZED_NONE : pusOptLevel ); - /* If no aof, returns 65,353 */ + ulRetVal = AdsGetAOF( pArea->hTable, pucNonOpt, &pusLen ); + if ( ulRetVal == AE_SUCCESS ) + ulRetVal = AdsGetAOFOptLevel( pArea->hTable, &pusOptLevel, pucNonOpt, &pusLen ); + hb_retni( ulRetVal == AE_SUCCESS ? pusOptLevel : ADS_OPTIMIZED_NONE ); } else hb_errRT_DBCMD( EG_NOTABLE, 2001, NULL, "ADSGETAOFOPTLEVEL" ); diff --git a/harbour/source/rdd/dbcmd.c b/harbour/source/rdd/dbcmd.c index 5b71331960..91cfb0a5c9 100644 --- a/harbour/source/rdd/dbcmd.c +++ b/harbour/source/rdd/dbcmd.c @@ -2052,7 +2052,7 @@ HB_FUNC( FIELDPOS ) if( s_pCurrArea ) { - hb_strncpyUpper( szName, hb_parc( 1 ), hb_parclen( 1 ) ); + hb_strncpyUpperTrim( szName, hb_parc( 1 ), hb_parclen( 1 ) ); hb_retni( hb_rddFieldIndex( ( AREAP ) s_pCurrArea->pArea, szName ) ); } else diff --git a/harbour/source/rtl/strcase.c b/harbour/source/rtl/strcase.c index f65952c794..85197a4f87 100644 --- a/harbour/source/rtl/strcase.c +++ b/harbour/source/rtl/strcase.c @@ -99,6 +99,29 @@ char * hb_strncpyUpper( char * pDest, const char * pSource, ULONG ulLen ) return pDest; } +/* This function copies and converts szText to upper case AND Trims it + */ +char * hb_strncpyUpperTrim( char * pDest, const char * pSource, ULONG ulLen ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_strncpyUpper(%p, %s, %lu)", pDest, pSource, ulLen)); + + pDest[ ulLen ] ='\0'; + + while( ulLen-- && pSource[ ulLen ] == ' ') + pDest[ ulLen ] = '\0'; + + ulLen++; + while( ulLen-- ) + { + /* some compilers impliment toupper as a macro, and this has side effects! */ + /* *pDest++ = toupper( *pSource++ ); */ + pDest[ ulLen ] = toupper( pSource[ ulLen ] ); + } + + return pDest; +} + + /* converts string to lower case */ HB_FUNC( LOWER ) {