From a5a91411099e36778b7ac76173a33709f2a2ccb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Thu, 2 Jan 2014 13:11:38 +0100 Subject: [PATCH] 2014-01-02 13:11 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/rtl/itemseri.c ! fixed casting for C++ builds * contrib/rddads/ads1.c + use AdsIsNull() function instead of AdsIsEmpty() in DBS_ISNULL action for ACE library 9.0 or newer. * contrib/rddads/adsfunc.c * contrib/rddads/rddads.hbx + added new PRG function: AdsIsNull() For ACE libraries < 9.0 it's redirected to AdsIsEmpty() --- ChangeLog.txt | 13 +++++++++++++ contrib/rddads/ads1.c | 18 ++++++++++-------- contrib/rddads/adsfunc.c | 27 +++++++++++++++++++++++++++ contrib/rddads/rddads.hbx | 1 + src/rtl/itemseri.c | 2 +- 5 files changed, 52 insertions(+), 9 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 1334b472e6..16b9afb37f 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,19 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2014-01-02 13:11 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * src/rtl/itemseri.c + ! fixed casting for C++ builds + + * contrib/rddads/ads1.c + + use AdsIsNull() function instead of AdsIsEmpty() in DBS_ISNULL + action for ACE library 9.0 or newer. + + * contrib/rddads/adsfunc.c + * contrib/rddads/rddads.hbx + + added new PRG function: AdsIsNull() + For ACE libraries < 9.0 it's redirected to AdsIsEmpty() + 2013-12-27 02:46 UTC+0100 Viktor Szakáts (vszakats users.noreply.github.com) * ChangeLog.txt * cleaned away abandoned domain from old entries diff --git a/contrib/rddads/ads1.c b/contrib/rddads/ads1.c index dc4092908b..f38660e4e8 100644 --- a/contrib/rddads/ads1.c +++ b/contrib/rddads/ads1.c @@ -1962,24 +1962,25 @@ static HB_ERRCODE adsFieldInfo( ADSAREAP pArea, HB_USHORT uiIndex, HB_USHORT uiT { case DBS_ISNULL: { - UNSIGNED16 bEmpty; + UNSIGNED16 u16Null = 1; if( pArea->fPositioned ) { UNSIGNED32 u32RetVal; - u32RetVal = AdsIsEmpty( pArea->hTable, ADSFIELD( uiIndex ), &bEmpty ); +#if ADS_LIB_VERSION >= 900 + u32RetVal = AdsIsNull( pArea->hTable, ADSFIELD( uiIndex ), &u16Null ); +#else + u32RetVal = AdsIsEmpty( pArea->hTable, ADSFIELD( uiIndex ), &u16Null ); +#endif if( u32RetVal != AE_SUCCESS ) { commonError( pArea, EG_READ, ( HB_ERRCODE ) u32RetVal, 0, NULL, 0, NULL ); return HB_FAILURE; } } - else - bEmpty = 1; - - hb_itemPutL( pItem, bEmpty != 0 ); - return HB_SUCCESS; + hb_itemPutL( pItem, u16Null != 0 ); + break; } case DBS_TYPE: @@ -2076,11 +2077,12 @@ static HB_ERRCODE adsFieldInfo( ADSAREAP pArea, HB_USHORT uiIndex, HB_USHORT uiT hb_itemPutC( pItem, "U" ); break; } - return HB_SUCCESS; + break; default: return SUPER_FIELDINFO( ( AREAP ) pArea, uiIndex, uiType, pItem ); } + return HB_SUCCESS; } static HB_ERRCODE adsFieldName( ADSAREAP pArea, HB_USHORT uiIndex, void * szName ) diff --git a/contrib/rddads/adsfunc.c b/contrib/rddads/adsfunc.c index f0fc3790a6..22d30f5a34 100644 --- a/contrib/rddads/adsfunc.c +++ b/contrib/rddads/adsfunc.c @@ -1720,6 +1720,33 @@ HB_FUNC( ADSISEMPTY ) hb_errRT_DBCMD( EG_ARG, 1014, NULL, HB_ERR_FUNCNAME ); } +HB_FUNC( ADSISNULL ) +{ + if( HB_ISCHAR( 1 ) || HB_ISNUM( 1 ) ) + { + UNSIGNED16 u16Null = 0; + ADSAREAP pArea = hb_adsGetWorkAreaPointer(); + + if( pArea ) + { +#if ADS_LIB_VERSION >= 900 + AdsIsNull( pArea->hTable, + ( HB_ISCHAR( 1 ) ? ( UNSIGNED8 * ) hb_parcx( 1 ) : ADSFIELD( hb_parni( 1 ) ) ) /* pucFldName */, + &u16Null ); +#else + AdsIsEmpty( pArea->hTable, + ( HB_ISCHAR( 1 ) ? ( UNSIGNED8 * ) hb_parcx( 1 ) : ADSFIELD( hb_parni( 1 ) ) ) /* pucFldName */, + &u16Null ); +#endif + hb_retl( u16Null != 0 ); + } + else + hb_errRT_DBCMD( EG_NOTABLE, 2001, NULL, HB_ERR_FUNCNAME ); + } + else + hb_errRT_DBCMD( EG_ARG, 1014, NULL, HB_ERR_FUNCNAME ); +} + HB_FUNC( ADSGETNUMACTIVELINKS ) /* Only valid for a DataDict */ { UNSIGNED16 pusNumLinks = 0; diff --git a/contrib/rddads/rddads.hbx b/contrib/rddads/rddads.hbx index b32972f040..54164d3de7 100644 --- a/contrib/rddads/rddads.hbx +++ b/contrib/rddads/rddads.hbx @@ -104,6 +104,7 @@ DYNAMIC AdsIsEmpty DYNAMIC AdsIsEncryptionEnabled DYNAMIC AdsIsExprValid DYNAMIC AdsIsIndexed +DYNAMIC AdsIsNull DYNAMIC AdsIsRecordEncrypted DYNAMIC AdsIsRecordInAOF DYNAMIC AdsIsRecordLocked diff --git a/src/rtl/itemseri.c b/src/rtl/itemseri.c index bdd7f0839d..8f26223cd7 100644 --- a/src/rtl/itemseri.c +++ b/src/rtl/itemseri.c @@ -1672,7 +1672,7 @@ char * hb_itemSerializeCP( PHB_ITEM pItem, int iFlags, if( ( iFlags & HB_SERIALIZE_COMPRESS ) != 0 && nSize > 20 ) { HB_SIZE nDest = hb_zlibCompressBound( nSize ); - char * pDest = hb_xgrab( nDest ); + char * pDest = ( char * ) hb_xgrab( nDest ); if( hb_zlibCompress( pDest, &nDest, ( const char * ) pBuffer, nSize, HB_ZLIB_COMPRESSION_DEFAULT ) == HB_ZLIB_RES_OK ) {