From bc30cabde47cb94465d8c0b5cb03243c003d6e64 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Wed, 17 Nov 2010 20:12:12 +0000 Subject: [PATCH] 2010-11-17 21:11 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbpp.h ! removed repeated declaration of hb_pp_eof() * harbour/include/hbapicdp.h * harbour/include/hbapilng.h * harbour/include/hbgtcore.h * added extern declaration to HB_*_REQUEST() macros to pacify undeclared global functions warnings * harbour/include/hbstack.h ! added missing hb_stackDec() declaration * harbour/include/hbdefs.h ! added missing const in some endian macros * removed some unnecessary casting which may hide bugs in the code * harbour/include/hbapi.h ! removed repeated declaration of hb_strVal() * harbour/include/hbznet.h ! removed repeated declaration of hb_znetError() * harbour/include/hbcompdf.h * minor comment * harbour/src/vm/hvm.c ! added missing static to hb_vmTSVarClean() declaration * added extern hb_vmForceLink() declaration to pacify undeclared global functions warnings * harbour/src/vm/thread.c * make hb_threadInit() and hb_threadExit() internal HVM functions available only in MT mode * harbour/src/rtl/dates.c ! added missing static to hb_dateUnformatRaw() declaration * harbour/src/macro/macrolex.c * added extern hb_macro_yylex() declaration to pacify undeclared global functions warnings * harbour/src/rdd/workarea.c * added extern _hb_rddWorkAreaForceLink() declaration to pacify undeclared global functions warnings * harbour/src/compiler/complex.c * added extern hb_comp_yylex() declaration to pacify undeclared global functions warnings * harbour/contrib/hbnetio/netiocli.c ! added missing static to s_fileFlush() declaration * harbour/contrib/hbct/tempfile.prg ! respect in TmepFile() function default file attributes set by SetFCreate() * harbour/contrib/hbct/ctstrfil.h ! added missing declarations for ct_getfcreate() and ct_setfcreate() * harbour/contrib/hbwin/legacy.prg * removed dummy RETURN statement * harbour/contrib/xhb/fparse.c ! added missing static to hb_ParseLine() declaration * harbour/contrib/xhb/freadlin.c ! added missing static to hb_fsReadLine() declaration * harbour/contrib/xhb/txtline.c ! added missing static to hb_readLine() and hb_tabexpand() declarations ! fixed uninitialized variable warning exploited by above modification (static function was automatically inlined increasing optimizations) * harbour/contrib/xhb/hbserv.c ! removed repeated declaration of hb_isService() and hb_serviceExit() * harbour/contrib/xhb/cstructc.c * disabled public C functions hb_retclenAdoptRaw() and hb_retclenStatic() * harbour/contrib/xhb/xhbat.c * declare C function hb_AtSkipStrings() as static Warning: this functions is part of public xHarbour C API. ; TODO: The following functions are declared as public but without any prototypes in header files so they should be made static or we should add them to some header files: hbver.c:143: hb_verHostCPU() hbjson.c:640: hb_jsonEncode() hbjson.c:665: hb_jsonDecode() sha2.c:228: sha256_transf() sha2.c:445: sha512_transf() I would like to ask authors to look at them and chose best solution. --- harbour/ChangeLog | 96 ++++++++++++ harbour/contrib/hbct/ctstrfil.h | 3 + harbour/contrib/hbct/tempfile.prg | 3 + harbour/contrib/hbnetio/netiocli.c | 2 +- harbour/contrib/hbwin/legacy.prg | 1 - harbour/contrib/xhb/cstructc.c | 14 +- harbour/contrib/xhb/fparse.c | 2 +- harbour/contrib/xhb/freadlin.c | 2 +- harbour/contrib/xhb/hbserv.c | 6 - harbour/contrib/xhb/txtline.c | 24 +-- harbour/contrib/xhb/xhbat.c | 2 +- harbour/include/hbapi.h | 3 +- harbour/include/hbapicdp.h | 1 + harbour/include/hbapilng.h | 1 + harbour/include/hbcompdf.h | 2 +- harbour/include/hbdefs.h | 240 ++++++++++++++--------------- harbour/include/hbgtcore.h | 1 + harbour/include/hbpp.h | 1 - harbour/include/hbstack.h | 3 +- harbour/include/hbznet.h | 2 - harbour/src/compiler/complex.c | 2 + harbour/src/macro/macrolex.c | 2 + harbour/src/rdd/workarea.c | 1 + harbour/src/rtl/dates.c | 2 +- harbour/src/vm/hvm.c | 3 +- harbour/src/vm/thread.c | 4 +- 26 files changed, 261 insertions(+), 162 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bacf435d56..b037ae37d0 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,102 @@ The license applies to all entries newer than 2009-04-28. */ +2010-11-17 21:11 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbpp.h + ! removed repeated declaration of hb_pp_eof() + + * harbour/include/hbapicdp.h + * harbour/include/hbapilng.h + * harbour/include/hbgtcore.h + * added extern declaration to HB_*_REQUEST() macros to pacify + undeclared global functions warnings + + * harbour/include/hbstack.h + ! added missing hb_stackDec() declaration + + * harbour/include/hbdefs.h + ! added missing const in some endian macros + * removed some unnecessary casting which may hide bugs + in the code + + * harbour/include/hbapi.h + ! removed repeated declaration of hb_strVal() + + * harbour/include/hbznet.h + ! removed repeated declaration of hb_znetError() + + * harbour/include/hbcompdf.h + * minor comment + + * harbour/src/vm/hvm.c + ! added missing static to hb_vmTSVarClean() declaration + * added extern hb_vmForceLink() declaration to pacify + undeclared global functions warnings + + * harbour/src/vm/thread.c + * make hb_threadInit() and hb_threadExit() internal HVM + functions available only in MT mode + + * harbour/src/rtl/dates.c + ! added missing static to hb_dateUnformatRaw() declaration + + * harbour/src/macro/macrolex.c + * added extern hb_macro_yylex() declaration to pacify + undeclared global functions warnings + + * harbour/src/rdd/workarea.c + * added extern _hb_rddWorkAreaForceLink() declaration to pacify + undeclared global functions warnings + + * harbour/src/compiler/complex.c + * added extern hb_comp_yylex() declaration to pacify + undeclared global functions warnings + + * harbour/contrib/hbnetio/netiocli.c + ! added missing static to s_fileFlush() declaration + + * harbour/contrib/hbct/tempfile.prg + ! respect in TmepFile() function default file attributes set by + SetFCreate() + + * harbour/contrib/hbct/ctstrfil.h + ! added missing declarations for ct_getfcreate() and ct_setfcreate() + + * harbour/contrib/hbwin/legacy.prg + * removed dummy RETURN statement + + * harbour/contrib/xhb/fparse.c + ! added missing static to hb_ParseLine() declaration + + * harbour/contrib/xhb/freadlin.c + ! added missing static to hb_fsReadLine() declaration + + * harbour/contrib/xhb/txtline.c + ! added missing static to hb_readLine() and hb_tabexpand() declarations + ! fixed uninitialized variable warning exploited by above modification + (static function was automatically inlined increasing optimizations) + + * harbour/contrib/xhb/hbserv.c + ! removed repeated declaration of hb_isService() and hb_serviceExit() + + * harbour/contrib/xhb/cstructc.c + * disabled public C functions hb_retclenAdoptRaw() and hb_retclenStatic() + + * harbour/contrib/xhb/xhbat.c + * declare C function hb_AtSkipStrings() as static + Warning: this functions is part of public xHarbour C API. + + ; TODO: The following functions are declared as public but without + any prototypes in header files so they should be made static + or we should add them to some header files: + hbver.c:143: hb_verHostCPU() + hbjson.c:640: hb_jsonEncode() + hbjson.c:665: hb_jsonDecode() + sha2.c:228: sha256_transf() + sha2.c:445: sha512_transf() + I would like to ask authors to look at them and chose + best solution. + 2010-11-17 18:07 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbpgsql/postgres.c + Switched to built-in versioning macro instead of rolling our own. diff --git a/harbour/contrib/hbct/ctstrfil.h b/harbour/contrib/hbct/ctstrfil.h index e3e0769709..c16f552fe2 100644 --- a/harbour/contrib/hbct/ctstrfil.h +++ b/harbour/contrib/hbct/ctstrfil.h @@ -55,6 +55,9 @@ HB_EXTERN_BEGIN +extern int ct_getfcreate( void ); +extern void ct_setfcreate( int iFileAttr ); + extern HB_BOOL ct_getsafety( void ); extern void ct_setsafety( HB_BOOL bSafety ); diff --git a/harbour/contrib/hbct/tempfile.prg b/harbour/contrib/hbct/tempfile.prg index 9d89ccd428..4d31712214 100644 --- a/harbour/contrib/hbct/tempfile.prg +++ b/harbour/contrib/hbct/tempfile.prg @@ -60,6 +60,9 @@ FUNCTION TempFile( cDir, cExt, nAttr ) IF ISCHARACTER( cExt ) .AND. !( Left( cExt, 1 ) == "." ) cExt := "." + cExt ENDIF + IF ! ISNUMBER( nAttr ) + nAttr := SetFCreate() + ENDIF fhnd := hb_FTempCreateEx( @cName, cDir,, cExt, nAttr ) diff --git a/harbour/contrib/hbnetio/netiocli.c b/harbour/contrib/hbnetio/netiocli.c index bc7a45233e..4630cb0ba2 100644 --- a/harbour/contrib/hbnetio/netiocli.c +++ b/harbour/contrib/hbnetio/netiocli.c @@ -1722,7 +1722,7 @@ static HB_FOFFSET s_fileSize( PHB_FILE pFile ) return llOffset; } -void s_fileFlush( PHB_FILE pFile, HB_BOOL fDirty ) +static void s_fileFlush( PHB_FILE pFile, HB_BOOL fDirty ) { HB_SYMBOL_UNUSED( pFile ); HB_SYMBOL_UNUSED( fDirty ); diff --git a/harbour/contrib/hbwin/legacy.prg b/harbour/contrib/hbwin/legacy.prg index 78d0c57d48..a5a4122872 100644 --- a/harbour/contrib/hbwin/legacy.prg +++ b/harbour/contrib/hbwin/legacy.prg @@ -73,7 +73,6 @@ STATIC PROCEDURE Throw( oError ) __ErrInHandler() ENDIF Break( oError ) - RETURN STATIC FUNCTION ThrowOpError( nSubCode, cOperator, ... ) LOCAL oError diff --git a/harbour/contrib/xhb/cstructc.c b/harbour/contrib/xhb/cstructc.c index 3d160c0b60..570e81a816 100644 --- a/harbour/contrib/xhb/cstructc.c +++ b/harbour/contrib/xhb/cstructc.c @@ -87,9 +87,7 @@ static PHB_ITEM hb_itemPutCRaw( PHB_ITEM pItem, const char * szText, HB_SIZE nLe return pItem; } -#ifdef hb_itemPutCRawStatic - #undef hb_itemPutCRawStatic -#endif +#undef hb_itemPutCRawStatic static PHB_ITEM hb_itemPutCRawStatic( PHB_ITEM pItem, const char * szText, HB_SIZE nLen ) { HB_TRACE(HB_TR_DEBUG, ("hb_itemPutCRawStatic(%p, %s, %" HB_PFS "u)", pItem, szText, nLen)); @@ -110,21 +108,19 @@ static PHB_ITEM hb_itemPutCRawStatic( PHB_ITEM pItem, const char * szText, HB_SI return pItem; } -#ifdef hb_retclenAdoptRaw - #undef hb_retclenAdoptRaw -#endif +/* +#undef hb_retclenAdoptRaw void hb_retclenAdoptRaw( const char * szText, HB_SIZE nLen ) { hb_itemPutCRaw( hb_stackReturnItem(), szText, nLen ); } -#ifdef hb_retclenStatic - #undef hb_retclenStatic -#endif +#undef hb_retclenStatic void hb_retclenStatic( const char * szText, HB_SIZE nLen ) { hb_itemPutCRawStatic( hb_stackReturnItem(), szText, nLen ); } +*/ static HB_UINT SizeOfCStructure( PHB_ITEM aDef, HB_UINT uiAlign ) { diff --git a/harbour/contrib/xhb/fparse.c b/harbour/contrib/xhb/fparse.c index d175ddcbe7..4d2d6b2343 100644 --- a/harbour/contrib/xhb/fparse.c +++ b/harbour/contrib/xhb/fparse.c @@ -80,7 +80,7 @@ FPARSE( cFile, cDelimiter ) -> array /* adjustable, but this should be sufficient in normal situation */ #define MAX_READ 4096 /*----------------------------------------------------------------------------*/ -void hb_ParseLine( PHB_ITEM pReturn, const char * szText, int iDelimiter, int * iWord ) +static void hb_ParseLine( PHB_ITEM pReturn, const char * szText, int iDelimiter, int * iWord ) { if( szText ) { diff --git a/harbour/contrib/xhb/freadlin.c b/harbour/contrib/xhb/freadlin.c index 17a3e52659..1dd18acfe3 100644 --- a/harbour/contrib/xhb/freadlin.c +++ b/harbour/contrib/xhb/freadlin.c @@ -58,7 +58,7 @@ #define READING_BLOCK 4096 -char * hb_fsReadLine( HB_FHANDLE hFileHandle, HB_ISIZ * plBuffLen, const char ** pTerm, HB_ISIZ * pnTermSizes, HB_ISIZ nTerms, HB_BOOL * pbFound, HB_BOOL * pbEOF ) +static char * hb_fsReadLine( HB_FHANDLE hFileHandle, HB_ISIZ * plBuffLen, const char ** pTerm, HB_ISIZ * pnTermSizes, HB_ISIZ nTerms, HB_BOOL * pbFound, HB_BOOL * pbEOF ) { HB_ISIZ nPosTerm = 0, nPos, nPosition; int nTries; diff --git a/harbour/contrib/xhb/hbserv.c b/harbour/contrib/xhb/hbserv.c index 6ce226d461..659c17976f 100644 --- a/harbour/contrib/xhb/hbserv.c +++ b/harbour/contrib/xhb/hbserv.c @@ -98,12 +98,6 @@ * Global definition, valid for all systems ***************************************************/ -HB_EXTERN_BEGIN -HB_BOOL hb_isService( void ); -void hb_serviceExit( void ); -HB_EXTERN_END - - static void s_serviceSetHBSig( void ); static void s_serviceSetDflSig( void ); static void s_signalHandlersInit( void ); diff --git a/harbour/contrib/xhb/txtline.c b/harbour/contrib/xhb/txtline.c index cd12aa8bf6..ef0a4385b7 100644 --- a/harbour/contrib/xhb/txtline.c +++ b/harbour/contrib/xhb/txtline.c @@ -56,7 +56,7 @@ #include "hbapiitm.h" #include "hbapierr.h" -void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen, HB_SIZE nTabLen, HB_BOOL bWrap, char ** pTerm, HB_SIZE * pnTermSizes, HB_SIZE nTerms, HB_BOOL * pbFound, HB_BOOL * pbEOF, HB_ISIZ * pnEnd, HB_SIZE * pnEndOffset ) +static void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen, HB_SIZE nTabLen, HB_BOOL bWrap, char ** pTerm, HB_SIZE * pnTermSizes, HB_SIZE nTerms, HB_BOOL * pbFound, HB_BOOL * pbEOF, HB_ISIZ * pnEnd, HB_SIZE * pnEndOffset ) { HB_SIZE nPosTerm, nPosition; HB_SIZE nPos, nCurrCol, nLastBlk; @@ -64,17 +64,17 @@ void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen, HB_SI HB_TRACE(HB_TR_DEBUG, ("hb_readLine(%p, %" HB_PFS "u, %" HB_PFS "u, %" HB_PFS "u, %d, %p, %p, %" HB_PFS "u, %p, %p, %p, %p)", szText, nTextLen, nLineLen, nTabLen, bWrap, pTerm, pnTermSizes, nTerms, pbFound, pbEOF, pnEnd, pnEndOffset )); - *pbFound = HB_FALSE; - *pbEOF = HB_FALSE; - *pnEnd = 0; - nCurrCol = 0; - nLastBlk = 0; + *pbFound = HB_FALSE; + *pbEOF = HB_FALSE; + *pnEnd = 0; + *pnEndOffset = 0; + nCurrCol = 0; + nLastBlk = 0; if( nTextLen == 0 ) { - *pnEnd = -1; - *pnEndOffset = 0; - *pbEOF = HB_TRUE; + *pnEnd = -1; + *pbEOF = HB_TRUE; return; } @@ -143,7 +143,7 @@ void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen, HB_SI if( nCurrCol > nLineLen ) { - if( bWrap == HB_FALSE || nLastBlk == 0 ) + if( !bWrap || nLastBlk == 0 ) { *pnEnd = nPos-1; *pnEndOffset = nPos; @@ -160,7 +160,7 @@ void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen, HB_SI } } - if( *pbFound == HB_FALSE && bBreak == HB_FALSE ) + if( !*pbFound && !bBreak ) { *pnEnd = nTextLen - 1; *pnEndOffset = nTextLen - 1; @@ -168,7 +168,7 @@ void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen, HB_SI } } -HB_ISIZ hb_tabexpand( const char * szString, char * szRet, HB_ISIZ nEnd, HB_SIZE nTabLen ) +static HB_ISIZ hb_tabexpand( const char * szString, char * szRet, HB_ISIZ nEnd, HB_SIZE nTabLen ) { HB_ISIZ nPos, nSpAdded = 0; diff --git a/harbour/contrib/xhb/xhbat.c b/harbour/contrib/xhb/xhbat.c index e79cf0e7d7..25f16c9cf2 100644 --- a/harbour/contrib/xhb/xhbat.c +++ b/harbour/contrib/xhb/xhbat.c @@ -57,7 +57,7 @@ /* locates a substring in a string */ -HB_SIZE hb_AtSkipStrings( const char * szSub, HB_SIZE nSubLen, const char * szText, HB_SIZE nLen ) +static HB_SIZE hb_AtSkipStrings( const char * szSub, HB_SIZE nSubLen, const char * szText, HB_SIZE nLen ) { char cLastChar = ' '; diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index 8065788d32..632f2f51b1 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -960,10 +960,9 @@ extern HB_EXPORT char * hb_strncpyTrim( char * pDest, const char * pSource, H extern HB_EXPORT char * hb_strncpyLower( char * pDest, const char * pSource, HB_SIZE nLen ); /* copy an existing string buffer to another buffer, as lower case */ extern HB_EXPORT char * hb_strncpyUpper( char * pDest, const char * pSource, HB_SIZE nLen ); /* copy an existing string buffer to another buffer, as upper case */ extern HB_EXPORT char * hb_strncpyUpperTrim( char * pDest, const char * pSource, HB_SIZE nLen ); -extern HB_EXPORT double hb_strVal( const char * szText, HB_SIZE nLen ); /* return the numeric value of a character string representation of a number */ extern HB_EXPORT const char * hb_strLTrim( const char * szText, HB_SIZE * nLen ); /* return a pointer to the first non-white space character */ extern HB_EXPORT HB_SIZE hb_strRTrimLen( const char * szText, HB_SIZE nLen, HB_BOOL bAnySpace ); /* return length of a string, ignoring trailing white space (or true spaces) */ -extern HB_EXPORT double hb_strVal( const char * szText, HB_SIZE nLen ); +extern HB_EXPORT double hb_strVal( const char * szText, HB_SIZE nLen ); /* return the numeric value of a character string representation of a number */ extern HB_EXPORT HB_MAXINT hb_strValInt( const char * szText, int * iOverflow ); extern HB_EXPORT char * hb_strRemEscSeq( char * szText, HB_SIZE * nLen ); /* remove C ESC sequences and converts them to Clipper chars */ extern HB_EXPORT char * hb_numToStr( char * szBuf, HB_SIZE nSize, HB_MAXINT nNumber ); diff --git a/harbour/include/hbapicdp.h b/harbour/include/hbapicdp.h index b52059a518..118f31f7cf 100644 --- a/harbour/include/hbapicdp.h +++ b/harbour/include/hbapicdp.h @@ -62,6 +62,7 @@ HB_EXTERN_BEGIN /* This hack is needed to force preprocessing if id is also a macro */ #define HB_CODEPAGE_REQUEST( id ) HB_CODEPAGE_REQUEST_( id ) #define HB_CODEPAGE_REQUEST_( id ) HB_FUNC_EXTERN( HB_CODEPAGE_##id ); \ + extern void hb_codepage_ForceLink_##id( void ); \ void hb_codepage_ForceLink_##id( void ) \ { \ HB_FUNC_EXEC( HB_CODEPAGE_##id ); \ diff --git a/harbour/include/hbapilng.h b/harbour/include/hbapilng.h index 55564b0026..b7d9c9d7db 100644 --- a/harbour/include/hbapilng.h +++ b/harbour/include/hbapilng.h @@ -64,6 +64,7 @@ HB_EXTERN_BEGIN /* This hack is needed to force preprocessing if id is also a macro */ #define HB_LANG_REQUEST( id ) HB_LANG_REQUEST_( id ) #define HB_LANG_REQUEST_( id ) HB_FUNC_EXTERN( HB_LANG_##id ); \ + extern void hb_lang_ForceLink_##id( void ); \ void hb_lang_ForceLink_##id( void ) \ { \ HB_FUNC_EXEC( HB_LANG_##id ); \ diff --git a/harbour/include/hbcompdf.h b/harbour/include/hbcompdf.h index b5b23c89f3..387093c625 100644 --- a/harbour/include/hbcompdf.h +++ b/harbour/include/hbcompdf.h @@ -600,7 +600,7 @@ typedef struct __EXTERN typedef struct _HB_MODULE { const char * szName; - HB_BOOL force; + HB_BOOL force; /* force module compilation */ struct _HB_MODULE * pNext; } HB_MODULE, * PHB_MODULE; diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index a5f5744440..9a229c4857 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -829,7 +829,7 @@ typedef HB_U32 HB_FATTR; */ #if defined( __GNUC__ ) # define HB_PUT_PTR( p, v ) _hb_put_ptr( ( HB_BYTE * ) ( p ), v ) -# define HB_GET_PTR( p ) _hb_get_ptr( ( HB_BYTE * ) ( p ) ) +# define HB_GET_PTR( p ) _hb_get_ptr( ( const HB_BYTE * ) ( p ) ) #elif !defined( HB_STRICT_ALIGNMENT ) # define HB_PUT_PTR( p, v ) do { *( void ** ) ( p ) = ( void * ) ( v ); } while ( 0 ) # define HB_GET_PTR( p ) ( *( void ** ) ( p ) ) @@ -1114,42 +1114,42 @@ typedef HB_U32 HB_FATTR; # if defined( HB_BIG_ENDIAN ) -# define HB_GET_BE_UINT16( p ) _hb_get_std_uint16( ( HB_BYTE * ) ( p ) ) +# define HB_GET_BE_UINT16( p ) _hb_get_std_uint16( ( const HB_BYTE * ) ( p ) ) # define HB_PUT_BE_UINT16( p, w ) _hb_put_std_uint16( ( HB_BYTE * ) ( p ), w ) -# define HB_GET_BE_UINT32( p ) _hb_get_std_uint32( ( HB_BYTE * ) ( p ) ) +# define HB_GET_BE_UINT32( p ) _hb_get_std_uint32( ( const HB_BYTE * ) ( p ) ) # define HB_PUT_BE_UINT32( p, l ) _hb_put_std_uint32( ( HB_BYTE * ) ( p ), l ) -# define HB_GET_BE_UINT64( p ) _hb_get_std_uint64( ( HB_BYTE * ) ( p ) ) +# define HB_GET_BE_UINT64( p ) _hb_get_std_uint64( ( const HB_BYTE * ) ( p ) ) # define HB_PUT_BE_UINT64( p, q ) _hb_put_std_uint64( ( HB_BYTE * ) ( p ), q ) -# define HB_GET_LE_UINT16( p ) _hb_get_rev_uint16( ( HB_BYTE * ) ( p ) ) +# define HB_GET_LE_UINT16( p ) _hb_get_rev_uint16( ( const HB_BYTE * ) ( p ) ) # define HB_PUT_LE_UINT16( p, w ) _hb_put_rev_uint16( ( HB_BYTE * ) ( p ), w ) -# define HB_GET_LE_UINT32( p ) _hb_get_rev_uint32( ( HB_BYTE * ) ( p ) ) +# define HB_GET_LE_UINT32( p ) _hb_get_rev_uint32( ( const HB_BYTE * ) ( p ) ) # define HB_PUT_LE_UINT32( p, l ) _hb_put_rev_uint32( ( HB_BYTE * ) ( p ), l ) -# define HB_GET_LE_UINT64( p ) _hb_get_rev_uint64( ( HB_BYTE * ) ( p ) ) +# define HB_GET_LE_UINT64( p ) _hb_get_rev_uint64( ( const HB_BYTE * ) ( p ) ) # define HB_PUT_LE_UINT64( p, q ) _hb_put_rev_uint64( ( HB_BYTE * ) ( p ), q ) # else /* HB_LITTLE_ENDIAN */ -# define HB_GET_BE_UINT16( p ) _hb_get_rev_uint16( ( HB_BYTE * ) ( p ) ) +# define HB_GET_BE_UINT16( p ) _hb_get_rev_uint16( ( const HB_BYTE * ) ( p ) ) # define HB_PUT_BE_UINT16( p, w ) _hb_put_rev_uint16( ( HB_BYTE * ) ( p ), w ) -# define HB_GET_BE_UINT32( p ) _hb_get_rev_uint32( ( HB_BYTE * ) ( p ) ) +# define HB_GET_BE_UINT32( p ) _hb_get_rev_uint32( ( const HB_BYTE * ) ( p ) ) # define HB_PUT_BE_UINT32( p, l ) _hb_put_rev_uint32( ( HB_BYTE * ) ( p ), l ) -# define HB_GET_BE_UINT64( p ) _hb_get_rev_uint64( ( HB_BYTE * ) ( p ) ) +# define HB_GET_BE_UINT64( p ) _hb_get_rev_uint64( ( const HB_BYTE * ) ( p ) ) # define HB_PUT_BE_UINT64( p, q ) _hb_put_rev_uint64( ( HB_BYTE * ) ( p ), q ) -# define HB_GET_LE_UINT16( p ) _hb_get_std_uint16( ( HB_BYTE * ) ( p ) ) +# define HB_GET_LE_UINT16( p ) _hb_get_std_uint16( ( const HB_BYTE * ) ( p ) ) # define HB_PUT_LE_UINT16( p, w ) _hb_put_std_uint16( ( HB_BYTE * ) ( p ), w ) -# define HB_GET_LE_UINT32( p ) _hb_get_std_uint32( ( HB_BYTE * ) ( p ) ) +# define HB_GET_LE_UINT32( p ) _hb_get_std_uint32( ( const HB_BYTE * ) ( p ) ) # define HB_PUT_LE_UINT32( p, l ) _hb_put_std_uint32( ( HB_BYTE * ) ( p ), l ) -# define HB_GET_LE_UINT64( p ) _hb_get_std_uint64( ( HB_BYTE * ) ( p ) ) +# define HB_GET_LE_UINT64( p ) _hb_get_std_uint64( ( const HB_BYTE * ) ( p ) ) # define HB_PUT_LE_UINT64( p, q ) _hb_put_std_uint64( ( HB_BYTE * ) ( p ), q ) # endif #else /* ! __GNUC__ */ -# define HB_GET_STD_DOUBLE( p ) hb_get_std_double( ( HB_BYTE * ) ( p ) ) -# define HB_GET_REV_DOUBLE( p ) hb_get_rev_double( ( HB_BYTE * ) ( p ) ) +# define HB_GET_STD_DOUBLE( p ) hb_get_std_double( ( const HB_BYTE * ) ( p ) ) +# define HB_GET_REV_DOUBLE( p ) hb_get_rev_double( ( const HB_BYTE * ) ( p ) ) # define HB_PUT_REV_DOUBLE( p, d ) \ do { \ union { \ @@ -1185,32 +1185,32 @@ typedef HB_U32 HB_FATTR; # if !defined( HB_STRICT_ALIGNMENT ) && defined( HB_LITTLE_ENDIAN ) - #define HB_GET_LE_UINT16( p ) ( *( HB_U16 * )( p ) ) + #define HB_GET_LE_UINT16( p ) ( *( const HB_U16 * )( p ) ) #define HB_PUT_LE_UINT16( p, w ) ( *( HB_U16 * )( p ) = ( HB_U16 ) ( w ) ) - #define HB_GET_LE_UINT32( p ) ( *( HB_U32 * )( p ) ) + #define HB_GET_LE_UINT32( p ) ( *( const HB_U32 * )( p ) ) #define HB_PUT_LE_UINT32( p, l ) ( *( HB_U32 * )( p ) = ( HB_U32 ) ( l ) ) - #define HB_GET_LE_UINT64( p ) ( *( HB_U64 * )( p ) ) + #define HB_GET_LE_UINT64( p ) ( *( const HB_U64 * )( p ) ) #define HB_PUT_LE_UINT64( p, q ) ( *( HB_U64 * )( p ) = ( HB_U64 ) ( q ) ) # else #define HB_GET_LE_UINT16( p ) ( ( HB_U16 ) \ - ( ( ( HB_U16 ) (( HB_BYTE * )( p ))[0] ) | \ - ( ( HB_U16 ) (( HB_BYTE * )( p ))[1] << 8 ) ) ) + ( ( ( HB_U16 ) (( const HB_BYTE * )( p ))[0] ) | \ + ( ( HB_U16 ) (( const HB_BYTE * )( p ))[1] << 8 ) ) ) #define HB_GET_LE_UINT32( p ) ( ( HB_U32 ) \ - ( ( ( HB_U32 ) (( HB_BYTE * )( p ))[0] ) | \ - ( ( HB_U32 ) (( HB_BYTE * )( p ))[1] << 8 ) | \ - ( ( HB_U32 ) (( HB_BYTE * )( p ))[2] << 16 ) | \ - ( ( HB_U32 ) (( HB_BYTE * )( p ))[3] << 24 ) ) ) + ( ( ( HB_U32 ) (( const HB_BYTE * )( p ))[0] ) | \ + ( ( HB_U32 ) (( const HB_BYTE * )( p ))[1] << 8 ) | \ + ( ( HB_U32 ) (( const HB_BYTE * )( p ))[2] << 16 ) | \ + ( ( HB_U32 ) (( const HB_BYTE * )( p ))[3] << 24 ) ) ) #define HB_GET_LE_UINT64( p ) ( ( HB_U64 ) \ - ( ( ( HB_U64 ) (( HB_BYTE * )( p ))[0] ) | \ - ( ( HB_U64 ) (( HB_BYTE * )( p ))[1] << 8 ) | \ - ( ( HB_U64 ) (( HB_BYTE * )( p ))[2] << 16 ) | \ - ( ( HB_U64 ) (( HB_BYTE * )( p ))[3] << 24 ) | \ - ( ( HB_U64 ) (( HB_BYTE * )( p ))[4] << 32 ) | \ - ( ( HB_U64 ) (( HB_BYTE * )( p ))[5] << 40 ) | \ - ( ( HB_U64 ) (( HB_BYTE * )( p ))[6] << 48 ) | \ - ( ( HB_U64 ) (( HB_BYTE * )( p ))[7] << 56 ) ) ) + ( ( ( HB_U64 ) (( const HB_BYTE * )( p ))[0] ) | \ + ( ( HB_U64 ) (( const HB_BYTE * )( p ))[1] << 8 ) | \ + ( ( HB_U64 ) (( const HB_BYTE * )( p ))[2] << 16 ) | \ + ( ( HB_U64 ) (( const HB_BYTE * )( p ))[3] << 24 ) | \ + ( ( HB_U64 ) (( const HB_BYTE * )( p ))[4] << 32 ) | \ + ( ( HB_U64 ) (( const HB_BYTE * )( p ))[5] << 40 ) | \ + ( ( HB_U64 ) (( const HB_BYTE * )( p ))[6] << 48 ) | \ + ( ( HB_U64 ) (( const HB_BYTE * )( p ))[7] << 56 ) ) ) #define HB_PUT_LE_UINT16( p, w ) do { \ (( HB_BYTE * )( p ))[0] = ( HB_BYTE )( w ); \ @@ -1236,32 +1236,32 @@ typedef HB_U32 HB_FATTR; # if !defined( HB_STRICT_ALIGNMENT ) && defined( HB_BIG_ENDIAN ) - #define HB_GET_BE_UINT16( p ) ( *( HB_U16 * )( p ) ) + #define HB_GET_BE_UINT16( p ) ( *( const HB_U16 * )( p ) ) #define HB_PUT_BE_UINT16( p, w ) ( *( HB_U16 * )( p ) = ( HB_U16 ) ( w ) ) - #define HB_GET_BE_UINT32( p ) ( *( HB_U32 * )( p ) ) + #define HB_GET_BE_UINT32( p ) ( *( const HB_U32 * )( p ) ) #define HB_PUT_BE_UINT32( p, l ) ( *( HB_U32 * )( p ) = ( HB_U32 ) ( l ) ) - #define HB_GET_BE_UINT64( p ) ( *( HB_U64 * )( p ) ) + #define HB_GET_BE_UINT64( p ) ( *( const HB_U64 * )( p ) ) #define HB_PUT_BE_UINT64( p, q ) ( *( HB_U64 * )( p ) = ( HB_U64 ) ( q ) ) # else #define HB_GET_BE_UINT16( p ) ( ( HB_U16 ) \ - ( ( ( HB_U16 ) (( HB_BYTE * )( p ))[0] << 8 ) | \ - ( ( HB_U16 ) (( HB_BYTE * )( p ))[1] ) ) ) + ( ( ( HB_U16 ) (( const HB_BYTE * )( p ))[0] << 8 ) | \ + ( ( HB_U16 ) (( const HB_BYTE * )( p ))[1] ) ) ) #define HB_GET_BE_UINT32( p ) ( ( HB_U32 ) \ - ( ( ( HB_U32 ) (( HB_BYTE * )( p ))[0] << 24 ) | \ - ( ( HB_U32 ) (( HB_BYTE * )( p ))[1] << 16 ) | \ - ( ( HB_U32 ) (( HB_BYTE * )( p ))[2] << 8 ) | \ - ( ( HB_U32 ) (( HB_BYTE * )( p ))[3] ) ) ) + ( ( ( HB_U32 ) (( const HB_BYTE * )( p ))[0] << 24 ) | \ + ( ( HB_U32 ) (( const HB_BYTE * )( p ))[1] << 16 ) | \ + ( ( HB_U32 ) (( const HB_BYTE * )( p ))[2] << 8 ) | \ + ( ( HB_U32 ) (( const HB_BYTE * )( p ))[3] ) ) ) #define HB_GET_BE_UINT64( p ) ( ( HB_U64 ) \ - ( ( ( HB_U64 ) (( HB_BYTE * )( p ))[0] << 56 ) | \ - ( ( HB_U64 ) (( HB_BYTE * )( p ))[1] << 48 ) | \ - ( ( HB_U64 ) (( HB_BYTE * )( p ))[2] << 40 ) | \ - ( ( HB_U64 ) (( HB_BYTE * )( p ))[3] << 32 ) | \ - ( ( HB_U64 ) (( HB_BYTE * )( p ))[4] << 24 ) | \ - ( ( HB_U64 ) (( HB_BYTE * )( p ))[5] << 16 ) | \ - ( ( HB_U64 ) (( HB_BYTE * )( p ))[6] << 8 ) | \ - ( ( HB_U64 ) (( HB_BYTE * )( p ))[7] ) ) ) + ( ( ( HB_U64 ) (( const HB_BYTE * )( p ))[0] << 56 ) | \ + ( ( HB_U64 ) (( const HB_BYTE * )( p ))[1] << 48 ) | \ + ( ( HB_U64 ) (( const HB_BYTE * )( p ))[2] << 40 ) | \ + ( ( HB_U64 ) (( const HB_BYTE * )( p ))[3] << 32 ) | \ + ( ( HB_U64 ) (( const HB_BYTE * )( p ))[4] << 24 ) | \ + ( ( HB_U64 ) (( const HB_BYTE * )( p ))[5] << 16 ) | \ + ( ( HB_U64 ) (( const HB_BYTE * )( p ))[6] << 8 ) | \ + ( ( HB_U64 ) (( const HB_BYTE * )( p ))[7] ) ) ) #define HB_PUT_BE_UINT16( p, w ) do { \ (( HB_BYTE * )( p ))[0] = ( HB_BYTE )( (w) >> 8 ); \ @@ -1295,11 +1295,11 @@ typedef HB_U32 HB_FATTR; */ #if defined( HB_FORCE_IEEE754_DOUBLE ) -# define HB_GET_LE_DOUBLE( p ) hb_get_ieee754( ( HB_BYTE * ) ( p ) ) +# define HB_GET_LE_DOUBLE( p ) hb_get_ieee754( ( const HB_BYTE * ) ( p ) ) # define HB_PUT_LE_DOUBLE( p, d ) hb_put_ieee754( ( HB_BYTE * ) ( p ), ( d ) ) # define HB_DBL2ORD( d, o ) hb_put_ord_ieee754( ( o ), *( d ) ) # define HB_ORD2DBL( o, d ) do { \ - *d = hb_get_ord_ieee754( ( HB_BYTE * ) ( o ) ); \ + *( d ) = hb_get_ord_ieee754( ( const HB_BYTE * ) ( o ) ); \ } while( 0 ) #elif defined( HB_BIG_ENDIAN ) @@ -1314,7 +1314,7 @@ typedef HB_U32 HB_FATTR; #else -# define HB_GET_LE_DOUBLE( p ) ( *( double * )( p ) ) +# define HB_GET_LE_DOUBLE( p ) ( *( const double * )( p ) ) # define HB_PUT_LE_DOUBLE( p, d ) ( *( double * )( p ) = ( double ) ( d ) ) #endif @@ -1324,45 +1324,45 @@ typedef HB_U32 HB_FATTR; #define HB_ORD2DBL( o, d ) do { \ if ( ( ( HB_BYTE * ) ( o ) )[ 0 ] & 0x80 ) { \ - ( ( HB_BYTE * ) ( d ) )[ 0 ] = ( ( HB_BYTE * ) ( o ) )[ 0 ]; \ - ( ( HB_BYTE * ) ( d ) )[ 1 ] = ( ( HB_BYTE * ) ( o ) )[ 1 ]; \ - ( ( HB_BYTE * ) ( d ) )[ 2 ] = ( ( HB_BYTE * ) ( o ) )[ 2 ]; \ - ( ( HB_BYTE * ) ( d ) )[ 3 ] = ( ( HB_BYTE * ) ( o ) )[ 3 ]; \ - ( ( HB_BYTE * ) ( d ) )[ 4 ] = ( ( HB_BYTE * ) ( o ) )[ 4 ]; \ - ( ( HB_BYTE * ) ( d ) )[ 5 ] = ( ( HB_BYTE * ) ( o ) )[ 5 ]; \ - ( ( HB_BYTE * ) ( d ) )[ 6 ] = ( ( HB_BYTE * ) ( o ) )[ 6 ]; \ - ( ( HB_BYTE * ) ( d ) )[ 7 ] = ( ( HB_BYTE * ) ( o ) )[ 7 ] ^ ( HB_BYTE ) 0x80; \ + ( ( HB_BYTE * ) ( d ) )[ 0 ] = ( ( const HB_BYTE * ) ( o ) )[ 0 ]; \ + ( ( HB_BYTE * ) ( d ) )[ 1 ] = ( ( const HB_BYTE * ) ( o ) )[ 1 ]; \ + ( ( HB_BYTE * ) ( d ) )[ 2 ] = ( ( const HB_BYTE * ) ( o ) )[ 2 ]; \ + ( ( HB_BYTE * ) ( d ) )[ 3 ] = ( ( const HB_BYTE * ) ( o ) )[ 3 ]; \ + ( ( HB_BYTE * ) ( d ) )[ 4 ] = ( ( const HB_BYTE * ) ( o ) )[ 4 ]; \ + ( ( HB_BYTE * ) ( d ) )[ 5 ] = ( ( const HB_BYTE * ) ( o ) )[ 5 ]; \ + ( ( HB_BYTE * ) ( d ) )[ 6 ] = ( ( const HB_BYTE * ) ( o ) )[ 6 ]; \ + ( ( HB_BYTE * ) ( d ) )[ 7 ] = ( ( const HB_BYTE * ) ( o ) )[ 7 ] ^ ( HB_BYTE ) 0x80; \ } else { \ - ( ( HB_BYTE * ) ( d ) )[ 0 ] = ( ( HB_BYTE * ) ( o ) )[ 0 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( d ) )[ 1 ] = ( ( HB_BYTE * ) ( o ) )[ 1 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( d ) )[ 2 ] = ( ( HB_BYTE * ) ( o ) )[ 2 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( d ) )[ 3 ] = ( ( HB_BYTE * ) ( o ) )[ 3 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( d ) )[ 4 ] = ( ( HB_BYTE * ) ( o ) )[ 4 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( d ) )[ 5 ] = ( ( HB_BYTE * ) ( o ) )[ 5 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( d ) )[ 6 ] = ( ( HB_BYTE * ) ( o ) )[ 6 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( d ) )[ 7 ] = ( ( HB_BYTE * ) ( o ) )[ 7 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( d ) )[ 0 ] = ( ( const HB_BYTE * ) ( o ) )[ 0 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( d ) )[ 1 ] = ( ( const HB_BYTE * ) ( o ) )[ 1 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( d ) )[ 2 ] = ( ( const HB_BYTE * ) ( o ) )[ 2 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( d ) )[ 3 ] = ( ( const HB_BYTE * ) ( o ) )[ 3 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( d ) )[ 4 ] = ( ( const HB_BYTE * ) ( o ) )[ 4 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( d ) )[ 5 ] = ( ( const HB_BYTE * ) ( o ) )[ 5 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( d ) )[ 6 ] = ( ( const HB_BYTE * ) ( o ) )[ 6 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( d ) )[ 7 ] = ( ( const HB_BYTE * ) ( o ) )[ 7 ] ^ ( HB_BYTE ) 0xFF; \ } } while ( 0 ) #define HB_DBL2ORD( d, o ) do { \ - if ( *( double * )( d ) >= 0.0 ) { \ - if( *( double * )( d ) == -0.0 ) *( double * )( d ) = 0.0; \ - ( ( HB_BYTE * ) ( o ) )[ 0 ] = ( ( HB_BYTE * ) ( d ) )[ 0 ] ^ ( HB_BYTE ) 0x80; \ - ( ( HB_BYTE * ) ( o ) )[ 1 ] = ( ( HB_BYTE * ) ( d ) )[ 1 ]; \ - ( ( HB_BYTE * ) ( o ) )[ 2 ] = ( ( HB_BYTE * ) ( d ) )[ 2 ]; \ - ( ( HB_BYTE * ) ( o ) )[ 3 ] = ( ( HB_BYTE * ) ( d ) )[ 3 ]; \ - ( ( HB_BYTE * ) ( o ) )[ 4 ] = ( ( HB_BYTE * ) ( d ) )[ 4 ]; \ - ( ( HB_BYTE * ) ( o ) )[ 5 ] = ( ( HB_BYTE * ) ( d ) )[ 5 ]; \ - ( ( HB_BYTE * ) ( o ) )[ 6 ] = ( ( HB_BYTE * ) ( d ) )[ 6 ]; \ - ( ( HB_BYTE * ) ( o ) )[ 7 ] = ( ( HB_BYTE * ) ( d ) )[ 7 ]; \ + if ( *( d ) >= 0.0 ) { \ + if( *( d ) == -0.0 ) *( d ) = 0.0; \ + ( ( HB_BYTE * ) ( o ) )[ 0 ] = ( ( const HB_BYTE * ) ( d ) )[ 0 ] ^ ( HB_BYTE ) 0x80; \ + ( ( HB_BYTE * ) ( o ) )[ 1 ] = ( ( const HB_BYTE * ) ( d ) )[ 1 ]; \ + ( ( HB_BYTE * ) ( o ) )[ 2 ] = ( ( const HB_BYTE * ) ( d ) )[ 2 ]; \ + ( ( HB_BYTE * ) ( o ) )[ 3 ] = ( ( const HB_BYTE * ) ( d ) )[ 3 ]; \ + ( ( HB_BYTE * ) ( o ) )[ 4 ] = ( ( const HB_BYTE * ) ( d ) )[ 4 ]; \ + ( ( HB_BYTE * ) ( o ) )[ 5 ] = ( ( const HB_BYTE * ) ( d ) )[ 5 ]; \ + ( ( HB_BYTE * ) ( o ) )[ 6 ] = ( ( const HB_BYTE * ) ( d ) )[ 6 ]; \ + ( ( HB_BYTE * ) ( o ) )[ 7 ] = ( ( const HB_BYTE * ) ( d ) )[ 7 ]; \ } else { \ - ( ( HB_BYTE * ) ( o ) )[ 0 ] = ( ( HB_BYTE * ) ( d ) )[ 0 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( o ) )[ 1 ] = ( ( HB_BYTE * ) ( d ) )[ 1 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( o ) )[ 2 ] = ( ( HB_BYTE * ) ( d ) )[ 2 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( o ) )[ 3 ] = ( ( HB_BYTE * ) ( d ) )[ 3 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( o ) )[ 4 ] = ( ( HB_BYTE * ) ( d ) )[ 4 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( o ) )[ 5 ] = ( ( HB_BYTE * ) ( d ) )[ 5 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( o ) )[ 6 ] = ( ( HB_BYTE * ) ( d ) )[ 6 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( o ) )[ 7 ] = ( ( HB_BYTE * ) ( d ) )[ 7 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( o ) )[ 0 ] = ( ( const HB_BYTE * ) ( d ) )[ 0 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( o ) )[ 1 ] = ( ( const HB_BYTE * ) ( d ) )[ 1 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( o ) )[ 2 ] = ( ( const HB_BYTE * ) ( d ) )[ 2 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( o ) )[ 3 ] = ( ( const HB_BYTE * ) ( d ) )[ 3 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( o ) )[ 4 ] = ( ( const HB_BYTE * ) ( d ) )[ 4 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( o ) )[ 5 ] = ( ( const HB_BYTE * ) ( d ) )[ 5 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( o ) )[ 6 ] = ( ( const HB_BYTE * ) ( d ) )[ 6 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( o ) )[ 7 ] = ( ( const HB_BYTE * ) ( d ) )[ 7 ] ^ ( HB_BYTE ) 0xFF; \ } } while ( 0 ) # else /* HB_LITTLE_ENDIAN */ @@ -1389,25 +1389,25 @@ typedef HB_U32 HB_FATTR; } } while ( 0 ) #define HB_DBL2ORD( d, o ) do { \ - if ( *( double * )( d ) >= 0.0 ) { \ - if( *( double * )( d ) == -0.0 ) *( double * )( d ) = 0.0; \ - ( ( HB_BYTE * ) ( o ) )[ 0 ] = ( ( HB_BYTE * ) ( d ) )[ 7 ] ^ ( HB_BYTE ) 0x80; \ - ( ( HB_BYTE * ) ( o ) )[ 1 ] = ( ( HB_BYTE * ) ( d ) )[ 6 ]; \ - ( ( HB_BYTE * ) ( o ) )[ 2 ] = ( ( HB_BYTE * ) ( d ) )[ 5 ]; \ - ( ( HB_BYTE * ) ( o ) )[ 3 ] = ( ( HB_BYTE * ) ( d ) )[ 4 ]; \ - ( ( HB_BYTE * ) ( o ) )[ 4 ] = ( ( HB_BYTE * ) ( d ) )[ 3 ]; \ - ( ( HB_BYTE * ) ( o ) )[ 5 ] = ( ( HB_BYTE * ) ( d ) )[ 2 ]; \ - ( ( HB_BYTE * ) ( o ) )[ 6 ] = ( ( HB_BYTE * ) ( d ) )[ 1 ]; \ - ( ( HB_BYTE * ) ( o ) )[ 7 ] = ( ( HB_BYTE * ) ( d ) )[ 0 ]; \ + if ( *( d ) >= 0.0 ) { \ + if( *( d ) == -0.0 ) *( d ) = 0.0; \ + ( ( HB_BYTE * ) ( o ) )[ 0 ] = ( ( const HB_BYTE * ) ( d ) )[ 7 ] ^ ( HB_BYTE ) 0x80; \ + ( ( HB_BYTE * ) ( o ) )[ 1 ] = ( ( const HB_BYTE * ) ( d ) )[ 6 ]; \ + ( ( HB_BYTE * ) ( o ) )[ 2 ] = ( ( const HB_BYTE * ) ( d ) )[ 5 ]; \ + ( ( HB_BYTE * ) ( o ) )[ 3 ] = ( ( const HB_BYTE * ) ( d ) )[ 4 ]; \ + ( ( HB_BYTE * ) ( o ) )[ 4 ] = ( ( const HB_BYTE * ) ( d ) )[ 3 ]; \ + ( ( HB_BYTE * ) ( o ) )[ 5 ] = ( ( const HB_BYTE * ) ( d ) )[ 2 ]; \ + ( ( HB_BYTE * ) ( o ) )[ 6 ] = ( ( const HB_BYTE * ) ( d ) )[ 1 ]; \ + ( ( HB_BYTE * ) ( o ) )[ 7 ] = ( ( const HB_BYTE * ) ( d ) )[ 0 ]; \ } else { \ - ( ( HB_BYTE * ) ( o ) )[ 0 ] = ( ( HB_BYTE * ) ( d ) )[ 7 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( o ) )[ 1 ] = ( ( HB_BYTE * ) ( d ) )[ 6 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( o ) )[ 2 ] = ( ( HB_BYTE * ) ( d ) )[ 5 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( o ) )[ 3 ] = ( ( HB_BYTE * ) ( d ) )[ 4 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( o ) )[ 4 ] = ( ( HB_BYTE * ) ( d ) )[ 3 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( o ) )[ 5 ] = ( ( HB_BYTE * ) ( d ) )[ 2 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( o ) )[ 6 ] = ( ( HB_BYTE * ) ( d ) )[ 1 ] ^ ( HB_BYTE ) 0xFF; \ - ( ( HB_BYTE * ) ( o ) )[ 7 ] = ( ( HB_BYTE * ) ( d ) )[ 0 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( o ) )[ 0 ] = ( ( const HB_BYTE * ) ( d ) )[ 7 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( o ) )[ 1 ] = ( ( const HB_BYTE * ) ( d ) )[ 6 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( o ) )[ 2 ] = ( ( const HB_BYTE * ) ( d ) )[ 5 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( o ) )[ 3 ] = ( ( const HB_BYTE * ) ( d ) )[ 4 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( o ) )[ 4 ] = ( ( const HB_BYTE * ) ( d ) )[ 3 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( o ) )[ 5 ] = ( ( const HB_BYTE * ) ( d ) )[ 2 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( o ) )[ 6 ] = ( ( const HB_BYTE * ) ( d ) )[ 1 ] ^ ( HB_BYTE ) 0xFF; \ + ( ( HB_BYTE * ) ( o ) )[ 7 ] = ( ( const HB_BYTE * ) ( d ) )[ 0 ] ^ ( HB_BYTE ) 0xFF; \ } } while ( 0 ) # endif @@ -1421,28 +1421,28 @@ typedef HB_U32 HB_FATTR; * so we always have to build them from HB_BYTEs and cannot use C casting */ #define HB_GET_LE_INT24( p ) ( ( HB_I32 ) \ - ( ( ( HB_I32 ) (( HB_BYTE * )( p ))[0] ) | \ - ( ( HB_I32 ) (( HB_BYTE * )( p ))[1] << 8 ) | \ - ( ( HB_I32 ) (( HB_BYTE * )( p ))[2] << 16 ) | \ - ( ( HB_I32 ) ((( HB_BYTE * )( p ))[2] & 0x80 ? 0xFF : 0x00 ) << 24 ) ) ) + ( ( ( HB_I32 ) (( const HB_BYTE * )( p ))[0] ) | \ + ( ( HB_I32 ) (( const HB_BYTE * )( p ))[1] << 8 ) | \ + ( ( HB_I32 ) (( const HB_BYTE * )( p ))[2] << 16 ) | \ + ( ( HB_I32 ) ((( const HB_BYTE * )( p ))[2] & 0x80 ? 0xFF : 0x00 ) << 24 ) ) ) #define HB_GET_LE_UINT24( p ) ( ( HB_U32 ) \ - ( ( ( HB_U32 ) (( HB_BYTE * )( p ))[0] ) | \ - ( ( HB_U32 ) (( HB_BYTE * )( p ))[1] << 8 ) | \ - ( ( HB_U32 ) (( HB_BYTE * )( p ))[2] << 16 ) ) ) + ( ( ( HB_U32 ) (( const HB_BYTE * )( p ))[0] ) | \ + ( ( HB_U32 ) (( const HB_BYTE * )( p ))[1] << 8 ) | \ + ( ( HB_U32 ) (( const HB_BYTE * )( p ))[2] << 16 ) ) ) #define HB_PUT_LE_UINT24( p, u ) do { \ (( HB_BYTE * )( p ))[0] = ( HB_BYTE )( u ); \ (( HB_BYTE * )( p ))[1] = ( HB_BYTE )( (u) >> 8 ); \ (( HB_BYTE * )( p ))[2] = ( HB_BYTE )( (u) >> 16 ); \ } while ( 0 ) #define HB_GET_BE_INT24( p ) ( ( HB_I32 ) \ - ( ( ( HB_I32 ) (( HB_BYTE * )( p ))[2] ) | \ - ( ( HB_I32 ) (( HB_BYTE * )( p ))[1] << 8 ) | \ - ( ( HB_I32 ) (( HB_BYTE * )( p ))[0] << 16 ) | \ - ( ( HB_I32 ) ((( HB_BYTE * )( p ))[0] & 0x80 ? 0xFF : 0x00 ) << 24 ) ) ) + ( ( ( HB_I32 ) (( const HB_BYTE * )( p ))[2] ) | \ + ( ( HB_I32 ) (( const HB_BYTE * )( p ))[1] << 8 ) | \ + ( ( HB_I32 ) (( const HB_BYTE * )( p ))[0] << 16 ) | \ + ( ( HB_I32 ) ((( const HB_BYTE * )( p ))[0] & 0x80 ? 0xFF : 0x00 ) << 24 ) ) ) #define HB_GET_BE_UINT24( p ) ( ( HB_U32 ) \ - ( ( ( HB_U32 ) (( HB_BYTE * )( p ))[2] ) | \ - ( ( HB_U32 ) (( HB_BYTE * )( p ))[1] << 8 ) | \ - ( ( HB_U32 ) (( HB_BYTE * )( p ))[0] << 16 ) ) ) + ( ( ( HB_U32 ) (( const HB_BYTE * )( p ))[2] ) | \ + ( ( HB_U32 ) (( const HB_BYTE * )( p ))[1] << 8 ) | \ + ( ( HB_U32 ) (( const HB_BYTE * )( p ))[0] << 16 ) ) ) #define HB_PUT_BE_UINT24( p, u ) do { \ (( HB_BYTE * )( p ))[2] = ( HB_BYTE )( u ); \ (( HB_BYTE * )( p ))[1] = ( HB_BYTE )( (u) >> 8 ); \ @@ -1478,8 +1478,8 @@ typedef HB_U32 HB_FATTR; #undef HB_DBL_LIM_INT64 #define UINT64_MAXDBL ( ( ( double ) UINT32_MAX + 1.0 ) * \ ( ( double ) UINT32_MAX + 1.0 ) - 1.0 ) - #define HB_GET_LE_INT64( p ) hb_get_le_int64( ( HB_BYTE * ) ( p ) ) - #define HB_GET_LE_UINT64( p ) hb_get_le_uint64( ( HB_BYTE * ) ( p ) ) + #define HB_GET_LE_INT64( p ) hb_get_le_int64( ( const HB_BYTE * ) ( p ) ) + #define HB_GET_LE_UINT64( p ) hb_get_le_uint64( ( const HB_BYTE * ) ( p ) ) #define HB_PUT_LE_UINT64( p, d ) hb_put_le_uint64( ( HB_BYTE * ) ( p ), \ ( double ) ( d ) ) #define HB_PCODE_MKLONGLONG( p ) ( ( double ) HB_GET_LE_INT64( p ) ) diff --git a/harbour/include/hbgtcore.h b/harbour/include/hbgtcore.h index 92bcbe7d13..b9870e06f7 100644 --- a/harbour/include/hbgtcore.h +++ b/harbour/include/hbgtcore.h @@ -88,6 +88,7 @@ HB_EXTERN_BEGIN #define HB_GT_REQUEST( id ) HB_GT_REQUEST_( _HB_GT_PREF_( id ) ) #define HB_GT_REQUEST_( id ) HB_GT_REQUEST__( id ) #define HB_GT_REQUEST__( id ) HB_FUNC_EXTERN( id ); \ + extern void hb_gt_ForceLink_##id( void ); \ void hb_gt_ForceLink_##id( void ) \ { \ HB_FUNC_EXEC( id ); \ diff --git a/harbour/include/hbpp.h b/harbour/include/hbpp.h index ffa9c97dbf..18f85e6cd8 100644 --- a/harbour/include/hbpp.h +++ b/harbour/include/hbpp.h @@ -683,7 +683,6 @@ extern void hb_pp_addDefine( PHB_PP_STATE pState, const char * szDefName, con extern void hb_pp_delDefine( PHB_PP_STATE pState, const char * szDefName ); extern HB_BOOL hb_pp_lasterror( PHB_PP_STATE pState ); extern int hb_pp_errorCount( PHB_PP_STATE pState ); -extern HB_BOOL hb_pp_eof( PHB_PP_STATE pState ); extern void hb_pp_tokenUpper( PHB_PP_TOKEN pToken ); extern void hb_pp_tokenToString( PHB_PP_STATE pState, PHB_PP_TOKEN pToken ); diff --git a/harbour/include/hbstack.h b/harbour/include/hbstack.h index 177bcbbedb..8635acd58c 100644 --- a/harbour/include/hbstack.h +++ b/harbour/include/hbstack.h @@ -319,6 +319,7 @@ extern PHB_STACKRDD hb_stackRDD( void ); extern void ** hb_stackDebugInfo( void ); #ifdef _HB_API_INTERNAL_ +extern void hb_stackDec( void ); extern void hb_stackDecrease( HB_SIZE nItems ); extern HB_ITEM_PTR hb_stackNewFrame( PHB_STACK_STATE pFrame, HB_USHORT uiParams ); extern void hb_stackOldFrame( PHB_STACK_STATE pFrame ); @@ -462,7 +463,7 @@ extern void hb_stackUpdateAllocator( void *, PHB_ALLOCUPDT_FUNC, int ); hb_itemRawMove( &hb_stack.Return, * hb_stack.pPos ); \ } while ( 0 ) -#endif +#endif /* HB_STACK_SAFEMACROS */ #define hb_stackPush( ) do { \ if( ++hb_stack.pPos == hb_stack.pEnd ) \ diff --git a/harbour/include/hbznet.h b/harbour/include/hbznet.h index 6aeaccf20d..25ee2dd45a 100644 --- a/harbour/include/hbznet.h +++ b/harbour/include/hbznet.h @@ -69,8 +69,6 @@ typedef long ( * HB_INET_RFUNC ) ( PHB_ZNETSTREAM, HB_SOCKET, void *, long, HB_M typedef long ( * HB_INET_FFUNC ) ( PHB_ZNETSTREAM, HB_SOCKET, HB_MAXINT ); typedef void ( * HB_INET_CFUNC ) ( PHB_ZNETSTREAM ); -extern HB_EXPORT int hb_znetError( PHB_ZNETSTREAM pStream ); - extern HB_EXPORT PHB_ZNETSTREAM hb_znetOpen( int level, int strategy ); extern HB_EXPORT void hb_znetEncryptKey( PHB_ZNETSTREAM pStream, const void * keydata, int keylen ); extern HB_EXPORT void hb_znetClose( PHB_ZNETSTREAM pStream ); diff --git a/harbour/src/compiler/complex.c b/harbour/src/compiler/complex.c index 94c1f36cd8..37d1226f30 100644 --- a/harbour/src/compiler/complex.c +++ b/harbour/src/compiler/complex.c @@ -474,6 +474,8 @@ static int hb_comp_dayTimeDecode( PHB_COMP_LEX pLex, PHB_PP_TOKEN pToken, } #endif +extern int hb_comp_yylex( YYSTYPE *yylval_ptr, HB_COMP_DECL ); + int hb_comp_yylex( YYSTYPE *yylval_ptr, HB_COMP_DECL ) { PHB_COMP_LEX pLex = HB_COMP_PARAM->pLex; diff --git a/harbour/src/macro/macrolex.c b/harbour/src/macro/macrolex.c index 3ea06ac5f3..98349026dd 100644 --- a/harbour/src/macro/macrolex.c +++ b/harbour/src/macro/macrolex.c @@ -265,6 +265,8 @@ static int hb_lexNumConv( YYSTYPE *yylval_ptr, PHB_MACRO_LEX pLex, HB_SIZE nLen } } +extern int hb_macro_yylex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro ); + int hb_macro_yylex( YYSTYPE *yylval_ptr, HB_MACRO_PTR pMacro ) { PHB_MACRO_LEX pLex = ( PHB_MACRO_LEX ) pMacro->pLex; diff --git a/harbour/src/rdd/workarea.c b/harbour/src/rdd/workarea.c index 0d62230541..d72d5a07b0 100644 --- a/harbour/src/rdd/workarea.c +++ b/harbour/src/rdd/workarea.c @@ -2291,6 +2291,7 @@ HB_FUNC( __RDDPREALLOCATE ) } HB_FUNC_EXTERN( RDDSYS ); +extern void _hb_rddWorkAreaForceLink( void ); void _hb_rddWorkAreaForceLink( void ) { HB_FUNC_EXEC( RDDSYS ); diff --git a/harbour/src/rtl/dates.c b/harbour/src/rtl/dates.c index 0e9beaea5d..ab3f968edf 100644 --- a/harbour/src/rtl/dates.c +++ b/harbour/src/rtl/dates.c @@ -245,7 +245,7 @@ char * hb_dateFormat( const char * szDate, char * szFormattedDate, const char * return szFormattedDate; } -int hb_dateUnformatRaw( const char * szDate, const char * szDateFormat, long * plDate ) +static int hb_dateUnformatRaw( const char * szDate, const char * szDateFormat, long * plDate ) { int d_value = 0, m_value = 0, y_value = 0; int iSize = 0; diff --git a/harbour/src/vm/hvm.c b/harbour/src/vm/hvm.c index 8bfd895762..0e4fad048d 100644 --- a/harbour/src/vm/hvm.c +++ b/harbour/src/vm/hvm.c @@ -6456,7 +6456,7 @@ static void hb_vmTSVRefMark( void * value ) } /* destructor for terminated threads */ -void hb_vmTSVarClean( void * pThreadItem ) +static void hb_vmTSVarClean( void * pThreadItem ) { if( HB_IS_COMPLEX( ( PHB_ITEM ) pThreadItem ) ) hb_itemClear( ( PHB_ITEM ) pThreadItem ); @@ -11906,6 +11906,7 @@ HB_FUNC( ERRORLEVEL ) Don't make this function static, because it's not called from this file. [vszakats] */ +extern void hb_vmForceLink( void ); void hb_vmForceLink( void ) { HB_TRACE(HB_TR_DEBUG, ("hb_vmForceLink()")); diff --git a/harbour/src/vm/thread.c b/harbour/src/vm/thread.c index 66c034032d..4893ee161c 100644 --- a/harbour/src/vm/thread.c +++ b/harbour/src/vm/thread.c @@ -119,11 +119,11 @@ static volatile HB_BOOL s_fThreadInit = HB_FALSE; -static PHB_ITEM s_pOnceMutex = NULL; #if !defined( HB_MT_VM ) /* nothing */ #else + static PHB_ITEM s_pOnceMutex = NULL; static int s_waiting_for_threads = 0; @@ -196,6 +196,7 @@ static PHB_ITEM s_pOnceMutex = NULL; #endif /* HB_MT_VM */ +#if defined( HB_MT_VM ) void hb_threadInit( void ) { if( !s_fThreadInit ) @@ -231,6 +232,7 @@ void hb_threadExit( void ) hb_taskExit(); #endif } +#endif /* HB_MT_VM */ void hb_threadReleaseCPU( void ) {