2001-06-19 17:40 UTC-0800 Ron Pinkas <ron@profit-master.com>

! contrib/rdd_ads/ads1.c
   ! contrib/rdd_ads/adsfunc.c
   ! contrib/rdd_ads/adsmgmnt.c
     + Added many missing type casting required for C++ compilers.

   ! contrib/rdd_ads/makefile.vc
     + Added missing -DWIN32 to CFLAGS

   /* RDDADS.lib can now be built with MSVC using the supplied contrib/rdd_ads/make_vc.bat */
This commit is contained in:
Ron Pinkas
2001-06-19 19:30:44 +00:00
parent 403285712b
commit b04992a314
5 changed files with 86 additions and 72 deletions

View File

@@ -1,3 +1,14 @@
2001-06-19 17:40 UTC-0800 Ron Pinkas <ron@profit-master.com>
! contrib/rdd_ads/ads1.c
! contrib/rdd_ads/adsfunc.c
! contrib/rdd_ads/adsmgmnt.c
+ Added many missing type casting required for C++ compilers.
! contrib/rdd_ads/makefile.vc
+ Added missing -DWIN32 to CFLAGS
/* RDDADS.lib can now be built with MSVC using the supplied contrib/rdd_ads/make_vc.bat */
2001-06-19 14:50 UTC-0400 David G. Holm <dholm@jsd-llc.com>
* source\rtl\browdbx.prg

View File

@@ -118,7 +118,7 @@ static void DumpArea( ADSAREAP pArea ) /* For debugging: call this to dump ads
UNSIGNED32 ulRetVal, ulRetAOF, ulRetFilt;
UNSIGNED8 pucFormat[16];
UNSIGNED8 pucFilter[1025];
UNSIGNED8 aucBuffer[MAX_STR_LEN + 1];
/*UNSIGNED8 aucBuffer[MAX_STR_LEN + 1];*/
UNSIGNED8 pucIndexName[MAX_STR_LEN + 1];
UNSIGNED8 pucIndexExpr[MAX_STR_LEN + 1];
UNSIGNED8 pucIndexCond[MAX_STR_LEN + 1];
@@ -505,7 +505,7 @@ static ERRCODE adsSeek( ADSAREAP pArea, BOOL bSoftSeek, PHB_ITEM pKey, BOOL bFin
{
double dTemp;
dTemp = hb_itemGetND( pKey );
AdsSeekLast( pArea->hOrdCurrent, (char *) &dTemp,
AdsSeekLast( pArea->hOrdCurrent, (UNSIGNED8 *) &dTemp,
8, ADS_DOUBLEKEY, (UNSIGNED16*) &(pArea->fFound) );
}else
{
@@ -525,7 +525,7 @@ static ERRCODE adsSeek( ADSAREAP pArea, BOOL bSoftSeek, PHB_ITEM pKey, BOOL bFin
{
double dTemp;
dTemp = hb_itemGetND( pKey );
AdsSeek( pArea->hOrdCurrent, (char *) &dTemp,
AdsSeek( pArea->hOrdCurrent, (UNSIGNED8 *) &dTemp,
8, ADS_DOUBLEKEY, usSeekType, (UNSIGNED16*) &(pArea->fFound) );
}
/*
@@ -561,7 +561,7 @@ static ERRCODE adsSeek( ADSAREAP pArea, BOOL bSoftSeek, PHB_ITEM pKey, BOOL bFin
static ERRCODE adsSkip( ADSAREAP pArea, LONG lToSkip )
{
ERRCODE uiError;
/*ERRCODE uiError;*/
LONG lUnit = 1;
LONG lCount = lToSkip;
LONG lReturn ;
@@ -625,7 +625,7 @@ static ERRCODE adsSkip( ADSAREAP pArea, LONG lToSkip )
lCount--;
}
return lReturn;
return (ERRCODE) lReturn;
}
}
@@ -772,11 +772,11 @@ static ERRCODE adsGetValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
pArea->fEof = TRUE;
}
if( pField->uiDec )
hb_itemPutNDLen( pItem, atof( pBuffer ),
hb_itemPutNDLen( pItem, atof( (char *) pBuffer ),
( int ) pField->uiLen - ( ( int ) pField->uiDec + 1 ),
( int ) pField->uiDec );
else
hb_itemPutNLLen( pItem, atol( pBuffer ), ( int ) pField->uiLen );
hb_itemPutNLLen( pItem, atol( (char *) pBuffer ), ( int ) pField->uiLen );
break;
case HB_IT_DATE:
@@ -791,7 +791,7 @@ static ERRCODE adsGetValue( ADSAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
memset( pBuffer, ' ', pField->uiLen );
pArea->fEof = TRUE;
}
hb_itemPutDS( pItem, pBuffer );
hb_itemPutDS( pItem, (char *) pBuffer );
AdsSetDateFormat ( pucFormat );
break;
}
@@ -1035,7 +1035,7 @@ static ERRCODE adsCreate( ADSAREAP pArea, LPDBOPENINFO pCreateInfo)
HB_TRACE(HB_TR_DEBUG, ("adsCreate(%p, %p)", pArea, pCreateInfo));
pArea->szDataFileName = hb_xgrab( strlen(pCreateInfo->abName)+1 );
pArea->szDataFileName = (char *) hb_xgrab( strlen( (char *) ( pCreateInfo->abName)+1 ) );
strcpy( pArea->szDataFileName, ( char * ) pCreateInfo->abName );
uiLen = (pArea->uiFieldCount * 22) + 1;
ucfieldDefs = (UNSIGNED8 *) hb_xgrab( uiLen );
@@ -1097,7 +1097,7 @@ static ERRCODE adsCreate( ADSAREAP pArea, LPDBOPENINFO pCreateInfo)
hb_xfree(ucfieldDefs);
if( uRetVal != AE_SUCCESS )
{
AdsShowError( "Error" );
AdsShowError( (UNSIGNED8 *) "Error" );
return FAILURE;
}
AdsCloseTable(hTable); // TODO: it would be nice if a parameter could be passed in to allow this to stay open to support the 4th parameter of dbCreate. As is, we have to close it here, then re-open it.
@@ -1203,7 +1203,7 @@ static ERRCODE adsOpen( ADSAREAP pArea, LPDBOPENINFO pOpenInfo )
if( pOpenInfo->atomAlias )
{
pArea->szDataFileName = hb_xgrab( strlen(pOpenInfo->abName)+1 );
pArea->szDataFileName = (char *) hb_xgrab( strlen( (char *) ( pOpenInfo->abName)+1 ) );
strcpy( pArea->szDataFileName, ( char * ) pOpenInfo->abName );
pArea->atomAlias = hb_dynsymGet( ( char * ) pOpenInfo->atomAlias );
if( ( ( PHB_DYNS ) pArea->atomAlias )->hArea )
@@ -1307,7 +1307,7 @@ static ERRCODE adsSysName( ADSAREAP pArea, BYTE * pBuffer )
{
HB_TRACE(HB_TR_DEBUG, ("adsSysName(%p, %p)", pArea, pBuffer));
HB_SYMBOL_UNUSED( pArea );
strcpy(pBuffer, "ADS");
strcpy( (char *) pBuffer, "ADS");
return SUCCESS;
}
@@ -1375,7 +1375,10 @@ static ERRCODE adsSetRel( ADSAREAP pArea, LPDBRELINFO lpdbRelations )
HB_TRACE(HB_TR_DEBUG, ("adsSetRel(%p, %p)", pArea, lpdbRelations));
SUPER_SETREL( ( AREAP ) pArea, lpdbRelations );
if( !( hIndex = ( (ADSAREAP)lpdbRelations->lpaChild )->hOrdCurrent ) )
hIndex = ( (ADSAREAP)lpdbRelations->lpaChild )->hOrdCurrent;
if( ! hIndex )
return FAILURE;
if( !lpdbRelations->abKey )
return FAILURE;
@@ -1513,14 +1516,14 @@ static ERRCODE adsOrderCreate( ADSAREAP pArea, LPDBORDERCREATEINFO pOrderInfo )
pucWhile[pusLen] = 0;
if ( pus16 == ADS_STRING ) /* add quotation marks around the key */
{
strcat(pucWhile, "<=\"");
strcat(pucWhile, pucScope );
strcat(pucWhile, "\"" );
strcat( (char * ) pucWhile, "<=\"");
strcat( (char * ) pucWhile, (char * ) pucScope );
strcat( (char * ) pucWhile, "\"" );
}
else
{
strcat(pucWhile, "<=");
strcat(pucWhile, pucScope );
strcat( (char * ) pucWhile, "<=");
strcat( (char * ) pucWhile, (char * ) pucScope );
}
}
hTableOrIndex = pArea->hOrdCurrent;
@@ -1977,7 +1980,7 @@ static ERRCODE adsSetFilter( ADSAREAP pArea, LPDBFILTERINFO pFilterInfo )
static ERRCODE adsSetScope( ADSAREAP pArea, LPDBORDSCOPEINFO sInfo )
{
UNSIGNED8 aucKey[ADS_MAX_KEY_LENGTH];
/* UNSIGNED8 aucKey[ADS_MAX_KEY_LENGTH]; */
HB_TRACE(HB_TR_DEBUG, ("adsSetScope(%p, %p)", pArea, sInfo));
if( pArea->hOrdCurrent )
@@ -2084,27 +2087,27 @@ static ERRCODE adsUnLock( ADSAREAP pArea, ULONG lRecNo )
static ERRCODE adsDrop( PHB_ITEM pItemTable )
{
BYTE * pBuffer;
char * pBuffer;
char szFileName[ _POSIX_PATH_MAX + 1 ];
pBuffer = hb_itemGetCPtr( pItemTable );
strcpy( szFileName, pBuffer );
if ( !strchr( szFileName, '.' ))
strcat( szFileName, ((adsFileType==ADS_ADT) ? ".adt" : ".dbf") );
return hb_fsDelete( szFileName );
return hb_fsDelete( (BYTE *) szFileName );
}
/* returns 1 if exists, 0 else */
BOOL adsExists( PHB_ITEM pItemTable, PHB_ITEM pItemIndex )
{
char szFileName[ _POSIX_PATH_MAX + 1 ];
BYTE * pBuffer;
char * pBuffer;
pBuffer = hb_itemGetCPtr( pItemIndex != NULL ? pItemIndex : pItemTable );
strcpy( szFileName, pBuffer );
if ( pItemTable && !strchr( szFileName, '.' ))
strcat( szFileName, ((adsFileType==ADS_ADT) ? ".adt" : ".dbf") );
return hb_fsFile( szFileName );
return hb_fsFile( (BYTE *) szFileName );
}

View File

@@ -105,7 +105,7 @@ HB_FUNC( ADSSETDATEFORMAT )
hb_retc( "");
AdsGetDateFormat (pucFormat, &pusLen);
if ( pusLen > 0 )
hb_retc( pucFormat );
hb_retc( (char *) pucFormat );
if( ISCHAR( 1 ))
{
@@ -565,7 +565,7 @@ HB_FUNC( ADSGETFILTER )
pucFilter2 = (UNSIGNED8*) hb_xgrab(pusLen + 1);
ulRetVal = AdsGetFilter( pArea->hTable, pucFilter2, &pusLen );
if ( ulRetVal == AE_SUCCESS )
hb_retc( pucFilter2 );
hb_retc( (char *) pucFilter2 );
else
{
HB_TRACE(HB_TR_DEBUG, ("adsGetFilter Error %lu", ulRetVal));
@@ -574,7 +574,7 @@ HB_FUNC( ADSGETFILTER )
}
else if ( ulRetVal == AE_SUCCESS )
{
hb_retc( pucFilter );
hb_retc( (char *) pucFilter );
}
else
{
@@ -807,7 +807,7 @@ HB_FUNC( ADSEXECUTESQLDIRECT )
&& pArea->hStatement && ISCHAR( 1 ) )
{
adsCloseCursor( pArea );
ulRetVal = AdsExecuteSQLDirect( pArea->hStatement, hb_parc( 1 ), &hCursor );
ulRetVal = AdsExecuteSQLDirect( pArea->hStatement, (UNSIGNED8 *) hb_parc( 1 ), &hCursor );
if( ulRetVal == AE_SUCCESS )
{
if( hCursor )
@@ -820,7 +820,7 @@ HB_FUNC( ADSEXECUTESQLDIRECT )
}
else
{
AdsShowError( "ExecuteSQL error:" );
AdsShowError( (UNSIGNED8 *) "ExecuteSQL error:" );
hb_retl( 0 );
}
}
@@ -837,12 +837,12 @@ HB_FUNC( ADSPREPARESQL )
&& pArea->hStatement && ISCHAR( 1 ) )
{
adsCloseCursor( pArea );
ulRetVal = AdsPrepareSQL( pArea->hStatement, hb_parc( 1 ) );
ulRetVal = AdsPrepareSQL( pArea->hStatement, (UNSIGNED8 *) hb_parc( 1 ) );
if( ulRetVal == AE_SUCCESS )
hb_retl( 1 );
else
{
AdsShowError( "PrepareSQL error:" );
AdsShowError( (UNSIGNED8 *) "PrepareSQL error:" );
hb_retl( 0 );
}
}
@@ -874,7 +874,7 @@ HB_FUNC( ADSEXECUTESQL )
}
else
{
AdsShowError( "ExecuteSQL error:" );
AdsShowError( (UNSIGNED8 *) "ExecuteSQL error:" );
hb_retl( 0 );
}
}
@@ -901,7 +901,7 @@ HB_FUNC( ADSCOPYTABLE )
{
if( ISCHAR( 1 ) )
{
AdsCopyTable( pArea->hTable, ADS_RESPECTFILTERS, hb_parc( 1 ) );
AdsCopyTable( pArea->hTable, ADS_RESPECTFILTERS, (UNSIGNED8 *) hb_parc( 1 ) );
}
else
{
@@ -930,7 +930,7 @@ HB_FUNC( ADSCONVERTTABLE )
if( usTableType < 1 || usTableType > 3 )
usTableType = ADS_ADT;
}
AdsConvertTable( pArea->hTable, ADS_IGNOREFILTERS, hb_parc( 1 ), usTableType );
AdsConvertTable( pArea->hTable, ADS_IGNOREFILTERS, (UNSIGNED8 *) hb_parc( 1 ), usTableType );
}
else
{

View File

@@ -71,7 +71,7 @@ HB_FUNC( ADSMGCONNECT )
// ADSHANDLE *phMgmtHandle );
*/
hb_retnl( AdsMgConnect( hb_parc(1), hb_parc(2), hb_parc(3), &hMgmtHandle) );
hb_retnl( AdsMgConnect( (UNSIGNED8 *) hb_parc(1), (UNSIGNED8 *) hb_parc(2), (UNSIGNED8 *) hb_parc(3), &hMgmtHandle) );
}
HB_FUNC( ADSMGDISCONNECT )
@@ -96,14 +96,14 @@ HB_FUNC( ADSMGGETINSTALLINFO )
if ( ulRetVal == AE_SUCCESS )
{
hb_reta( 8 );
hb_stornl( stInstallInfo.ulUserOption , -1, 1 ); /* User option purchased*/
hb_storc ( stInstallInfo.aucRegisteredOwner,-1, 2 ); /* Registered owner */
hb_storc ( stInstallInfo.aucVersionStr , -1, 3 ); /* Advantage version */
hb_storc ( stInstallInfo.aucInstallDate , -1, 4 ); /* Install date string */
hb_storc ( stInstallInfo.aucOemCharName , -1, 5 ); /* OEM char language */
hb_storc ( stInstallInfo.aucAnsiCharName , -1, 6 ); /* ANSI char language */
hb_storc ( stInstallInfo.aucEvalExpireDate, -1, 7 ); /* Eval expiration date */
hb_storc ( stInstallInfo.aucSerialNumber , -1, 8 ); /* Serial number string */
hb_stornl( stInstallInfo.ulUserOption , -1, 1 ); /* User option purchased*/
hb_storc ( (char *) stInstallInfo.aucRegisteredOwner, -1, 2 ); /* Registered owner */
hb_storc ( (char *) stInstallInfo.aucVersionStr , -1, 3 ); /* Advantage version */
hb_storc ( (char *) stInstallInfo.aucInstallDate , -1, 4 ); /* Install date string */
hb_storc ( (char *) stInstallInfo.aucOemCharName , -1, 5 ); /* OEM char language */
hb_storc ( (char *) stInstallInfo.aucAnsiCharName , -1, 6 ); /* ANSI char language */
hb_storc ( (char *) stInstallInfo.aucEvalExpireDate , -1, 7 ); /* Eval expiration date */
hb_storc ( (char *) stInstallInfo.aucSerialNumber , -1, 8 ); /* Serial number string */
}
else
hb_ret( );
@@ -300,32 +300,32 @@ HB_FUNC( ADSMGGETCONFIGINFO )
if ( iOption == 0 )
{
hb_reta( 26 );
hb_stornl( stConfigValues.ulNumConnections , -1, 1 ); /* number connections */
hb_stornl( stConfigValues.ulNumWorkAreas , -1, 2 ); /* number work areas */
hb_stornl( stConfigValues.ulNumTables , -1, 3 ); /* number tables */
hb_stornl( stConfigValues.ulNumIndexes , -1, 4 ); /* number indexes */
hb_stornl( stConfigValues.ulNumLocks , -1, 5 ); /* number locks */
hb_stornl( stConfigValues.ulUserBufferSize , -1, 6 ); /* user buffer */
hb_stornl( stConfigValues.ulStatDumpInterval , -1, 7 ); /* statistics dump interval */
hb_stornl( stConfigValues.ulErrorLogMax , -1, 8 ); /* max size of error log */
hb_stornl( stConfigValues.ulNumTPSHeaderElems , -1, 9 ); /* number TPS header elems */
hb_stornl( stConfigValues.ulNumConnections , -1, 1 ); /* number connections */
hb_stornl( stConfigValues.ulNumWorkAreas , -1, 2 ); /* number work areas */
hb_stornl( stConfigValues.ulNumTables , -1, 3 ); /* number tables */
hb_stornl( stConfigValues.ulNumIndexes , -1, 4 ); /* number indexes */
hb_stornl( stConfigValues.ulNumLocks , -1, 5 ); /* number locks */
hb_stornl( stConfigValues.ulUserBufferSize , -1, 6 ); /* user buffer */
hb_stornl( stConfigValues.ulStatDumpInterval , -1, 7 ); /* statistics dump interval */
hb_stornl( stConfigValues.ulErrorLogMax , -1, 8 ); /* max size of error log */
hb_stornl( stConfigValues.ulNumTPSHeaderElems , -1, 9 ); /* number TPS header elems */
hb_stornl( stConfigValues.ulNumTPSVisibilityElems,-1, 10); /* number TPS vis elems */
hb_stornl( stConfigValues.ulNumTPSMemoTransElems, -1, 11); /* number TPS memo elems */
hb_stornl( stConfigValues.usNumReceiveECBs , -1, 12); /* number rcv ECBs (NLM only) */
hb_stornl( stConfigValues.usNumSendECBs , -1, 13); /* number send ECBs (NLM only) */
hb_stornd( stConfigValues.usNumBurstPackets , -1, 14); /* number packets per burst */
hb_stornl( stConfigValues.usNumWorkerThreads , -1, 15); /* number worker threads */
hb_stornl( stConfigValues.usSortBuffSize , -1, 16); /* index sort buffer size */
hb_storni( stConfigValues.ucReserved1 , -1, 17); /* reserved */
hb_storni( stConfigValues.ucReserved2 , -1, 18); /* reserved */
hb_storc ( stConfigValues.aucErrorLog , -1, 19); /* error log path */
hb_storc ( stConfigValues.aucSemaphore , -1, 20); /* semaphore file path */
hb_storc ( stConfigValues.aucTransaction , -1, 21); /* TPS log file path */
hb_storni( stConfigValues.ucReserved3 , -1, 22); /* reserved */
hb_storni( stConfigValues.ucReserved4 , -1, 23); /* reserved */
hb_stornl( stConfigValues.usSendIPPort , -1, 24); /* NT Service IP send port # */
hb_stornl( stConfigValues.usReceiveIPPort , -1, 25); /* NT Service IP rcv port # */
hb_stornl( stConfigValues.usReserved5 , -1, 26); /* reserved */
hb_stornl( stConfigValues.ulNumTPSMemoTransElems , -1, 11); /* number TPS memo elems */
hb_stornl( stConfigValues.usNumReceiveECBs , -1, 12); /* number rcv ECBs (NLM only) */
hb_stornl( stConfigValues.usNumSendECBs , -1, 13); /* number send ECBs (NLM only) */
hb_stornd( stConfigValues.usNumBurstPackets , -1, 14); /* number packets per burst */
hb_stornl( stConfigValues.usNumWorkerThreads , -1, 15); /* number worker threads */
hb_stornl( stConfigValues.usSortBuffSize , -1, 16); /* index sort buffer size */
hb_storni( stConfigValues.ucReserved1 , -1, 17); /* reserved */
hb_storni( stConfigValues.ucReserved2 , -1, 18); /* reserved */
hb_storc ( (char *) stConfigValues.aucErrorLog , -1, 19); /* error log path */
hb_storc ( (char *) stConfigValues.aucSemaphore , -1, 20); /* semaphore file path */
hb_storc ( (char *) stConfigValues.aucTransaction, -1, 21); /* TPS log file path */
hb_storni( stConfigValues.ucReserved3 , -1, 22); /* reserved */
hb_storni( stConfigValues.ucReserved4 , -1, 23); /* reserved */
hb_stornl( stConfigValues.usSendIPPort , -1, 24); /* NT Service IP send port # */
hb_stornl( stConfigValues.usReceiveIPPort , -1, 25); /* NT Service IP rcv port # */
hb_stornl( stConfigValues.usReserved5 , -1, 26); /* reserved */
}else
if ( iOption == 1 )
@@ -356,7 +356,7 @@ HB_FUNC( ADSMGGETUSERNAMES ) /* Return array of connected users */
{
UNSIGNED32 ulRetVal ;
UNSIGNED32 ulMaxUsers = 100 ; /* needed for array memory allocation; caller can set with 2nd arg */
UNSIGNED16 ulMaxUsers = 100 ; /* needed for array memory allocation; caller can set with 2nd arg */
UNSIGNED32 ulCount;
UNSIGNED16 usStructSize = sizeof( ADS_MGMT_USER_INFO );
ADS_MGMT_USER_INFO* pastUserInfo;
@@ -366,14 +366,14 @@ HB_FUNC( ADSMGGETUSERNAMES ) /* Return array of connected users */
if ( ISNUM( 2 ) )
ulMaxUsers = hb_parnl( 2 );
pastUserInfo = hb_xgrab( sizeof( ADS_MGMT_USER_INFO ) * ulMaxUsers );
pastUserInfo = (ADS_MGMT_USER_INFO *) hb_xgrab( sizeof( ADS_MGMT_USER_INFO ) * ulMaxUsers );
// AdsMgGetUserNames ( ADSHANDLE hMgmtConnect,
// UNSIGNED8 *pucFileName,
// ADS_MGMT_USER_INFO astUserInfo[],
// UNSIGNED16 *pusArrayLen,
// UNSIGNED16 *pusStructSize );
ulRetVal = AdsMgGetUserNames( hMgmtHandle, ISCHAR( 1 ) ? hb_parc( 1 ) : NULL,
ulRetVal = AdsMgGetUserNames( hMgmtHandle, ISCHAR( 1 ) ? (UNSIGNED8 *) hb_parc( 1 ) : NULL,
pastUserInfo,
&ulMaxUsers,
&usStructSize );
@@ -388,7 +388,7 @@ HB_FUNC( ADSMGGETUSERNAMES ) /* Return array of connected users */
hb_reta( ulMaxUsers );
for ( ulCount = 0; ulCount < ulMaxUsers; ulCount++ )
{
hb_storc ( pastUserInfo[ulCount].aucUserName , -1, ulCount+1);
hb_storc ( (char *) pastUserInfo[ulCount].aucUserName , -1, ulCount+1);
}
}else
hb_reta( 0 );

View File

@@ -16,7 +16,7 @@ BIN_DIR = ..\..\bin
#
CC = cl
CFLAGS = -TP -W3 -nologo -I$(INCLUDE_DIR)
CFLAGS = -TP -W3 -nologo -I$(INCLUDE_DIR) -DWIN32
CLIBFLAGS = $(CFLAGS) -c
CLIBFLAGSDEBUG = $(CLIBFLAGS) -Zi