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()
This commit is contained in:
Przemyslaw Czerpak
2008-10-27 17:05:30 +00:00
parent 97b1d094e5
commit 4e457b25f1
4 changed files with 45 additions and 3 deletions

View File

@@ -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.

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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 )