From 9bf86a32534bec7263225b0dd262c855113ab279 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Thu, 8 Oct 2009 14:42:24 +0000 Subject: [PATCH] 2009-10-08 16:42 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/rdd/dbfntx/dbfntx1.c * harbour/source/rdd/dbfnsx/dbfnsx1.c * harbour/source/rdd/dbfcdx/dbfcdx1.c * minor cleanup * harbour/source/rdd/dbf1.c ! fixed GPF trap in DBINFO( DBI_MEMOHANDLE ) executed for tables without any memo fields - thank to Saulius for information and self contain example. --- harbour/ChangeLog | 11 +++++++++++ harbour/source/rdd/dbf1.c | 6 ++++-- harbour/source/rdd/dbfcdx/dbfcdx1.c | 5 +---- harbour/source/rdd/dbfnsx/dbfnsx1.c | 15 ++++++++------- harbour/source/rdd/dbfntx/dbfntx1.c | 15 ++++++++------- 5 files changed, 32 insertions(+), 20 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bbfa886372..da79f45cef 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,17 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-10-08 16:42 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/rdd/dbfntx/dbfntx1.c + * harbour/source/rdd/dbfnsx/dbfnsx1.c + * harbour/source/rdd/dbfcdx/dbfcdx1.c + * minor cleanup + + * harbour/source/rdd/dbf1.c + ! fixed GPF trap in DBINFO( DBI_MEMOHANDLE ) executed for tables without + any memo fields - thank to Saulius for information and self contain + example. + 2009-10-08 16:11 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.pt_BR.po * utils/hbmk2/hbmk2.hu_HU.po diff --git a/harbour/source/rdd/dbf1.c b/harbour/source/rdd/dbf1.c index 1ef687184e..ea547313a1 100644 --- a/harbour/source/rdd/dbf1.c +++ b/harbour/source/rdd/dbf1.c @@ -3298,11 +3298,13 @@ static HB_ERRCODE hb_dbfInfo( DBFAREAP pArea, USHORT uiIndex, PHB_ITEM pItem ) break; case DBI_FILEHANDLE: - hb_itemPutNInt( pItem, ( HB_NHANDLE ) hb_fileHandle( pArea->pDataFile ) ); + hb_itemPutNInt( pItem, pArea->pDataFile ? + ( HB_NHANDLE ) hb_fileHandle( pArea->pDataFile ) : FS_ERROR ); break; case DBI_MEMOHANDLE: - hb_itemPutNInt( pItem, ( HB_NHANDLE ) hb_fileHandle( pArea->pMemoFile ) ); + hb_itemPutNInt( pItem, pArea->pMemoFile ? + ( HB_NHANDLE ) hb_fileHandle( pArea->pMemoFile ) : FS_ERROR ); break; case DBI_SHARED: diff --git a/harbour/source/rdd/dbfcdx/dbfcdx1.c b/harbour/source/rdd/dbfcdx/dbfcdx1.c index e19db4b227..91ac724a50 100644 --- a/harbour/source/rdd/dbfcdx/dbfcdx1.c +++ b/harbour/source/rdd/dbfcdx/dbfcdx1.c @@ -7352,10 +7352,7 @@ static HB_ERRCODE hb_cdxOrderListFocus( CDXAREAP pArea, LPDBORDERINFO pOrderInfo pOrderInfo->itmResult = hb_itemPutC( pOrderInfo->itmResult, pTag->szName ); if( pOrderInfo->itmOrder ) - { - hb_cdxFindTag( pArea, pOrderInfo->itmOrder, pOrderInfo->atomBagName, &(pArea->uiTag) ); - /* TODO: RTerror if not found? */ - } + hb_cdxFindTag( pArea, pOrderInfo->itmOrder, pOrderInfo->atomBagName, &pArea->uiTag ); return HB_SUCCESS; } diff --git a/harbour/source/rdd/dbfnsx/dbfnsx1.c b/harbour/source/rdd/dbfnsx/dbfnsx1.c index e5f4023f39..8a002bb50c 100644 --- a/harbour/source/rdd/dbfnsx/dbfnsx1.c +++ b/harbour/source/rdd/dbfnsx/dbfnsx1.c @@ -7908,6 +7908,8 @@ static HB_ERRCODE hb_nsxOrderListFocus( NSXAREAP pArea, LPDBORDERINFO pOrderInfo if( pOrderInfo->itmOrder ) { + LPTAGINFO pTag = hb_nsxFindTag( pArea, pOrderInfo->itmOrder, + pOrderInfo->atomBagName ); /* * In Clipper 5.3 DBFCDX (COMIX) when bad name or order is given * tag number is set to 0 (natural record order). CL52 RDDs and @@ -7916,14 +7918,13 @@ static HB_ERRCODE hb_nsxOrderListFocus( NSXAREAP pArea, LPDBORDERINFO pOrderInfo * RDDs and I chosen DBFCDX one as default. [druzus] */ #ifdef HB_CLP_STRICT - LPTAGINFO pTag = hb_nsxFindTag( pArea, pOrderInfo->itmOrder, - pOrderInfo->atomBagName ); - if( pTag ) - pArea->lpCurTag = pTag; -#else - pArea->lpCurTag = hb_nsxFindTag( pArea, pOrderInfo->itmOrder, - pOrderInfo->atomBagName ); + if( pTag || + ( HB_IS_NUMERIC( pOrderInfo->itmOrder ) && + hb_itemGetNI( pOrderInfo->itmOrder ) == 0 ) || + ( HB_IS_STRING( pOrderInfo->itmOrder ) && + hb_itemGetCLen( pOrderInfo->itmOrder ) == 0 ) ) #endif + pArea->lpCurTag = pTag; } return HB_SUCCESS; diff --git a/harbour/source/rdd/dbfntx/dbfntx1.c b/harbour/source/rdd/dbfntx/dbfntx1.c index d520e8bee4..944841dd29 100644 --- a/harbour/source/rdd/dbfntx/dbfntx1.c +++ b/harbour/source/rdd/dbfntx/dbfntx1.c @@ -7540,20 +7540,21 @@ static HB_ERRCODE hb_ntxOrderListFocus( NTXAREAP pArea, LPDBORDERINFO pOrderInfo if( pOrderInfo->itmOrder ) { + LPTAGINFO pTag = hb_ntxFindTag( pArea, pOrderInfo->itmOrder, + pOrderInfo->atomBagName ); /* * In Clipper tag is not changed when bad name is given in DBFNTX * but not in DBFCDX. I'd like to keep the same behavior in * [x]Harbour RDDs and I chosen DBFCDX one as default. [druzus] */ #ifdef HB_CLP_STRICT - LPTAGINFO pTag = hb_ntxFindTag( pArea, pOrderInfo->itmOrder, - pOrderInfo->atomBagName ); - if( pTag ) - pArea->lpCurTag = pTag; -#else - pArea->lpCurTag = hb_ntxFindTag( pArea, pOrderInfo->itmOrder, - pOrderInfo->atomBagName ); + if( pTag || + ( HB_IS_NUMERIC( pOrderInfo->itmOrder ) && + hb_itemGetNI( pOrderInfo->itmOrder ) == 0 ) || + ( HB_IS_STRING( pOrderInfo->itmOrder ) && + hb_itemGetCLen( pOrderInfo->itmOrder ) == 0 ) ) #endif + pArea->lpCurTag = pTag; } return HB_SUCCESS;