diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 3901663788..02958d587f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,8 @@ +2001-11-23 17:57 GMT-3 Horacio Roldan + * source/rdd/dbfcdx/dbfcdx1.c + ! fixed gpf with autoopen + ! fixed dbSeek for padded strings + 2001-11-22 23:55 UTC-0800 Brian Hays * contrib/rdd_ads/ads1.c diff --git a/harbour/source/rdd/dbfcdx/dbfcdx1.c b/harbour/source/rdd/dbfcdx/dbfcdx1.c index e9f869d8fd..b5a41b987b 100644 --- a/harbour/source/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/source/rdd/dbfcdx/dbfcdx1.c @@ -847,11 +847,11 @@ ERRCODE hb_cdxOpen( CDXAREAP pArea, LPDBOPENINFO pOpenInfo ) /* If SET_AUTOPEN open index */ if( pArea->fHasTags && hb_set.HB_SET_AUTOPEN ) { - /* printf("TODO: hb_cdxOpen()\n"); */ pFileName = hb_fsFNameSplit( pArea->szDataFileName ); szFileName = ( char * ) hb_xgrab( _POSIX_PATH_MAX + 3 ); szFileName[ 0 ] = '\0'; - strcpy ( szFileName, pFileName->szPath ); + if ( pFileName->szPath ) + strcpy ( szFileName, pFileName->szPath ); strncat( szFileName, pFileName->szName, _POSIX_PATH_MAX - strlen( szFileName ) ); @@ -862,8 +862,6 @@ ERRCODE hb_cdxOpen( CDXAREAP pArea, LPDBOPENINFO pOpenInfo ) hb_itemRelease( pExtInfo.itmResult ); hb_xfree( pFileName ); - /* ---------- */ - uiFlags = pArea->fReadonly ? FO_READ : FO_READWRITE; uiFlags |= pArea->fShared ? FO_DENYNONE : FO_EXCLUSIVE; hFile = hb_fsOpen( ( BYTE * ) szFileName, uiFlags ); @@ -4580,6 +4578,26 @@ ERRCODE hb_cdxSeek( CDXAREAP pArea, BOOL bSoftSeek, PHB_ITEM pKey, BOOL bFindLas pArea->fBof = pTag->TagBOF; hb_cdxKeyFree( pKey2 ); if ( lRecno > 0 ) + { + switch ( pTag->uiType ) + { + case 'C': + /* fix for key trimming*/ + if ( (USHORT) pKey->item.asString.length > pTag->uiLen) + { + lRecno = 0; + pTag->TagEOF = 1; + } + else if ( strncmp( pKey->item.asString.value, pTag->CurKeyInfo->Value, + (pKey->item.asString.length < pTag->CurKeyInfo->length ? + pKey->item.asString.length : pTag->CurKeyInfo->length) ) != 0) + { + lRecno = 0; + } + break; + } + } + if ( lRecno > 0 ) { retvalue = SELF_GOTO( ( AREAP ) pArea, pTag->CurKeyInfo->Tag ); pArea->fFound = TRUE;