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"?
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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 ] ) );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user