diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1d83c325c2..807339869c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,32 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-09-03 23:06 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * contrib/hbziparc/hbziparc.prg + ! Fix to one of the rarely used function names. + + * contrib/gtalleg/gtalleg.c + * contrib/hbw32/dllcall.c + * contrib/hbcurl/hbcurl.c + * contrib/hbfimage/fi_winfu.c + * contrib/hbfimage/fi_wrp.c + * source/vm/memvars.c + * source/rtl/gtwin/gtwin.c + * source/rtl/math.c + * source/rtl/gtclip.c + * source/rtl/fstemp.c + * source/rtl/is.c + * source/rtl/xsavescr.c + * source/rtl/fkmax.c + * source/rtl/langapi.c + * source/rtl/hbrandom.c + * source/rtl/hbinet.c + * source/rtl/hbffind.c + * Minor formatting, code style/format cleanup (!=/== NULL mostly). + + * source/compiler/genc.c + * Minor; empty line added to .c output. + 2008-09-03 20:03 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/hbziparc/hbziparc.prg ! Some formatting to docs. diff --git a/harbour/contrib/gtalleg/gtalleg.c b/harbour/contrib/gtalleg/gtalleg.c index 1e70f98c44..df50e7e789 100644 --- a/harbour/contrib/gtalleg/gtalleg.c +++ b/harbour/contrib/gtalleg/gtalleg.c @@ -516,10 +516,10 @@ static BOOL hb_gt_alleg_InitializeScreen( PHB_GT pGT, int iRows, int iCols, BOOL s_pClr[15] = al_make_color(0xFF, 0xFF, 0xFF); /* bright white */ s_bmp = al_create_system_bitmap(AL_SCREEN_W, AL_SCREEN_H); - if( s_bmp == NULL ) + if( !s_bmp ) { s_bmp = al_create_bitmap(AL_SCREEN_W, AL_SCREEN_H); - if( s_bmp == NULL ) + if( !s_bmp ) { hb_gt_alleg_Error( "Could not allocate double buffer bitmap" ); } diff --git a/harbour/contrib/hbcurl/hbcurl.c b/harbour/contrib/hbcurl/hbcurl.c index d1dcdaa074..aaa38434c3 100644 --- a/harbour/contrib/hbcurl/hbcurl.c +++ b/harbour/contrib/hbcurl/hbcurl.c @@ -161,12 +161,12 @@ static const char * hb_curl_StrHashNew( PHB_CURL hb_curl, const char * szValue ) { char * szHash; - if( hb_curl->pHash == NULL ) + if( ! hb_curl->pHash ) hb_curl->pHash = hb_hashTableCreate( HB_CURL_HASH_TABLE_SIZE, hb_curl_HashKey, hb_curl_HashDel, hb_curl_HashCmp ); szHash = ( char * ) hb_hashTableFind( hb_curl->pHash, ( void * ) szValue ); - if( !szHash ) + if( ! szHash ) { szHash = hb_strdup( szValue ); hb_hashTableAdd( hb_curl->pHash, ( void * ) szHash, ( void * ) szHash ); diff --git a/harbour/contrib/hbfimage/fi_winfu.c b/harbour/contrib/hbfimage/fi_winfu.c index ae2d51ae10..5cb2c94031 100644 --- a/harbour/contrib/hbfimage/fi_winfu.c +++ b/harbour/contrib/hbfimage/fi_winfu.c @@ -81,9 +81,9 @@ /* implementation: HBITMAP bitmap = FI_FiToBitmap( FIBITMAP *dib ); */ HB_FUNC( FI_FITOBITMAP ) { - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; HBITMAP bitmap; @@ -100,11 +100,8 @@ HB_FUNC( FI_FITOBITMAP ) ReleaseDC( NULL, hDC ); /* return value */ - if ( bitmap != NULL ) - { + if( bitmap ) hb_retptr( bitmap ); - } - } else { @@ -127,9 +124,9 @@ HB_FUNC( FI_FITOBITMAP ) /* implementation: FIBITMAP *dib = FI_BitmapToFi( HBITMAP bitmap ); */ HB_FUNC( FI_BITMAPTOFI ) { - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; HBITMAP bitmap; @@ -153,11 +150,8 @@ HB_FUNC( FI_BITMAPTOFI ) } /* return value */ - if ( dib != NULL ) - { + if( dib ) hb_retptr( dib ); - } - } else { @@ -180,14 +174,14 @@ HB_FUNC( FI_BITMAPTOFI ) /* implementation: int scanlines = FI_WinDraw( FIBITMAP *dib, HDC hDC, nTop, nLeft, nBottom, nRight ); */ HB_FUNC( FI_WINDRAW ) { - if ( hb_pcount() == 6 && - hb_parinfo( 1 ) & HB_IT_POINTER && - hb_parinfo( 2 ) & HB_IT_NUMERIC && - hb_parinfo( 3 ) & HB_IT_NUMERIC && - hb_parinfo( 4 ) & HB_IT_NUMERIC && - hb_parinfo( 5 ) & HB_IT_NUMERIC && - hb_parinfo( 6 ) & HB_IT_NUMERIC - ) + if( hb_pcount() == 6 && + hb_parinfo( 1 ) & HB_IT_POINTER && + hb_parinfo( 2 ) & HB_IT_NUMERIC && + hb_parinfo( 3 ) & HB_IT_NUMERIC && + hb_parinfo( 4 ) & HB_IT_NUMERIC && + hb_parinfo( 5 ) & HB_IT_NUMERIC && + hb_parinfo( 6 ) & HB_IT_NUMERIC + ) { FIBITMAP *dib; HDC hDC; diff --git a/harbour/contrib/hbfimage/fi_wrp.c b/harbour/contrib/hbfimage/fi_wrp.c index 491eacd9fe..1159683049 100644 --- a/harbour/contrib/hbfimage/fi_wrp.c +++ b/harbour/contrib/hbfimage/fi_wrp.c @@ -144,7 +144,7 @@ void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) const char *format; PHB_SYMB pSymbol; - if ( pErrorHandler == NULL ) + if( ! pErrorHandler ) { /* Do nothing */ return; @@ -154,7 +154,7 @@ void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) /*TraceLog( NULL, "ErrorHandle %p\n\r", pErrorHandler );*/ - if( pSymbol == NULL ) + if( ! pSymbol ) { hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, "FreeImageErrorHandler", 1, hb_paramError( 1 ) ); return; @@ -178,14 +178,14 @@ HB_FUNC( FI_SETOUTPUTMESSAGE ) /* TraceLog( NULL, "PCount = %i\n\r", hb_pcount() ); */ - if ( hb_pcount() == 1 ) + if( hb_pcount() == 1 ) { - if ( hb_parinfo( 1 ) & HB_IT_POINTER ) + if( hb_parinfo( 1 ) & HB_IT_POINTER ) { /* Set the pointer */ pErrorHandler = hb_parptr( 1 ); } - else if ( ISNIL( 1 ) ) + else if( ISNIL( 1 ) ) { /* do nothing */ } @@ -210,11 +210,11 @@ HB_FUNC( FI_SETOUTPUTMESSAGE ) /* DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Allocate(int width, int height, int bpp, unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0)); */ HB_FUNC( FI_ALLOCATE ) { - if ( hb_pcount() >= 3 && - hb_parinfo( 1 ) & HB_IT_NUMERIC && - hb_parinfo( 2 ) & HB_IT_NUMERIC && - hb_parinfo( 3 ) & HB_IT_NUMERIC - ) + if( hb_pcount() >= 3 && + hb_parinfo( 1 ) & HB_IT_NUMERIC && + hb_parinfo( 2 ) & HB_IT_NUMERIC && + hb_parinfo( 3 ) & HB_IT_NUMERIC + ) { int width, height, bpp; UINT red_mask, green_mask, blue_mask; @@ -229,7 +229,6 @@ HB_FUNC( FI_ALLOCATE ) /* run function & return value */ hb_retptr( FreeImage_Allocate(width, height, bpp, red_mask, green_mask, blue_mask) ); - } else { @@ -249,11 +248,11 @@ HB_FUNC( FI_ALLOCATE ) /* DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateT(FREE_IMAGE_TYPE type, int width, int height, int bpp FI_DEFAULT(8), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0)); */ HB_FUNC( FI_ALLOCATET ) { - if ( hb_pcount() >= 3 && - hb_parinfo( 1 ) & HB_IT_NUMERIC && - hb_parinfo( 2 ) & HB_IT_NUMERIC && - hb_parinfo( 3 ) & HB_IT_NUMERIC - ) + if( hb_pcount() >= 3 && + hb_parinfo( 1 ) & HB_IT_NUMERIC && + hb_parinfo( 2 ) & HB_IT_NUMERIC && + hb_parinfo( 3 ) & HB_IT_NUMERIC + ) { FREE_IMAGE_TYPE type; int width, height, bpp; @@ -270,7 +269,6 @@ HB_FUNC( FI_ALLOCATET ) /* run function & return value */ hb_retptr( FreeImage_AllocateT(type, width, height, bpp, red_mask, green_mask, blue_mask) ); - } else { @@ -290,9 +288,9 @@ HB_FUNC( FI_ALLOCATET ) /* DLL_API FIBITMAP * DLL_CALLCONV FreeImage_Clone(FIBITMAP *dib); */ HB_FUNC( FI_CLONE ) { - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; FIBITMAP *fiClonePtr; @@ -304,11 +302,8 @@ HB_FUNC( FI_CLONE ) fiClonePtr = FreeImage_Clone( dib ); /* return value */ - if ( fiClonePtr != NULL ) - { + if( fiClonePtr ) hb_retptr( fiClonePtr ); - } - } else { @@ -327,9 +322,9 @@ HB_FUNC( FI_CLONE ) /* DLL_API void DLL_CALLCONV FreeImage_Unload(FIBITMAP *dib); */ HB_FUNC( FI_UNLOAD ) { - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; @@ -340,7 +335,6 @@ HB_FUNC( FI_UNLOAD ) FreeImage_Unload( dib ); /* return value */ - } else { @@ -363,11 +357,11 @@ HB_FUNC( FI_UNLOAD ) /* DLL_API void DLL_CALLCONV FreeImage_CloseMemory(FIMEMORY *stream); */ HB_FUNC( FI_LOADFROMMEM ) { - if ( hb_pcount() == 3 && - hb_parinfo( 1 ) & HB_IT_NUMERIC && - hb_parinfo( 2 ) & HB_IT_STRING && - hb_parinfo( 3 ) & HB_IT_NUMERIC - ) + if( hb_pcount() == 3 && + hb_parinfo( 1 ) & HB_IT_NUMERIC && + hb_parinfo( 2 ) & HB_IT_STRING && + hb_parinfo( 3 ) & HB_IT_NUMERIC + ) { FIBITMAP *dib; FREE_IMAGE_FORMAT fif; @@ -386,11 +380,8 @@ HB_FUNC( FI_LOADFROMMEM ) FreeImage_CloseMemory( stream ); /* return value */ - if ( dib != NULL ) - { + if( dib ) hb_retptr( dib ); - } - } else { @@ -407,11 +398,11 @@ HB_FUNC( FI_LOADFROMMEM ) /* DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Load(FREE_IMAGE_FORMAT fif, const char *filename, int flags FI_DEFAULT(0)); */ HB_FUNC( FI_LOAD ) { - if ( hb_pcount() == 3 && - hb_parinfo( 1 ) & HB_IT_NUMERIC && - hb_parinfo( 2 ) & HB_IT_STRING && - hb_parinfo( 3 ) & HB_IT_NUMERIC - ) + if( hb_pcount() == 3 && + hb_parinfo( 1 ) & HB_IT_NUMERIC && + hb_parinfo( 2 ) & HB_IT_STRING && + hb_parinfo( 3 ) & HB_IT_NUMERIC + ) { FIBITMAP *dib; FREE_IMAGE_FORMAT fif; @@ -427,11 +418,8 @@ HB_FUNC( FI_LOAD ) dib = FreeImage_Load(fif, filename, flags); /* return value */ - if ( dib != NULL ) - { + if( dib ) hb_retptr( dib ); - } - } else { @@ -455,12 +443,12 @@ HB_FUNC( FI_LOAD ) /* DLL_API BOOL DLL_CALLCONV FreeImage_Save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const char *filename, int flags FI_DEFAULT(0)); */ HB_FUNC( FI_SAVE ) { - if ( hb_pcount() == 4 && - hb_parinfo( 1 ) & HB_IT_NUMERIC && - hb_parinfo( 2 ) & HB_IT_POINTER && - hb_parinfo( 3 ) & HB_IT_STRING && - hb_parinfo( 4 ) & HB_IT_NUMERIC - ) + if( hb_pcount() == 4 && + hb_parinfo( 1 ) & HB_IT_NUMERIC && + hb_parinfo( 2 ) & HB_IT_POINTER && + hb_parinfo( 3 ) & HB_IT_STRING && + hb_parinfo( 4 ) & HB_IT_NUMERIC + ) { FREE_IMAGE_FORMAT fif; FIBITMAP *dib; @@ -475,7 +463,6 @@ HB_FUNC( FI_SAVE ) /* run function & return value */ hb_retl( FreeImage_Save(fif, dib, filename, flags) ); - } else { @@ -541,12 +528,12 @@ DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif /* DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmap(FREE_IMAGE_FORMAT fif, const char *filename, BOOL create_new, BOOL read_only, BOOL keep_cache_in_memory FI_DEFAULT(FALSE), int flags FI_DEFAULT(0)); */ HB_FUNC( FI_OPENMULTIBITMAP ) { - if ( hb_pcount() >= 4 && - hb_parinfo( 1 ) & HB_IT_NUMERIC && - hb_parinfo( 2 ) & HB_IT_STRING && - hb_parinfo( 3 ) & HB_IT_LOGICAL && - hb_parinfo( 4 ) & HB_IT_LOGICAL - ) + if( hb_pcount() >= 4 && + hb_parinfo( 1 ) & HB_IT_NUMERIC && + hb_parinfo( 2 ) & HB_IT_STRING && + hb_parinfo( 3 ) & HB_IT_LOGICAL && + hb_parinfo( 4 ) & HB_IT_LOGICAL + ) { FIMULTIBITMAP *dib; FREE_IMAGE_FORMAT fif; @@ -568,11 +555,8 @@ HB_FUNC( FI_OPENMULTIBITMAP ) dib = FreeImage_OpenMultiBitmap(fif, filename, create_new, read_only, keep_cache_in_memory, flags); /* return value */ - if ( dib != NULL ) - { + if( dib ) hb_retptr( dib ); - } - } else { @@ -591,9 +575,9 @@ HB_FUNC( FI_OPENMULTIBITMAP ) /* DLL_API BOOL DLL_CALLCONV FreeImage_CloseMultiBitmap(FIMULTIBITMAP *bitmap, int flags FI_DEFAULT(0)); */ HB_FUNC( FI_CLOSEMULTIBITMAP ) { - if ( hb_pcount() >= 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() >= 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIMULTIBITMAP *bitmap; int flags; @@ -604,7 +588,6 @@ HB_FUNC( FI_CLOSEMULTIBITMAP ) /* run function & return value */ hb_retl( FreeImage_CloseMultiBitmap(bitmap, flags) ); - } else { @@ -623,9 +606,9 @@ HB_FUNC( FI_CLOSEMULTIBITMAP ) /* DLL_API int DLL_CALLCONV FreeImage_GetPageCount(FIMULTIBITMAP *bitmap); */ HB_FUNC( FI_GETPAGECOUNT ) { - if ( hb_pcount() >= 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() >= 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIMULTIBITMAP *bitmap; @@ -653,10 +636,10 @@ HB_FUNC( FI_GETPAGECOUNT ) /* DLL_API void DLL_CALLCONV FreeImage_AppendPage(FIMULTIBITMAP *bitmap, FIBITMAP *data); */ HB_FUNC( FI_APPENDPAGE ) { - if ( hb_pcount() == 2 && - hb_parinfo( 1 ) & HB_IT_POINTER && - hb_parinfo( 2 ) & HB_IT_POINTER - ) + if( hb_pcount() == 2 && + hb_parinfo( 1 ) & HB_IT_POINTER && + hb_parinfo( 2 ) & HB_IT_POINTER + ) { FIMULTIBITMAP *bitmap; FIBITMAP *data; @@ -667,7 +650,6 @@ HB_FUNC( FI_APPENDPAGE ) /* run function & return value */ FreeImage_AppendPage(bitmap, data); - } else { @@ -686,11 +668,11 @@ HB_FUNC( FI_APPENDPAGE ) /* DLL_API void DLL_CALLCONV FreeImage_InsertPage(FIMULTIBITMAP *bitmap, int page, FIBITMAP *data); */ HB_FUNC( FI_INSERTPAGE ) { - if ( hb_pcount() == 3 && - hb_parinfo( 1 ) & HB_IT_POINTER && - hb_parinfo( 2 ) & HB_IT_NUMERIC && - hb_parinfo( 3 ) & HB_IT_POINTER - ) + if( hb_pcount() == 3 && + hb_parinfo( 1 ) & HB_IT_POINTER && + hb_parinfo( 2 ) & HB_IT_NUMERIC && + hb_parinfo( 3 ) & HB_IT_POINTER + ) { FIMULTIBITMAP *bitmap; int page; @@ -703,7 +685,6 @@ HB_FUNC( FI_INSERTPAGE ) /* run function & return value */ FreeImage_InsertPage(bitmap, page, data); - } else { @@ -722,10 +703,10 @@ HB_FUNC( FI_INSERTPAGE ) /* DLL_API void DLL_CALLCONV FreeImage_DeletePage(FIMULTIBITMAP *bitmap, int page); */ HB_FUNC( FI_DELETEPAGE ) { - if ( hb_pcount() == 2 && - hb_parinfo( 1 ) & HB_IT_POINTER && - hb_parinfo( 2 ) & HB_IT_NUMERIC - ) + if( hb_pcount() == 2 && + hb_parinfo( 1 ) & HB_IT_POINTER && + hb_parinfo( 2 ) & HB_IT_NUMERIC + ) { FIMULTIBITMAP *bitmap; int page; @@ -736,7 +717,6 @@ HB_FUNC( FI_DELETEPAGE ) /* run function & return value */ FreeImage_DeletePage(bitmap, page); - } else { @@ -755,10 +735,10 @@ HB_FUNC( FI_DELETEPAGE ) /* DLL_API FIBITMAP * DLL_CALLCONV FreeImage_LockPage(FIMULTIBITMAP *bitmap, int page); */ HB_FUNC( FI_LOCKPAGE ) { - if ( hb_pcount() == 2 && - hb_parinfo( 1 ) & HB_IT_POINTER && - hb_parinfo( 2 ) & HB_IT_NUMERIC - ) + if( hb_pcount() == 2 && + hb_parinfo( 1 ) & HB_IT_POINTER && + hb_parinfo( 2 ) & HB_IT_NUMERIC + ) { FIMULTIBITMAP *bitmap; int page; @@ -769,7 +749,6 @@ HB_FUNC( FI_LOCKPAGE ) /* run function & return value */ hb_retptr( FreeImage_LockPage(bitmap, page) ); - } else { @@ -788,11 +767,11 @@ HB_FUNC( FI_LOCKPAGE ) /* DLL_API void DLL_CALLCONV FreeImage_UnlockPage(FIMULTIBITMAP *bitmap, FIBITMAP *page, BOOL changed); */ HB_FUNC( FI_UNLOCKPAGE ) { - if ( hb_pcount() == 3 && - hb_parinfo( 1 ) & HB_IT_POINTER && - hb_parinfo( 2 ) & HB_IT_NUMERIC && - hb_parinfo( 3 ) & HB_IT_LOGICAL - ) + if( hb_pcount() == 3 && + hb_parinfo( 1 ) & HB_IT_POINTER && + hb_parinfo( 2 ) & HB_IT_NUMERIC && + hb_parinfo( 3 ) & HB_IT_LOGICAL + ) { FIMULTIBITMAP *bitmap; FIBITMAP *page; @@ -824,11 +803,11 @@ HB_FUNC( FI_UNLOCKPAGE ) /* DLL_API BOOL DLL_CALLCONV FreeImage_MovePage(FIMULTIBITMAP *bitmap, int target, int source); */ HB_FUNC( FI_MOVEPAGE ) { - if ( hb_pcount() == 3 && - hb_parinfo( 1 ) & HB_IT_POINTER && - hb_parinfo( 2 ) & HB_IT_NUMERIC && - hb_parinfo( 3 ) & HB_IT_NUMERIC - ) + if( hb_pcount() == 3 && + hb_parinfo( 1 ) & HB_IT_POINTER && + hb_parinfo( 2 ) & HB_IT_NUMERIC && + hb_parinfo( 3 ) & HB_IT_NUMERIC + ) { FIMULTIBITMAP *bitmap; int target, source; @@ -867,9 +846,9 @@ HB_FUNC( FI_MOVEPAGE ) /* DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileType(const char *filename, int size FI_DEFAULT(0)); */ HB_FUNC( FI_GETFILETYPE ) { - if ( hb_pcount() >= 1 && - hb_parinfo( 1 ) & HB_IT_STRING - ) + if( hb_pcount() >= 1 && + hb_parinfo( 1 ) & HB_IT_STRING + ) { const char *filename; int size; @@ -901,9 +880,9 @@ HB_FUNC( FI_GETFILETYPE ) /* DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromMemory(FIMEMORY *stream, int size FI_DEFAULT(0)); */ HB_FUNC( FI_GETFILETYPEFROMMEM ) { - if ( hb_pcount() >= 1 && - hb_parinfo( 1 ) & HB_IT_STRING - ) + if( hb_pcount() >= 1 && + hb_parinfo( 1 ) & HB_IT_STRING + ) { BYTE * szImage; FIMEMORY *stream; @@ -938,9 +917,9 @@ HB_FUNC( FI_GETFILETYPEFROMMEM ) /* DLL_API FREE_IMAGE_TYPE DLL_CALLCONV FreeImage_GetImageType(FIBITMAP *dib); */ HB_FUNC( FI_GETIMAGETYPE ) { - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; @@ -987,9 +966,9 @@ HB_FUNC( FI_ISLITTLEENDIAN ) /* DLL_API BYTE *DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib); */ HB_FUNC( FI_GETBITS ) { - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; @@ -998,7 +977,6 @@ HB_FUNC( FI_GETBITS ) /* run function & return value */ hb_retptr( FreeImage_GetBits(dib) ); - } else { @@ -1017,10 +995,10 @@ HB_FUNC( FI_GETBITS ) /* DLL_API BYTE *DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline); */ HB_FUNC( FI_GETSCANLINE ) { - if ( hb_pcount() == 2 && - hb_parinfo( 1 ) & HB_IT_POINTER && - hb_parinfo( 2 ) & HB_IT_NUMERIC - ) + if( hb_pcount() == 2 && + hb_parinfo( 1 ) & HB_IT_POINTER && + hb_parinfo( 2 ) & HB_IT_NUMERIC + ) { FIBITMAP *dib; int scanline; @@ -1031,7 +1009,6 @@ HB_FUNC( FI_GETSCANLINE ) /* run function & return value */ hb_retptr( FreeImage_GetScanLine(dib, scanline) ); - } else { @@ -1061,9 +1038,9 @@ DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, uns /* DLL_API unsigned DLL_CALLCONV FreeImage_GetColorsUsed(FIBITMAP *dib); */ HB_FUNC( FI_GETCOLORSUSED ) { - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; @@ -1091,9 +1068,9 @@ HB_FUNC( FI_GETCOLORSUSED ) /* DLL_API unsigned DLL_CALLCONV FreeImage_GetBPP(FIBITMAP *dib); */ HB_FUNC( FI_GETBPP ) { - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; @@ -1121,9 +1098,9 @@ HB_FUNC( FI_GETBPP ) /* DLL_API unsigned DLL_CALLCONV FreeImage_GetWidth(FIBITMAP *dib); */ HB_FUNC( FI_GETWIDTH ) { - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; @@ -1151,9 +1128,9 @@ HB_FUNC( FI_GETWIDTH ) /* DLL_API unsigned DLL_CALLCONV FreeImage_GetHeight(FIBITMAP *dib); */ HB_FUNC( FI_GETHEIGHT ) { - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; @@ -1181,9 +1158,9 @@ HB_FUNC( FI_GETHEIGHT ) /* DLL_API unsigned DLL_CALLCONV FreeImage_GetLine(FIBITMAP *dib); */ HB_FUNC( FI_GETLINE ) { - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; @@ -1211,9 +1188,9 @@ HB_FUNC( FI_GETLINE ) /* DLL_API unsigned DLL_CALLCONV FreeImage_GetPitch(FIBITMAP *dib); */ HB_FUNC( FI_GETPITCH ) { - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; @@ -1241,9 +1218,9 @@ HB_FUNC( FI_GETPITCH ) /* DLL_API unsigned DLL_CALLCONV FreeImage_GetDIBSize(FIBITMAP *dib); */ HB_FUNC( FI_GETDIBSIZE ) { - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; @@ -1271,9 +1248,9 @@ HB_FUNC( FI_GETDIBSIZE ) /* DLL_API RGBQUAD *DLL_CALLCONV FreeImage_GetPalette(FIBITMAP *dib); */ HB_FUNC( FI_GETPALETTE ) { - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; @@ -1282,7 +1259,6 @@ HB_FUNC( FI_GETPALETTE ) /* run function & return value */ hb_retptr( FreeImage_GetPalette(dib) ); - } else { @@ -1301,9 +1277,9 @@ HB_FUNC( FI_GETPALETTE ) /* DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterX(FIBITMAP *dib); */ HB_FUNC( FI_GETDOTSPERMETERX ) { - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; @@ -1331,9 +1307,9 @@ HB_FUNC( FI_GETDOTSPERMETERX ) /* DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterY(FIBITMAP *dib); */ HB_FUNC( FI_GETDOTSPERMETERY ) { - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; @@ -1361,10 +1337,10 @@ HB_FUNC( FI_GETDOTSPERMETERY ) /* DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterX(FIBITMAP *dib, unsigned res); */ HB_FUNC( FI_SETDOTSPERMETERX ) { - if ( hb_pcount() == 2 && - hb_parinfo( 1 ) & HB_IT_POINTER && - hb_parinfo( 2 ) & HB_IT_NUMERIC - ) + if( hb_pcount() == 2 && + hb_parinfo( 1 ) & HB_IT_POINTER && + hb_parinfo( 2 ) & HB_IT_NUMERIC + ) { FIBITMAP *dib; UINT res; @@ -1394,10 +1370,10 @@ HB_FUNC( FI_SETDOTSPERMETERX ) /* DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterY(FIBITMAP *dib, unsigned res); */ HB_FUNC( FI_SETDOTSPERMETERY ) { - if ( hb_pcount() == 2 && - hb_parinfo( 1 ) & HB_IT_POINTER && - hb_parinfo( 2 ) & HB_IT_NUMERIC - ) + if( hb_pcount() == 2 && + hb_parinfo( 1 ) & HB_IT_POINTER && + hb_parinfo( 2 ) & HB_IT_NUMERIC + ) { FIBITMAP *dib; UINT res; @@ -1427,10 +1403,9 @@ HB_FUNC( FI_SETDOTSPERMETERY ) /* DLL_API BITMAPINFOHEADER *DLL_CALLCONV FreeImage_GetInfoHeader(FIBITMAP *dib); */ HB_FUNC( FI_GETINFOHEADER ) { - - if ( hb_pcount() == 1 && - hb_parinfo( 1 ) & HB_IT_POINTER - ) + if( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_POINTER + ) { FIBITMAP *dib; /* We need not worry about Memory Management - will be automatically released! */ @@ -1445,7 +1420,6 @@ HB_FUNC( FI_GETINFOHEADER ) /*hb_retclenAdoptRaw( (char *) bmpinfoheader, sizeof( BITMAPINFOHEADER ) );*/ hb_retptr( bmpinfoheader ); - } else { @@ -1479,7 +1453,6 @@ HB_FUNC( FI_GETINFO ) bmpinfo = FreeImage_GetInfo(dib); hb_retptr( bmpinfo ); - } else { @@ -1659,7 +1632,6 @@ HB_FUNC( FI_GETTRANSPARENCYTABLE ) /* run function & return value */ hb_retptr( FreeImage_GetTransparencyTable(dib) ); - } else { @@ -1862,7 +1834,6 @@ HB_FUNC( FI_SETBACKGROUNDCOLOR ) hb_retl( FreeImage_SetBackgroundColor(dib, bkcolor) ); /*FreeImage_GetBackgroundColor(dib, bkcolor);*/ /*hb_retptr( bkcolor );*/ - } else { @@ -1899,7 +1870,6 @@ HB_FUNC( FI_GETICCPROFILE ) /* run function & return value */ hb_retptr( FreeImage_GetICCProfile(dib) ); - } else { @@ -1936,7 +1906,6 @@ HB_FUNC( FI_CREATEICCPROFILE ) /* run function & return value */ hb_retptr( FreeImage_CreateICCProfile(dib, data, size) ); - } else { @@ -2043,7 +2012,6 @@ HB_FUNC( FI_CONVERTTO4BITS ) /* run function & return value */ hb_retptr( FreeImage_ConvertTo4Bits(dib) ); - } else { @@ -2074,7 +2042,6 @@ HB_FUNC( FI_CONVERTTO8BITS ) /* run function & return value */ hb_retptr( FreeImage_ConvertTo8Bits(dib) ); - } else { @@ -2105,7 +2072,6 @@ HB_FUNC( FI_CONVERTTOGREYSCALE ) /* run function & return value */ hb_retptr( FreeImage_ConvertToGreyscale(dib) ); - } else { @@ -2136,7 +2102,6 @@ HB_FUNC( FI_CONVERTTO16BITS555 ) /* run function & return value */ hb_retptr( FreeImage_ConvertTo16Bits555(dib) ); - } else { @@ -2167,7 +2132,6 @@ HB_FUNC( FI_CONVERTTO16BITS565 ) /* run function & return value */ hb_retptr( FreeImage_ConvertTo16Bits565(dib) ); - } else { @@ -2198,7 +2162,6 @@ HB_FUNC( FI_CONVERTTO24BITS ) /* run function & return value */ hb_retptr( FreeImage_ConvertTo24Bits(dib) ); - } else { @@ -2229,7 +2192,6 @@ HB_FUNC( FI_CONVERTTO32BITS ) /* run function & return value */ hb_retptr( FreeImage_ConvertTo32Bits(dib) ); - } else { @@ -2263,7 +2225,6 @@ HB_FUNC( FI_COLORQUANTIZE ) /* run function & return value */ hb_retptr( FreeImage_ColorQuantize(dib, quantize) ); - } else { @@ -2302,7 +2263,6 @@ HB_FUNC( FI_DITHER ) /* run function & return value */ hb_retptr( FreeImage_Dither(dib, algorithm) ); - } else { @@ -2338,7 +2298,6 @@ HB_FUNC( FI_CONVERTTORGBF ) /* run function & return value */ hb_retptr( FreeImage_ConvertToRGBF(dib) ); - } else { @@ -2371,7 +2330,6 @@ HB_FUNC( FI_CONVERTTOSTANDARDTYPE ) /* run function & return value */ hb_retptr( FreeImage_ConvertToStandardType(dib, scale_linear) ); - } else { @@ -2407,7 +2365,6 @@ HB_FUNC( FI_CONVERTTOTYPE ) /* run function & return value */ hb_retptr( FreeImage_ConvertToType(dib, dst_type, scale_linear) ); - } else { @@ -2505,7 +2462,6 @@ HB_FUNC( FI_ROTATECLASSIC ) /* run function & return value */ hb_retptr( FreeImage_RotateClassic(dib, angle) ); - } else { @@ -2549,7 +2505,6 @@ HB_FUNC( FI_ROTATEEX ) /* run function & return value */ hb_retptr( FreeImage_RotateEx(dib, angle, x_shift, y_shift, x_origin, y_origin, use_mask) ); - } else { @@ -2657,7 +2612,6 @@ HB_FUNC( FI_RESCALE ) /* run function & return value */ hb_retptr( FreeImage_Rescale(dib, dst_width, dst_height, filter) ); - } else { @@ -2840,7 +2794,6 @@ HB_FUNC( FI_GETCHANNEL ) /* run function & return value */ hb_retptr( FreeImage_GetChannel(dib, channel) ); - } else { @@ -2888,7 +2841,6 @@ HB_FUNC( FI_COPY ) /* run function & return value */ hb_retptr( FreeImage_Copy(dib, left, top, right, bottom) ); - } else { diff --git a/harbour/contrib/hbw32/dllcall.c b/harbour/contrib/hbw32/dllcall.c index 68a8d1803a..9e32a5e8e5 100644 --- a/harbour/contrib/hbw32/dllcall.c +++ b/harbour/contrib/hbw32/dllcall.c @@ -73,7 +73,11 @@ #include "hbstack.h" #include "hbapicls.h" -static PHB_DYNS pHB_CSTRUCTURE = NULL, pPOINTER, pVALUE, pBUFFER, pDEVALUE; +static PHB_DYNS s_pHB_CSTRUCTURE = NULL; +static PHB_DYNS s_pPOINTER; +static PHB_DYNS s_pVALUE; +static PHB_DYNS s_pBUFFER; +static PHB_DYNS s_pDEVALUE; HB_EXTERN_BEGIN HB_EXPORT char * hb_parcstruct( int iParam, ... ); @@ -85,14 +89,14 @@ HB_EXPORT char * hb_parcstruct( int iParam, ... ) HB_TRACE(HB_TR_DEBUG, ("hb_parcstruct(%d, ...)", iParam)); - if( pHB_CSTRUCTURE == NULL ) + if( s_pHB_CSTRUCTURE == NULL ) { - pHB_CSTRUCTURE = hb_dynsymFind( "HB_CSTRUCTURE" ); + s_pHB_CSTRUCTURE = hb_dynsymFind( "HB_CSTRUCTURE" ); - pPOINTER = hb_dynsymGetCase( "POINTER" ); - pVALUE = hb_dynsymGetCase( "VALUE" ); - pBUFFER = hb_dynsymGetCase( "BUFFER" ); - pDEVALUE = hb_dynsymGetCase( "DEVALUE" ); + s_pPOINTER = hb_dynsymGetCase( "POINTER" ); + s_pVALUE = hb_dynsymGetCase( "VALUE" ); + s_pBUFFER = hb_dynsymGetCase( "BUFFER" ); + s_pDEVALUE = hb_dynsymGetCase( "DEVALUE" ); } if( ( iParam >= 0 && iParam <= hb_pcount() ) || ( iParam == -1 ) ) @@ -121,7 +125,7 @@ HB_EXPORT char * hb_parcstruct( int iParam, ... ) if( strncmp( hb_objGetClsName( pItem ), "C Structure", 11 ) == 0 ) { - hb_vmPushDynSym( pVALUE ); + hb_vmPushDynSym( s_pVALUE ); hb_vmPush( pItem ); hb_vmSend( 0 ); @@ -621,7 +625,7 @@ static void DllExec( int iFlags, int iRtype, LPVOID lpFunction, PXPP_DLLEXEC xec case HB_IT_ARRAY: if( strncmp( hb_objGetClsName( hb_param( i, HB_IT_ANY ) ), "C Structure", 11 ) == 0 ) { - hb_vmPushDynSym( pDEVALUE ); + hb_vmPushDynSym( s_pDEVALUE ); hb_vmPush( hb_param( i, HB_IT_ANY ) ); hb_vmSend( 0 ); diff --git a/harbour/contrib/hbziparc/hbziparc.prg b/harbour/contrib/hbziparc/hbziparc.prg index f78e877b39..1f4ffe2969 100644 --- a/harbour/contrib/hbziparc/hbziparc.prg +++ b/harbour/contrib/hbziparc/hbziparc.prg @@ -62,7 +62,7 @@ STATIC s_cComment STATIC s_lReadOnly := .F. STATIC s_bProgress -PROCEDURE hb_SetZipReadOnly( lReadOnly ) +PROCEDURE SetZipReadOnly( lReadOnly ) DEFAULT lReadOnly TO .F. diff --git a/harbour/source/compiler/genc.c b/harbour/source/compiler/genc.c index a96adc1a94..1d594304f4 100644 --- a/harbour/source/compiler/genc.c +++ b/harbour/source/compiler/genc.c @@ -90,7 +90,7 @@ void hb_compGenCCode( HB_COMP_DECL, PHB_FNAME pFileName ) /* generates the fprintf( yyc, "/*\n * %s\n", szHrb ); fprintf( yyc, " * %s\n", szCmp ); - fprintf( yyc, " * Generated C source from \"%s\"\n */\n", HB_COMP_PARAM->szFile ); + fprintf( yyc, " * Generated C source from \"%s\"\n */\n\n", HB_COMP_PARAM->szFile ); hb_xfree( szCmp ); hb_xfree( szHrb ); diff --git a/harbour/source/rtl/fkmax.c b/harbour/source/rtl/fkmax.c index 5976f0d4d5..aff8f0d185 100644 --- a/harbour/source/rtl/fkmax.c +++ b/harbour/source/rtl/fkmax.c @@ -66,7 +66,7 @@ HB_FUNC( FKLABEL ) { PHB_ITEM pPar1 = hb_param( 1, HB_IT_NUMERIC ); - if( pPar1 != NULL ) + if( pPar1 ) { USHORT uiFKey = hb_itemGetNI( pPar1 ); @@ -79,5 +79,6 @@ HB_FUNC( FKLABEL ) return; } } - hb_retc( NULL ); + + hb_retc_null(); } diff --git a/harbour/source/rtl/fstemp.c b/harbour/source/rtl/fstemp.c index 57826c2ba7..d573dfd0d3 100644 --- a/harbour/source/rtl/fstemp.c +++ b/harbour/source/rtl/fstemp.c @@ -73,7 +73,7 @@ static BOOL hb_fsTempName( BYTE * pszBuffer, const BYTE * pszDir, const BYTE * p char cTempDir[ _POSIX_PATH_MAX + 1 ]; - if( pszDir != NULL && pszDir[ 0 ] != '\0' ) + if( pszDir && pszDir[ 0 ] != '\0' ) { hb_strncpy( ( char * ) cTempDir, ( const char * ) pszDir, sizeof( cTempDir ) - 1 ); } @@ -87,7 +87,7 @@ static BOOL hb_fsTempName( BYTE * pszBuffer, const BYTE * pszDir, const BYTE * p } cTempDir[ _POSIX_PATH_MAX ] = '\0'; - fResult = GetTempFileNameA( ( LPCSTR ) cTempDir, ( ( pszPrefix == NULL ) ? ( LPCSTR ) "hb" : ( LPCSTR ) pszPrefix ), 0, ( LPSTR ) pszBuffer ); + fResult = GetTempFileNameA( ( LPCSTR ) cTempDir, pszPrefix ? ( LPCSTR ) pszPrefix : ( LPCSTR ) "hb", 0, ( LPSTR ) pszBuffer ); #else @@ -124,9 +124,7 @@ HB_EXPORT HB_FHANDLE hb_fsCreateTemp( const BYTE * pszDir, const BYTE * pszPrefi used between generation and the file creation. */ if( fhnd != FS_ERROR ) - { return fhnd; - } } else { @@ -146,7 +144,7 @@ static BOOL fsGetTempDirByCase( BYTE *pszName, const char *pszTempDir ) { BOOL fOK = FALSE; - if( pszTempDir != NULL && *pszTempDir != '\0' ) + if( pszTempDir && *pszTempDir != '\0' ) { hb_strncpy( ( char * ) pszName, ( char * ) pszTempDir, _POSIX_PATH_MAX ); if( hb_set.HB_SET_DIRCASE == HB_SET_CASE_LOWER ) @@ -176,7 +174,7 @@ HB_EXPORT HB_FHANDLE hb_fsCreateTemp( const BYTE * pszDir, const BYTE * pszPrefi { pszName[ 0 ] = '\0'; - if( pszDir != NULL && pszDir[ 0 ] != '\0' ) + if( pszDir && pszDir[ 0 ] != '\0' ) { hb_strncpy( ( char * ) pszName, ( char * ) pszDir, _POSIX_PATH_MAX ); } @@ -206,10 +204,8 @@ HB_EXPORT HB_FHANDLE hb_fsCreateTemp( const BYTE * pszDir, const BYTE * pszPrefi pszName[ len + 1 ] = '\0'; } - if( pszPrefix != NULL ) - { + if( pszPrefix ) hb_strncat( ( char * ) pszName, ( char * ) pszPrefix, _POSIX_PATH_MAX ); - } iLen = ( int ) strlen( ( char * ) pszName ); if( iLen > _POSIX_PATH_MAX - 6 ) diff --git a/harbour/source/rtl/gtclip.c b/harbour/source/rtl/gtclip.c index 1777d9bd48..b80d53a652 100644 --- a/harbour/source/rtl/gtclip.c +++ b/harbour/source/rtl/gtclip.c @@ -146,7 +146,7 @@ BOOL hb_gt_w32_getClipboard( UINT uFormat, char ** pszClipData, ULONG *pulLen ) if( hglb ) { LPTSTR lptstr = ( LPTSTR ) GlobalLock( hglb ); - if( lptstr != NULL ) + if( lptstr ) { switch( uFormat ) { diff --git a/harbour/source/rtl/gtwin/gtwin.c b/harbour/source/rtl/gtwin/gtwin.c index ed5d9a8b25..19d7afbbf4 100644 --- a/harbour/source/rtl/gtwin/gtwin.c +++ b/harbour/source/rtl/gtwin/gtwin.c @@ -462,7 +462,7 @@ static void hb_gt_win_xScreenUpdate( void ) { HB_TRACE(HB_TR_DEBUG, ("hb_gt_win_xScreenUpdate()")); - if( s_pCharInfoScreen != NULL ) + if( s_pCharInfoScreen ) { if( s_uiDispCount == 0 && s_usUpdtTop <= s_usUpdtBottom ) { @@ -587,7 +587,7 @@ static void hb_gt_win_xInitScreenParam( PHB_GT pGT ) if( s_pCharInfoScreen == NULL || ulSize != s_ulScreenBuffSize ) { - if( s_pCharInfoScreen != NULL ) + if( s_pCharInfoScreen ) hb_xfree( s_pCharInfoScreen ); s_ulScreenBuffSize = ulSize; s_pCharInfoScreen = ( CHAR_INFO * ) hb_xgrab( s_ulScreenBuffSize ); @@ -631,7 +631,7 @@ static void hb_gt_win_xInitScreenParam( PHB_GT pGT ) } HB_GTSELF_SETPOS( pGT, s_sCurRow, s_sCurCol ); } - else if( s_pCharInfoScreen != NULL ) + else if( s_pCharInfoScreen ) { hb_xfree( s_pCharInfoScreen ); s_ulScreenBuffSize = 0; @@ -765,7 +765,7 @@ static void hb_gt_win_Exit( PHB_GT pGT ) HB_GTSELF_REFRESH( pGT ); - if( s_pCharInfoScreen != NULL ) + if( s_pCharInfoScreen ) { hb_xfree( s_pCharInfoScreen ); s_pCharInfoScreen = NULL; @@ -1364,7 +1364,7 @@ static int hb_gt_win_ReadKey( PHB_GT pGT, int iEventMask ) clipKey = &extKeyTab[ extKey ]; } - if( clipKey != NULL ) + if( clipKey ) { if( ( dwState & SHIFT_PRESSED ) && ( dwState & ( LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED ) ) ) { @@ -1719,7 +1719,7 @@ static void hb_gt_win_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) { HB_TRACE( HB_TR_DEBUG, ( "hb_gt_win_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); - if( iSize > 0 && s_pCharInfoScreen != NULL && + if( iSize > 0 && s_pCharInfoScreen && iRow < ( int ) _GetScreenHeight() && iCol < ( int ) _GetScreenWidth() ) { BYTE bColor, bAttr; diff --git a/harbour/source/rtl/hbffind.c b/harbour/source/rtl/hbffind.c index 85766f9dd7..a4557a7132 100644 --- a/harbour/source/rtl/hbffind.c +++ b/harbour/source/rtl/hbffind.c @@ -686,7 +686,7 @@ static BOOL hb_fsFindNextLow( PHB_FFIND ffind ) hb_strncpy( info->path, dirname, sizeof( info->path ) - 1 ); } - if( info->dir != NULL && info->pattern[ 0 ] != '\0' ) + if( info->dir && info->pattern[ 0 ] != '\0' ) { while( ( info->entry = readdir( info->dir ) ) != NULL ) { @@ -831,11 +831,11 @@ HB_EXPORT BOOL hb_fsFindNext( PHB_FFIND ffind ) HB_EXPORT void hb_fsFindClose( PHB_FFIND ffind ) { - if( ffind != NULL ) + if( ffind ) { /* Do platform dependant cleanup */ - if( ffind->info != NULL ) + if( ffind->info ) { PHB_FFIND_INFO info = ( PHB_FFIND_INFO ) ffind->info; @@ -870,7 +870,7 @@ HB_EXPORT void hb_fsFindClose( PHB_FFIND ffind ) #elif defined(HB_OS_UNIX) - if( info->dir != NULL ) + if( info->dir ) { closedir( info->dir ); } diff --git a/harbour/source/rtl/hbinet.c b/harbour/source/rtl/hbinet.c index ed3f03fedb..59c4892f5d 100644 --- a/harbour/source/rtl/hbinet.c +++ b/harbour/source/rtl/hbinet.c @@ -362,7 +362,7 @@ static struct hostent * hb_getHosts( char * name, HB_SOCKET_STRUCT *Socket ) Host = gethostbyname( name ); } - if( Host == NULL && Socket != NULL ) + if( Host == NULL && Socket ) { #if defined(HB_OS_WIN_32) HB_SOCKET_SET_ERROR2( Socket, WSAGetLastError() , "Generic error in gethostbyname()" ); @@ -509,7 +509,7 @@ static HB_GARBAGE_FUNC( hb_inetSocketFinalize ) Socket->com = ( HB_SOCKET_T ) -1; } - if( Socket->caPeriodic != NULL ) + if( Socket->caPeriodic ) { hb_itemRelease( Socket->caPeriodic ); Socket->caPeriodic = NULL; @@ -714,7 +714,7 @@ HB_FUNC( HB_INETTIMEOUT ) { HB_SOCKET_STRUCT *Socket = HB_PARSOCKET( 1 ); - if( Socket != NULL ) + if( Socket ) { hb_retni( Socket->timeout ); if( ISNUM( 2 ) ) @@ -934,7 +934,7 @@ static void s_inetRecvInternal( int iMode ) iTimeElapsed += Socket->timeout; /* if we have a caPeriodic, timeLimit is our REAL timeout */ - if( Socket->caPeriodic != NULL ) + if( Socket->caPeriodic ) { hb_execFromArray( Socket->caPeriodic ); @@ -1050,7 +1050,7 @@ static void s_inetRecvPattern( char *szPattern ) { iTimeElapsed += Socket->timeout; - if( Socket->caPeriodic != NULL ) + if( Socket->caPeriodic ) { hb_execFromArray( Socket->caPeriodic ); /* do we continue? */ @@ -1237,7 +1237,7 @@ HB_FUNC( HB_INETRECVENDBLOCK ) else { iTimeElapsed += Socket->timeout; - if( Socket->caPeriodic != NULL ) + if( Socket->caPeriodic ) { hb_execFromArray( Socket->caPeriodic ); @@ -1567,14 +1567,10 @@ HB_FUNC( HB_INETSERVER ) return; } - if( Socket != NULL ) - { + if( Socket ) HB_SOCKET_ZERO_ERROR( Socket ); - } else - { HB_SOCKET_INIT( Socket, pSocket ); - } /* Creates comm socket */ #if defined(HB_OS_WIN_32) @@ -1731,7 +1727,7 @@ HB_FUNC( HB_INETCONNECT ) return; } - if( Socket != NULL ) + if( Socket ) { if( Socket->com != ( HB_SOCKET_T ) -1 ) { @@ -1741,15 +1737,13 @@ HB_FUNC( HB_INETCONNECT ) HB_SOCKET_ZERO_ERROR( Socket ); } else - { HB_SOCKET_INIT( Socket, pSocket ); - } Host = hb_getHosts( szHost, Socket ); /* error had been set by get hosts */ - if( Host != NULL ) + if( Host ) { /* Creates comm socket */ #if defined(HB_OS_WIN_32) @@ -1794,7 +1788,7 @@ HB_FUNC( HB_INETCONNECTIP ) return; } - if( Socket != NULL ) + if( Socket ) { if( Socket->com != ( HB_SOCKET_T ) -1 ) { @@ -2077,7 +2071,7 @@ HB_FUNC( HB_INETDGRAMRECV ) (struct sockaddr *) &Socket->remote, &iDtLen ); } iTimeElapsed += Socket->timeout; - if( Socket->caPeriodic != NULL ) + if( Socket->caPeriodic ) { hb_execFromArray( Socket->caPeriodic ); /* do we continue? */ diff --git a/harbour/source/rtl/hbrandom.c b/harbour/source/rtl/hbrandom.c index 877c91daa9..3a7169b5e1 100644 --- a/harbour/source/rtl/hbrandom.c +++ b/harbour/source/rtl/hbrandom.c @@ -54,8 +54,8 @@ #include "hbdate.h" #include -#ifndef HB_OS_WIN_32 -#include +#if !defined( HB_OS_WIN_32 ) + #include #endif /* Globally available data, no need to MT it */ @@ -139,7 +139,7 @@ double hb_random_num() d1 = ( double ) rand(); d2 = ( double ) RAND_MAX; -#ifdef HB_OS_WIN_32 +#if defined( HB_OS_WIN_32 ) /* It seems that on win32 platform there some weirdness about EPSILON value so that a float division using an epsilon smaller than 1e-10 may be rounded. Must dig if it's a borland lib bug or a windows problem. diff --git a/harbour/source/rtl/is.c b/harbour/source/rtl/is.c index 6be51d5170..6c88f9552c 100644 --- a/harbour/source/rtl/is.c +++ b/harbour/source/rtl/is.c @@ -63,7 +63,7 @@ HB_FUNC( ISALPHA ) { char * szString = hb_parc( 1 ); - if( szString != NULL ) + if( szString ) { if( isalpha( ( unsigned char ) * szString ) ) hb_retl( TRUE ); @@ -86,10 +86,7 @@ HB_FUNC( ISDIGIT ) { char * szString = hb_parc( 1 ); - if( szString != NULL ) - hb_retl( isdigit( ( unsigned char ) * szString ) ); - else - hb_retl( FALSE ); + hb_retl( szString && isdigit( ( unsigned char ) * szString ) ); } /* determines if first char of string is upper-case */ @@ -98,7 +95,7 @@ HB_FUNC( ISUPPER ) { char * szString = hb_parc( 1 ); - if( szString != NULL ) + if( szString ) { if( isupper( ( unsigned char ) * szString ) ) hb_retl( TRUE ); @@ -120,7 +117,7 @@ HB_FUNC( ISLOWER ) { char * szString = hb_parc( 1 ); - if( szString != NULL ) + if( szString ) { if( islower( ( unsigned char ) * szString ) ) hb_retl( TRUE ); diff --git a/harbour/source/rtl/langapi.c b/harbour/source/rtl/langapi.c index e768631d03..1408643adb 100644 --- a/harbour/source/rtl/langapi.c +++ b/harbour/source/rtl/langapi.c @@ -221,11 +221,11 @@ static int hb_langFindPos( char * pszID ) { int iPos; - if( pszID != NULL ) + if( pszID ) { for( iPos = 0; iPos < HB_LANG_MAX_; iPos++ ) { - if( s_langList[ iPos ] != NULL && strcmp( ( char * ) s_langList[ iPos ]->pItemList[ HB_LANG_ITEM_BASE_ID + HB_LANG_ITEM_ID_ID ], pszID ) == 0 ) + if( s_langList[ iPos ] && strcmp( ( char * ) s_langList[ iPos ]->pItemList[ HB_LANG_ITEM_BASE_ID + HB_LANG_ITEM_ID_ID ], pszID ) == 0 ) return iPos; } } diff --git a/harbour/source/rtl/math.c b/harbour/source/rtl/math.c index d77d6743bd..ac630a93a6 100644 --- a/harbour/source/rtl/math.c +++ b/harbour/source/rtl/math.c @@ -164,7 +164,7 @@ HB_EXPORT int matherr( struct exception *err ) s_hb_exc.handled = 0; mathHandler = hb_mathGetHandler(); - if( mathHandler != NULL ) + if( mathHandler ) { retval = ( *( mathHandler ) ) ( &s_hb_exc ); err->retval = s_hb_exc.retval; @@ -248,7 +248,7 @@ BOOL hb_mathGetError( HB_MATH_EXCEPTION * phb_exc, const char *szFunc, { HB_MATH_HANDLERPROC mathHandler = hb_mathGetHandler(); - if( mathHandler != NULL ) + if( mathHandler ) ( *mathHandler )( phb_exc ); } return TRUE; @@ -364,7 +364,7 @@ int hb_matherr( HB_MATH_EXCEPTION * pexc ) pMatherrResult = hb_errLaunchSubst( pError ); hb_errRelease( pError ); - if( pMatherrResult != NULL ) + if( pMatherrResult ) { if( HB_IS_NUMERIC( pMatherrResult ) ) { @@ -452,7 +452,7 @@ static int hb_matherrblock( HB_MATH_EXCEPTION * pexc ) /* call codeblock for both case: handled and unhandled exceptions */ - if( spMathErrorBlock != NULL ) + if( spMathErrorBlock ) { PHB_ITEM pArray, pRet; PHB_ITEM pType, pFuncname, pError, pArg1, pArg2, pRetval, pHandled; @@ -493,7 +493,7 @@ static int hb_matherrblock( HB_MATH_EXCEPTION * pexc ) { /* exception handled by codeblock ? */ pHandled = hb_itemArrayGet( pArray, 2 ); - if( pHandled != NULL ) + if( pHandled ) { pexc->handled = hb_itemGetL( pHandled ); hb_itemRelease( pHandled ); @@ -504,13 +504,13 @@ static int hb_matherrblock( HB_MATH_EXCEPTION * pexc ) /* YES ! */ /* extract retval for math routine and matherr() */ pRetval = hb_itemArrayGet( pArray, 1 ); - if( pRetval != NULL ) + if( pRetval ) { pexc->retval = hb_itemGetND( pRetval ); hb_itemGetNLen( pRetval, &pexc->retvalwidth, &pexc->retvaldec ); hb_itemRelease( pRetval ); } - if( pRet != NULL && HB_IS_NUMERIC( pRet ) ) + if( pRet && HB_IS_NUMERIC( pRet ) ) { retval = hb_itemGetNI( pRet ); /* block may also return 0 to force C math lib warnings */ hb_itemRelease( pRet ); @@ -533,7 +533,7 @@ static int hb_matherrblock( HB_MATH_EXCEPTION * pexc ) retval = 1; /* default return value to suppress C math lib warnings */ } - if( sPrevMathHandler != NULL ) + if( sPrevMathHandler ) { if( pexc->handled ) { @@ -575,7 +575,7 @@ HB_FUNC( HB_MATHERBLOCK ) /* ([]) -> */ /* set new error block */ PHB_ITEM pNewErrorBlock = hb_param( 1, HB_IT_BLOCK ); - if( pNewErrorBlock != NULL ) + if( pNewErrorBlock ) { if( spMathErrorBlock == NULL ) { diff --git a/harbour/source/rtl/xsavescr.c b/harbour/source/rtl/xsavescr.c index c3148b7d1d..b61dc53071 100644 --- a/harbour/source/rtl/xsavescr.c +++ b/harbour/source/rtl/xsavescr.c @@ -85,7 +85,7 @@ HB_FUNC( __XSAVESCREEN ) hb_gtGetPos( &s_iRow, &s_iCol ); hb_gtRectSize( 0, 0, hb_gtMaxRow(), hb_gtMaxCol(), &ulSize ); - if( s_pBuffer != NULL ) + if( s_pBuffer ) hb_xfree( s_pBuffer ); s_pBuffer = hb_xgrab( ulSize ); hb_gtSave( 0, 0, hb_gtMaxRow(), hb_gtMaxCol(), s_pBuffer ); @@ -98,7 +98,7 @@ HB_FUNC( __XSAVESCREEN ) HB_FUNC( __XRESTSCREEN ) { - if( s_pBuffer != NULL ) + if( s_pBuffer ) { hb_gtRest( 0, 0, hb_gtMaxRow(), hb_gtMaxCol(), s_pBuffer ); hb_xfree( s_pBuffer ); @@ -107,4 +107,3 @@ HB_FUNC( __XRESTSCREEN ) hb_gtSetPos( s_iRow, s_iCol ); } } - diff --git a/harbour/source/vm/memvars.c b/harbour/source/vm/memvars.c index 409337e763..39a742e66b 100644 --- a/harbour/source/vm/memvars.c +++ b/harbour/source/vm/memvars.c @@ -1381,10 +1381,10 @@ HB_FUNC( __MVSAVE ) pFileName = hb_fsFNameSplit( hb_parc( 1 ) ); - if( hb_set.HB_SET_DEFEXTENSIONS && pFileName->szExtension == NULL ) + if( hb_set.HB_SET_DEFEXTENSIONS && ! pFileName->szExtension ) pFileName->szExtension = ".mem"; - if( pFileName->szPath == NULL ) + if( ! pFileName->szPath ) pFileName->szPath = hb_set.HB_SET_DEFAULT; hb_fsFNameMerge( szFileName, pFileName ); @@ -1462,10 +1462,10 @@ HB_FUNC( __MVRESTORE ) pFileName = hb_fsFNameSplit( hb_parc( 1 ) ); - if( hb_set.HB_SET_DEFEXTENSIONS && pFileName->szExtension == NULL ) + if( hb_set.HB_SET_DEFEXTENSIONS && ! pFileName->szExtension ) pFileName->szExtension = ".mem"; - if( pFileName->szPath == NULL ) + if( ! pFileName->szPath ) pFileName->szPath = hb_set.HB_SET_DEFAULT; hb_fsFNameMerge( szFileName, pFileName );