diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d92ae47e62..3d18af97ce 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,18 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-10-27 18:05 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbdefs.h + + added HB_PRINTF_FORMAT() macro to declare functions with printf() + like formatting parameters - now it works only for GCC compilers. + + * harbour/include/hbapi.h + * declare hb_snprintf() with HB_PRINTF_FORMAT() attribute + + * harbour/source/rtl/philes.c + + set FERROR() in HB_FLOCK()/HB_FUNLOCK() + + accept extended lock attributes (WAIT/SHARE) in HB_FLOCK() + 2008-10-27 15:24 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * source/compiler/gencc.c ! Fixed -gc3 double number handling problem. diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index 428f71a64d..e5e7b17f52 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -827,7 +827,7 @@ extern HB_EXPORT BOOL hb_compStrToNum( const char * szNum, ULONG ulLen, HB_ extern HB_EXPORT BOOL hb_valStrnToNum( const char * szNum, ULONG ulLen, HB_LONG * plVal, double * pdVal, int * piDec, int * piWidth ); /* converts string to number, sets iDec, iWidth and returns TRUE if results is double, used by VAL() */ extern HB_EXPORT BOOL hb_strToNum( const char * szNum, HB_LONG * plVal, double * pdVal ); /* converts string to number, returns TRUE if results is double */ extern HB_EXPORT BOOL hb_strnToNum( const char * szNum, ULONG ulLen, HB_LONG * plVal, double * pdVal ); /* converts string to number, returns TRUE if results is double */ -extern HB_EXPORT ULONG hb_snprintf( char * buffer, ULONG nSize, const char * format, ... ); /* snprintf() wrapper */ +extern HB_EXPORT ULONG hb_snprintf( char * buffer, ULONG nSize, const char * format, ... ) HB_PRINTF_FORMAT( 3, 4 ); /* snprintf() wrapper */ extern HB_EXPORT BOOL hb_strMatchFile( const char * pszString, const char * szPattern ); /* compare two strings using platform dependent rules for file matching */ extern HB_EXPORT BOOL hb_strMatchRegExp( const char * szString, const char * szPattern ); /* compare two strings using a regular expression pattern */ diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index ec6f9e8052..912774419e 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -1236,6 +1236,12 @@ typedef PHB_FUNC HB_FUNC_PTR; #endif +#if defined( __GNUC__ ) + #define HB_PRINTF_FORMAT( _nStr, _nParam ) \ + __attribute__ (( format (printf, _nStr, _nParam))) +#else + #define HB_PRINTF_FORMAT( _nStr, _nParam ) +#endif /* Function declaration macros */ diff --git a/harbour/source/rtl/philes.c b/harbour/source/rtl/philes.c index 51aea0348b..8d31c1925b 100644 --- a/harbour/source/rtl/philes.c +++ b/harbour/source/rtl/philes.c @@ -294,12 +294,36 @@ HB_FUNC( HB_FCOMMIT ) HB_FUNC( HB_FLOCK ) { - hb_retl( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) ? hb_fsLockLarge( hb_numToHandle( hb_parnint( 1 ) ), ( HB_FOFFSET ) hb_parnint( 2 ), ( HB_FOFFSET ) hb_parnint( 3 ), FL_LOCK ) : FALSE ); + USHORT uiError = 0; + BOOL fResult = FALSE; + + if( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) ) + { + fResult = hb_fsLockLarge( hb_numToHandle( hb_parnint( 1 ) ), + ( HB_FOFFSET ) hb_parnint( 2 ), + ( HB_FOFFSET ) hb_parnint( 3 ), + FL_LOCK | ( ( USHORT ) hb_parni( 4 ) & ~FL_MASK ) ); + uiError = hb_fsError(); + } + hb_fsSetFError( uiError ); + hb_retl( fResult ); } HB_FUNC( HB_FUNLOCK ) { - hb_retl( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) ? hb_fsLockLarge( hb_numToHandle( hb_parnint( 1 ) ), ( HB_FOFFSET ) hb_parnint( 2 ), ( HB_FOFFSET ) hb_parnint( 3 ), FL_UNLOCK ) : FALSE ); + USHORT uiError = 0; + BOOL fResult = FALSE; + + if( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) ) + { + fResult = hb_fsLockLarge( hb_numToHandle( hb_parnint( 1 ) ), + ( HB_FOFFSET ) hb_parnint( 2 ), + ( HB_FOFFSET ) hb_parnint( 3 ), + FL_UNLOCK ); + uiError = hb_fsError(); + } + hb_fsSetFError( uiError ); + hb_retl( fResult ); } HB_FUNC( HB_OSERROR )