From 090b5b825cbf68d4e4ba964b9cf0da9e5908cf70 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 24 Jun 2010 13:19:36 +0000 Subject: [PATCH] 2010-06-24 15:19 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbnetio/netiocli.c * contrib/hbnetio/netiosrv.c + Added casts to the points where internal size pointers are converted to/from 32-bit (long) ones for transmission. ; Please review. Maybe these are useful warnings once 64-bit support is to be implemented for NETIO interface, but it doesn't seem very likely (or useful) in the near future. Maybe it'd be better to use fixed bit type here too to emphasis this internal "limit"? --- harbour/ChangeLog | 19 ++++++++++++++---- harbour/contrib/hbnetio/netiocli.c | 8 ++++---- harbour/contrib/hbnetio/netiosrv.c | 32 ++++++++++++++++-------------- 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7e490fe3da..0ecf6ec11e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,17 @@ The license applies to all entries newer than 2009-04-28. */ +2010-06-24 15:19 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbnetio/netiocli.c + * contrib/hbnetio/netiosrv.c + + Added casts to the points where internal size pointers + are converted to/from 32-bit (long) ones for transmission. + ; Please review. Maybe these are useful warnings once 64-bit + support is to be implemented for NETIO interface, but + it doesn't seem very likely (or useful) in the near future. + Maybe it'd be better to use fixed bit type here too to + emphasis this internal "limit"? + 2010-06-24 13:33 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbmisc/hbeditc.c ! strcpy() -> hb_strncpy() @@ -164,11 +175,11 @@ + contrib/hbqt/utils + contrib/hbqt/utils/hbqtui.prg + Added tool to convert .ui files to .prg. - SYNTAX: hbqtui.exe @filenames_list_of_ui_files.whatever \ - [-o_path_to_output_folder_with_trailing_slash] \ - [-noprefix] [-deluic] + SYNTAX: hbqtui @filenames_list_of_ui_files.whatever \ + [-o_path_to_output_folder_with_trailing_slash] \ + [-noprefix] [-deluic] -@filenames_list.whatever: - E:\harbour\contrib\hbide\resources\setup.ui + \harbour\contrib\hbide\resources\setup.ui OR setup.ui [ if you call this util from the folder .ui resides ] -o_path_: path to place .prg files, must accompany trailing slash. diff --git a/harbour/contrib/hbnetio/netiocli.c b/harbour/contrib/hbnetio/netiocli.c index 6c075aac03..bc7a45233e 100644 --- a/harbour/contrib/hbnetio/netiocli.c +++ b/harbour/contrib/hbnetio/netiocli.c @@ -341,7 +341,7 @@ static HB_BOOL s_fileRecvSrvData( PHB_CONCLI conn, long len, int iStreamID, int } else if( iType == NETIO_SRVDATA ) { - long lmax = pSrvData->maxsize - pSrvData->size; + long lmax = ( long ) ( pSrvData->maxsize - pSrvData->size ); if( len > lmax ) len = lmax; @@ -1638,7 +1638,7 @@ static HB_SIZE s_fileReadAt( PHB_FILE pFile, void * data, HB_SIZE ulSize, hb_errRT_NETIO( EG_DATAWIDTH, 1009, 0, NULL, HB_ERR_FUNCNAME ); ulResult = 0; } - else if( ( HB_SIZE ) s_fileRecvAll( pFile->conn, data, ulResult ) != ulResult ) + else if( s_fileRecvAll( pFile->conn, data, ( long ) ulResult ) != ( long ) ulResult ) { pFile->conn->errcode = hb_socketGetError(); errCode = NETIO_ERR_READ; @@ -1664,11 +1664,11 @@ static HB_SIZE s_fileWriteAt( PHB_FILE pFile, const void * data, HB_SIZE ulSize, HB_PUT_LE_UINT32( &msgbuf[ 0 ], NETIO_WRITE ); HB_PUT_LE_UINT16( &msgbuf[ 4 ], pFile->fd ); - HB_PUT_LE_UINT32( &msgbuf[ 6 ], ulSize ); + HB_PUT_LE_UINT32( &msgbuf[ 6 ], ( long ) ulSize ); HB_PUT_LE_UINT64( &msgbuf[ 10 ], llOffset ); memset( msgbuf + 18, '\0', sizeof( msgbuf ) - 18 ); - if( s_fileSendMsg( pFile->conn, msgbuf, data, ulSize, HB_TRUE, HB_FALSE ) ) + if( s_fileSendMsg( pFile->conn, msgbuf, data, ( long ) ulSize, HB_TRUE, HB_FALSE ) ) { ulResult = HB_GET_LE_UINT32( &msgbuf[ 4 ] ); hb_fsSetError( ( HB_ERRCODE ) HB_GET_LE_UINT32( &msgbuf[ 8 ] ) ); diff --git a/harbour/contrib/hbnetio/netiosrv.c b/harbour/contrib/hbnetio/netiosrv.c index 1f677e6a99..7d40439758 100644 --- a/harbour/contrib/hbnetio/netiosrv.c +++ b/harbour/contrib/hbnetio/netiosrv.c @@ -907,7 +907,7 @@ HB_FUNC( NETIO_SERVER ) errCode = NETIO_ERR_WRONG_FILE_HANDLE; else { - len = hb_fileReadAt( pFile, msg + NETIO_MSGLEN, size, llOffset ); + len = ( long ) hb_fileReadAt( pFile, msg + NETIO_MSGLEN, size, llOffset ); errFsCode = hb_fsError(); HB_PUT_LE_UINT32( &msg[ 0 ], NETIO_READ ); HB_PUT_LE_UINT32( &msg[ 4 ], len ); @@ -936,7 +936,7 @@ HB_FUNC( NETIO_SERVER ) errCode = NETIO_ERR_WRONG_FILE_HANDLE; else { - size = hb_fileWriteAt( pFile, msg, size, llOffset ); + size = ( long ) hb_fileWriteAt( pFile, msg, size, llOffset ); errFsCode = hb_fsError(); HB_PUT_LE_UINT32( &msg[ 0 ], NETIO_WRITE ); HB_PUT_LE_UINT32( &msg[ 4 ], size ); @@ -1190,7 +1190,7 @@ HB_FUNC( NETIO_SERVER ) } memcpy( msg + NETIO_MSGLEN, itmData, itmSize ); hb_xfree( itmData ); - len = itmSize; + len = ( long ) itmSize; if( iStreamID && hb_itemGetNI( pResult ) == iStreamID ) { hb_threadMutexUnlock( conn->mutex ); @@ -1275,17 +1275,19 @@ HB_FUNC( NETIO_SRVSENDITEM ) { char * itmData, * msg; HB_SIZE nLen; + long lLen; itmData = hb_itemSerialize( pItem, HB_TRUE, &nLen ); - msg = ( char * ) hb_xgrab( nLen + NETIO_MSGLEN ); + lLen = ( long ) nLen; + msg = ( char * ) hb_xgrab( lLen + NETIO_MSGLEN ); HB_PUT_LE_UINT32( &msg[ 0 ], NETIO_SRVITEM ); HB_PUT_LE_UINT32( &msg[ 4 ], iStreamID ); - HB_PUT_LE_UINT32( &msg[ 8 ], nLen ); + HB_PUT_LE_UINT32( &msg[ 8 ], lLen ); memset( msg + 12, '\0', NETIO_MSGLEN - 12 ); - memcpy( msg + NETIO_MSGLEN, itmData, nLen ); + memcpy( msg + NETIO_MSGLEN, itmData, lLen ); hb_xfree( itmData ); - nLen += NETIO_MSGLEN; + lLen += NETIO_MSGLEN; if( hb_threadMutexLock( conn->mutex ) ) { PHB_CONSTREAM stream = conn->streams; @@ -1296,7 +1298,7 @@ HB_FUNC( NETIO_SRVSENDITEM ) stream = stream->next; } if( stream && stream->type == NETIO_SRVITEM ) - fResult = s_srvSendAll( conn, msg, nLen ) == ( long ) nLen; + fResult = s_srvSendAll( conn, msg, lLen ) == lLen; hb_threadMutexUnlock( conn->mutex ); } hb_xfree( msg ); @@ -1310,22 +1312,22 @@ HB_FUNC( NETIO_SRVSENDDATA ) { PHB_CONSRV conn = s_consrvParam( 1 ); int iStreamID = hb_parni( 2 ); - HB_SIZE nLen = hb_parclen( 3 ); + long lLen = ( long ) hb_parclen( 3 ); HB_BOOL fResult = HB_FALSE; if( conn && conn->sd != HB_NO_SOCKET && !conn->stop && conn->mutex && - iStreamID && nLen > 0 ) + iStreamID && lLen > 0 ) { char * msg; - msg = ( char * ) hb_xgrab( nLen + NETIO_MSGLEN ); + msg = ( char * ) hb_xgrab( lLen + NETIO_MSGLEN ); HB_PUT_LE_UINT32( &msg[ 0 ], NETIO_SRVDATA ); HB_PUT_LE_UINT32( &msg[ 4 ], iStreamID ); - HB_PUT_LE_UINT32( &msg[ 8 ], nLen ); + HB_PUT_LE_UINT32( &msg[ 8 ], lLen ); memset( msg + 12, '\0', NETIO_MSGLEN - 12 ); - memcpy( msg + NETIO_MSGLEN, hb_parc( 3 ), nLen ); + memcpy( msg + NETIO_MSGLEN, hb_parc( 3 ), lLen ); - nLen += NETIO_MSGLEN; + lLen += NETIO_MSGLEN; if( hb_threadMutexLock( conn->mutex ) ) { PHB_CONSTREAM stream = conn->streams; @@ -1336,7 +1338,7 @@ HB_FUNC( NETIO_SRVSENDDATA ) stream = stream->next; } if( stream && stream->type == NETIO_SRVDATA ) - fResult = s_srvSendAll( conn, msg, nLen ) == ( long ) nLen; + fResult = s_srvSendAll( conn, msg, lLen ) == lLen; hb_threadMutexUnlock( conn->mutex ); } hb_xfree( msg );