diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bba144899c..282726c089 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,41 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-07-01 16:28 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/harbour-ce-spec + * harbour/harbour-w32-spec + * define whole contrib library list for new contrib/Makefile + + added header files to respect differences between platform + native and Windows only headers + + * harbour/harbour.spec + * define whole contrib library list for new contrib/Makefile + * divided libraries which needs external references into + separated packages + ! removed unnecessary dependences in binaries rebuild in shared + mode + + * harbour/contrib/hbodbc/odbc.c + * pacified warnings + % minor optimization + + * harbour/contrib/hbcurl/hbcurl.c + * harbour/contrib/hbfbird/firebird.c + * harbour/source/vm/extrap.c + * casting to pacify warnings + + * harbour/contrib/gtwvg/gtwvg.c + ! fixed pointer comparison - C uses different precedence for ! + operator then Clipper/xbase + + * harbour/source/rtl/hbinet.c + ! fixed GPF HB_INET[GS]ET{SND,RCV}BUFSIZE() when wrong + socket parameter is passed. Please remember that after + RT error the control is returned to application. + % removed any hardcoded limits for size of data passed in + single read/write call during normal stream operations + - removed iSndBufSize/iRcvBufSize + 2008-06-30 19:20 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/hbapollo/Makefile * contrib/hbcurl/Makefile diff --git a/harbour/contrib/gtwvg/gtwvg.c b/harbour/contrib/gtwvg/gtwvg.c index e415f651b2..9ba655536c 100644 --- a/harbour/contrib/gtwvg/gtwvg.c +++ b/harbour/contrib/gtwvg/gtwvg.c @@ -186,7 +186,7 @@ static void hb_gt_wvt_FreeAll( void ) int iPos; for ( iPos = 1; iPos < WVT_MAX_WINDOWS; iPos++ ) { - if( !s_wvtWindows[ iPos ] == NULL ) + if( s_wvtWindows[ iPos ] != NULL ) { PHB_GTWVT pWVT; diff --git a/harbour/contrib/hbcurl/hbcurl.c b/harbour/contrib/hbcurl/hbcurl.c index 8e250ab264..a6c7a57ba7 100644 --- a/harbour/contrib/hbcurl/hbcurl.c +++ b/harbour/contrib/hbcurl/hbcurl.c @@ -201,7 +201,7 @@ size_t hb_curl_read_file_callback( void * buffer, size_t size, size_t nmemb, voi hb_curl->ul_handle = hb_fsOpen( hb_curl->ul_name, FO_READ ); if( hb_curl->ul_handle == FS_ERROR ) - return -1; + return ( size_t ) -1; } ret = ( size_t ) hb_fsReadLarge( hb_curl->ul_handle, ( BYTE * ) buffer, size * nmemb ); @@ -209,7 +209,7 @@ size_t hb_curl_read_file_callback( void * buffer, size_t size, size_t nmemb, voi return hb_fsError() ? CURL_READFUNC_ABORT : ret; } - return -1; + return ( size_t ) -1; } size_t hb_curl_read_buff_callback( void * buffer, size_t size, size_t nmemb, void * Cargo ) @@ -231,7 +231,7 @@ size_t hb_curl_read_buff_callback( void * buffer, size_t size, size_t nmemb, voi return nTodo; } - return -1; + return ( size_t ) -1; } size_t hb_curl_write_file_callback( void * buffer, size_t size, size_t nmemb, void * Cargo ) @@ -245,13 +245,13 @@ size_t hb_curl_write_file_callback( void * buffer, size_t size, size_t nmemb, vo hb_curl->dl_handle = hb_fsCreate( hb_curl->dl_name, FC_NORMAL ); if( hb_curl->dl_handle == FS_ERROR ) - return -1; + return ( size_t ) -1; } return hb_fsWriteLarge( hb_curl->dl_handle, ( BYTE * ) buffer, size * nmemb ); } - return -1; + return ( size_t ) -1; } #define HB_CURL_DL_BUFF_SIZE_INIT ( CURL_MAX_WRITE_SIZE * 2 ) @@ -279,7 +279,7 @@ size_t hb_curl_write_buff_callback( void * buffer, size_t size, size_t nmemb, vo return nTodo; } - return -1; + return ( size_t ) -1; } int hb_curl_progress_callback( void * Cargo, double dltotal, double dlnow, double ultotal, double ulnow ) diff --git a/harbour/contrib/hbfbird/firebird.c b/harbour/contrib/hbfbird/firebird.c index b0ebc9ca08..144ee2efa7 100644 --- a/harbour/contrib/hbfbird/firebird.c +++ b/harbour/contrib/hbfbird/firebird.c @@ -475,14 +475,14 @@ HB_FUNC( FBGETDATA ) case SQL_TIMESTAMP: isc_decode_timestamp ( ( ISC_TIMESTAMP * ) var->sqldata, × ); - snprintf( date_s, sizeof( date_s ), "%04d-%02d-%02d %02d:%02d:%02d.%04lu", + snprintf( date_s, sizeof( date_s ), "%04d-%02d-%02d %02d:%02d:%02d.%04d", times.tm_year + 1900, times.tm_mon + 1, times.tm_mday, times.tm_hour, times.tm_min, times.tm_sec, - ( ( ISC_TIMESTAMP * ) var->sqldata )->timestamp_time % 10000 ); + ( int ) ( ( ( ISC_TIMESTAMP * ) var->sqldata )->timestamp_time % 10000 ) ); snprintf( data, sizeof( data ), "%*s ", 24, date_s ); hb_retc( data ); @@ -498,10 +498,11 @@ HB_FUNC( FBGETDATA ) case SQL_TYPE_TIME: isc_decode_sql_time ( ( ISC_TIME * ) var->sqldata, × ); - snprintf( date_s, sizeof( date_s ), "%02d:%02d:%02d.%04lu", + snprintf( date_s, sizeof( date_s ), "%02d:%02d:%02d.%04d", times.tm_hour, times.tm_min, - times.tm_sec, ( *( ( ISC_TIME * ) var->sqldata ) ) % 10000 ); + times.tm_sec, + ( int ) ( ( *( ( ISC_TIME * ) var->sqldata ) ) % 10000 ) ); snprintf( data, sizeof( data ), "%*s ", 13, date_s ); hb_retc( data ); diff --git a/harbour/contrib/hbodbc/odbc.c b/harbour/contrib/hbodbc/odbc.c index f842a6a053..18142be294 100644 --- a/harbour/contrib/hbodbc/odbc.c +++ b/harbour/contrib/hbodbc/odbc.c @@ -245,11 +245,16 @@ HB_FUNC( SQLGETDATA ) /* HB_SQLGETDATA( hStmt, nField, nType, nLen, @cBuffer ) - WORD wType, wResult; int iReallocs = 0; - lLen = ( SDWORD )( hb_parnl( 4 ) ? hb_parnl( 4 ) : 64 ); + wType = hb_parni( 3 ); + if( !wType ) + wType = ( WORD ) SQL_BINARY; + lLen = ( SQLLEN ) hb_parnl( 4 ); + if( !lLen ) + lLen = 64; bBuffer = hb_xgrab( (ULONG) lLen + 1 ); bOut = NULL; lInitBuff = lLen; - wType = hb_parni( 3 ) ? hb_parni( 3 ) : SQL_BINARY; + lBuffLen = 0; wResult = ! SQL_NO_DATA; while( wResult != SQL_NO_DATA ) diff --git a/harbour/harbour-ce-spec b/harbour/harbour-ce-spec index 4ca2bf0c18..6e150a357b 100644 --- a/harbour/harbour-ce-spec +++ b/harbour/harbour-ce-spec @@ -114,10 +114,10 @@ export PATH="$CCPATH$PATH" export HB_MT=no export HB_GT_LIB=gtwvt export HB_BIN_INSTALL=%{_bindir} -export HB_INC_INSTALL=%{_includedir}/harbour +export HB_INC_INSTALL=%{_includedir}/%{name} export HB_LIB_INSTALL=%{_libdir}/%{name} export HB_GTALLEG=%{?_with_allegro:yes} -export HB_CONTRIBLIBS="%{?_with_odbc:hbodbc} %{?_with_ads:rddads} %{?_with_gd:hbgd} %{?_with_pgsql:hbpgsql} %{?_with_mysql:hbmysql}" +export HB_CONTRIBLIBS="hbct hbmzip hbtip xhb hbbtree hbmisc hbvpdf hbgt hbbmcdx hbclipsm gtwvg hbw32 rddado %{!?_without_nf:hbnf} %{?_with_odbc:hbodbc} %{?_with_curl:hbcurl} %{?_with_ads:rddads} %{?_with_gd:hbgd} %{?_with_pgsql:hbpgsql} %{?_with_mysql:hbmysql}" make -r @@ -145,10 +145,10 @@ export HB_COMPILER=cemgw export HB_MT=no export HB_GT_LIB=gtwvt export HB_BIN_INSTALL=%{_bindir} -export HB_INC_INSTALL=%{_includedir}/harbour +export HB_INC_INSTALL=%{_includedir}/%{name} export HB_LIB_INSTALL=%{_libdir}/%{name} export HB_GTALLEG=%{?_with_allegro:yes} -export HB_CONTRIBLIBS="%{?_with_odbc:hbodbc} %{?_with_ads:rddads} %{?_with_gd:hbgd} %{?_with_pgsql:hbpgsql} %{?_with_mysql:hbmysql}" +export HB_CONTRIBLIBS="hbct hbmzip hbtip xhb hbbtree hbmisc hbvpdf hbgt hbbmcdx hbclipsm gtwvg hbw32 rddado %{!?_without_nf:hbnf} %{?_with_odbc:hbodbc} %{?_with_curl:hbcurl} %{?_with_ads:rddads} %{?_with_gd:hbgd} %{?_with_pgsql:hbpgsql} %{?_with_mysql:hbmysql}" export _DEFAULT_BIN_DIR=$HB_BIN_INSTALL export _DEFAULT_INC_DIR=$HB_INC_INSTALL @@ -159,6 +159,7 @@ export HB_LIB_INSTALL=$RPM_BUILD_ROOT/$HB_LIB_INSTALL export HB_TOOLS_PREF=%{hb_pref} mkdir -p $HB_BIN_INSTALL +mkdir -p $HB_INC_INSTALL mkdir -p $HB_LIB_INSTALL make -r -i install @@ -173,7 +174,6 @@ ${CCPREFIX}strip --strip-debug $HB_LIB_INSTALL/* # remove unused files rm -fR ${HB_BIN_INSTALL}/{harbour,hbpp,hbdoc,hbdot,hbmake,hbrun,hbtest,hbverfix,hbpptest}.exe -rm -fR $HB_INC_INSTALL # Create a README file for people using this RPM. cat > doc/%{readme} < doc/%{readme} <com, SOL_SOCKET, SO_SNDBUF, (char *) &value, &len ) != SOCKET_ERROR ) - { - Socket->iSndBufSize = value; - if( getsockopt( Socket->com, SOL_SOCKET, SO_RCVBUF, (char *) &value, &len ) != SOCKET_ERROR ) - { - Socket->iRcvBufSize = value; - } - else - { - Socket->iRcvBufSize = 1400; - } - } - else - { - Socket->iSndBufSize = 1400; - Socket->iRcvBufSize = 1400; - } - } } } @@ -807,64 +779,63 @@ HB_FUNC( HB_INETCLEARPERIODCALLBACK ) HB_FUNC( HB_INETGETSNDBUFSIZE ) { HB_SOCKET_STRUCT *Socket = HB_PARSOCKET( 1 ); - int value; - socklen_t len = sizeof( value ); if( Socket == NULL ) - { hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, "HB_INETGETSNDBUFSIZE", HB_ERR_ARGS_BASEPARAMS ); + else + { + int value; + socklen_t len = sizeof( value ); + getsockopt( Socket->com, SOL_SOCKET, SO_SNDBUF, ( void *) &value, &len ); + hb_retni( value ); } - - getsockopt( Socket->com, SOL_SOCKET, SO_SNDBUF, (char *) &value, &len ); - Socket->iSndBufSize = value; - hb_retni( value ); } HB_FUNC( HB_INETGETRCVBUFSIZE ) { HB_SOCKET_STRUCT *Socket = HB_PARSOCKET( 1 ); - int value; - socklen_t len = sizeof( value ); if( Socket == NULL ) hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, "HB_INETGETRCVBUFSIZE", HB_ERR_ARGS_BASEPARAMS ); - - getsockopt( Socket->com, SOL_SOCKET, SO_RCVBUF, (char *) &value, &len ); - Socket->iRcvBufSize = value; - hb_retni( value ); + else + { + int value; + socklen_t len = sizeof( value ); + getsockopt( Socket->com, SOL_SOCKET, SO_RCVBUF, ( void * ) &value, &len ); + hb_retni( value ); + } } HB_FUNC( HB_INETSETSNDBUFSIZE ) { HB_SOCKET_STRUCT *Socket = HB_PARSOCKET( 1 ); - int value; if( Socket == NULL ) hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, "HB_INETSETSNDBUFSIZE", HB_ERR_ARGS_BASEPARAMS ); - - value = hb_parni( 2 ); - setsockopt( Socket->com, SOL_SOCKET, SO_SNDBUF, (char *) &value, sizeof( value ) ); - Socket->iSndBufSize = value; - hb_retni( value ); + else + { + int value = hb_parni( 2 ); + setsockopt( Socket->com, SOL_SOCKET, SO_SNDBUF, ( void * ) &value, sizeof( value ) ); + hb_retni( value ); + } } HB_FUNC( HB_INETSETRCVBUFSIZE ) { HB_SOCKET_STRUCT *Socket = HB_PARSOCKET( 1 ); - int value; if( Socket == NULL ) hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, "HB_INETSETRCVBUFSIZE", HB_ERR_ARGS_BASEPARAMS ); - - value = hb_parni( 2 ); - setsockopt( Socket->com, SOL_SOCKET, SO_RCVBUF, (char *) &value, sizeof( value ) ); - Socket->iRcvBufSize = value; - hb_retni( value ); + else + { + int value = hb_parni( 2 ); + setsockopt( Socket->com, SOL_SOCKET, SO_RCVBUF, ( void * ) &value, sizeof( value ) ); + hb_retni( value ); + } } - /******************************************************************** * TCP receive and send functions ***/ @@ -873,8 +844,8 @@ static void s_inetRecvInternal( int iMode ) { HB_SOCKET_STRUCT *Socket = HB_PARSOCKET( 1 ); PHB_ITEM pBuffer = hb_param( 2, HB_IT_STRING ); - char *Buffer; - int iLen, iMaxLen, iReceived, iBufferLen; + char *buffer; + int iLen, iMaxLen, iReceived; int iTimeElapsed; if( Socket == NULL || pBuffer == NULL || !ISBYREF( 2 ) ) @@ -884,7 +855,7 @@ static void s_inetRecvInternal( int iMode ) } pBuffer = hb_itemUnShare( pBuffer ); - Buffer = hb_itemGetCPtr( pBuffer ); + buffer = hb_itemGetCPtr( pBuffer ); iLen = hb_itemGetCLen( pBuffer ); if( ISNIL( 3 ) ) @@ -904,19 +875,9 @@ static void s_inetRecvInternal( int iMode ) do { - if( iMode == 1 ) - { - iBufferLen = ( Socket->iRcvBufSize > iMaxLen - iReceived ) ? iMaxLen - iReceived : Socket->iRcvBufSize; - } - else - { - iBufferLen = iMaxLen; - } - if( hb_selectReadSocket( Socket ) ) { - iLen = recv( Socket->com, Buffer + iReceived, iBufferLen, MSG_NOSIGNAL ); - + iLen = recv( Socket->com, buffer + iReceived, iMaxLen - iReceived, MSG_NOSIGNAL ); if( iLen > 0 ) iReceived += iLen; @@ -1094,7 +1055,8 @@ static void s_inetRecvPattern( char *szPattern ) { HB_SOCKET_SET_ERROR2( Socket, -2, "Connection closed" ); } - else if( iLen == -2 ) { + else if( iLen == -2 ) + { HB_SOCKET_SET_ERROR2( Socket, -1, "Timeout" ); } else @@ -1382,7 +1344,7 @@ static void s_inetSendInternal( int iMode ) HB_SOCKET_STRUCT *Socket = HB_PARSOCKET( 1 ); PHB_ITEM pBuffer = hb_param( 2, HB_IT_STRING ); char *Buffer; - int iLen, iSent, iSend, iBufferLen; + int iLen, iSent, iSend; if( Socket == NULL || pBuffer == NULL ) { @@ -1398,25 +1360,16 @@ static void s_inetSendInternal( int iMode ) if( iLen < iSend ) iSend = iLen; } - iSent = 0; HB_SOCKET_ZERO_ERROR( Socket ); + iSent = 0; iLen = 0; while( iSent < iSend ) { - if( iMode == 1 ) - { - iBufferLen = Socket->iSndBufSize > iSend - iSent ? iSend - iSent : Socket->iSndBufSize; - } - else - { - iBufferLen = iSend; - } - iLen = 0; if( hb_selectWriteSocket( Socket ) ) - iLen = send( Socket->com, Buffer + iSent, iBufferLen, MSG_NOSIGNAL ); + iLen = send( Socket->com, Buffer + iSent, iSend - iSent, MSG_NOSIGNAL ); if( iLen > 0 ) { @@ -1438,14 +1391,7 @@ static void s_inetSendInternal( int iMode ) Socket->count = iSent; - if( iLen > 0 ) - { - hb_retni( iSent ); - } - else - { - hb_retni( -1 ); - } + hb_retni( iLen > 0 ? iSent : -1 ); } HB_FUNC( HB_INETSEND ) diff --git a/harbour/source/vm/extrap.c b/harbour/source/vm/extrap.c index ea692f4b15..e911ce135f 100644 --- a/harbour/source/vm/extrap.c +++ b/harbour/source/vm/extrap.c @@ -119,11 +119,15 @@ LONG WINAPI hb_win32ExceptionHandler( struct _EXCEPTION_POINTERS * pExceptionInf " CS:EIP:%04X:%08X SS:ESP:%04X:%08X\n" " DS:%04X ES:%04X FS:%04X GS:%04X\n" " Flags:%08X\n", - dwExceptCode, pExceptionRecord->ExceptionAddress, - pCtx->Eax, pCtx->Ebx, pCtx->Ecx, pCtx->Edx, pCtx->Esi, pCtx->Edi, pCtx->Ebp, - pCtx->SegCs, pCtx->Eip, pCtx->SegSs, pCtx->Esp, pCtx->SegDs, pCtx->SegEs, pCtx->SegFs, pCtx->SegGs, - pCtx->EFlags ); - + ( UINT32 ) dwExceptCode, ( UINT32 ) pExceptionRecord->ExceptionAddress, + ( UINT32 ) pCtx->Eax, ( UINT32 ) pCtx->Ebx, ( UINT32 ) pCtx->Ecx, + ( UINT32 ) pCtx->Edx, ( UINT32 ) pCtx->Esi, ( UINT32 ) pCtx->Edi, + ( UINT32 ) pCtx->Ebp, + ( UINT32 ) pCtx->SegCs, ( UINT32 ) pCtx->Eip, ( UINT32 ) pCtx->SegSs, + ( UINT32 ) pCtx->Esp, ( UINT32 ) pCtx->SegDs, ( UINT32 ) pCtx->SegEs, + ( UINT32 ) pCtx->SegFs, ( UINT32 ) pCtx->SegGs, + ( UINT32 ) pCtx->EFlags ); + hb_strncat( errmsg, " CS:EIP:", errmsglen ); pc = ( void * ) pCtx->Eip; for( i = 0; i < 16; i++ )