From 100eb2bd166507d73197c0c51cb04e1fec3fda3a Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 20 Jul 2012 05:33:55 +0000 Subject: [PATCH] 2012-07-20 07:33 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/xhb/filestat.c * uncrustified * contrib/gtalleg/gtalleg.c * contrib/hbct/atadjust.c * contrib/xhb/hbxml.c * include/hbexpra.c * src/rtl/gtxwc/gtxwc.c * minor formatting --- harbour/ChangeLog | 11 +++ harbour/contrib/gtalleg/gtalleg.c | 2 +- harbour/contrib/hbct/atadjust.c | 2 +- harbour/contrib/xhb/filestat.c | 142 +++++++++++++++--------------- harbour/contrib/xhb/hbxml.c | 6 +- harbour/include/hbexpra.c | 2 +- harbour/src/rtl/gtxwc/gtxwc.c | 2 +- 7 files changed, 89 insertions(+), 78 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 65be383e7f..81cd51472d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,17 @@ The license applies to all entries newer than 2009-04-28. */ +2012-07-20 07:33 UTC+0200 Viktor Szakats (harbour syenar.net) + * contrib/xhb/filestat.c + * uncrustified + + * contrib/gtalleg/gtalleg.c + * contrib/hbct/atadjust.c + * contrib/xhb/hbxml.c + * include/hbexpra.c + * src/rtl/gtxwc/gtxwc.c + * minor formatting + 2012-07-20 07:22 UTC+0200 Viktor Szakats (harbour syenar.net) * examples/gfspell/spellc.c * uncrustified diff --git a/harbour/contrib/gtalleg/gtalleg.c b/harbour/contrib/gtalleg/gtalleg.c index 0689a27e6e..2c584da193 100644 --- a/harbour/contrib/gtalleg/gtalleg.c +++ b/harbour/contrib/gtalleg/gtalleg.c @@ -209,7 +209,7 @@ static const gtAllegKey s_CtrlTable[ GT_CTRL_TABLE_SIZE ] = #define GT_SCREENINIT() do { if( !s_fInit ) \ hb_gt_alleg_InitializeScreen( pGT, s_iScrHeight, s_iScrWidth, HB_TRUE ); \ } while( 0 ) -#define MK_GT8BCOLOR(n) ((n & 0xFF) / 16 | (n & 0xFF00) / 256) +#define MK_GT8BCOLOR( n ) ( ( n & 0xFF ) / 16 | ( n & 0xFF00 ) / 256 ) static void hb_gt_alleg_Error( const char * szMsg ) diff --git a/harbour/contrib/hbct/atadjust.c b/harbour/contrib/hbct/atadjust.c index 30a6e0d410..6689e7ef67 100644 --- a/harbour/contrib/hbct/atadjust.c +++ b/harbour/contrib/hbct/atadjust.c @@ -257,7 +257,7 @@ HB_FUNC( ATADJUST ) } } } - else /* ((ISCHAR (1)) && (ISCHAR (2)) && (ISNUM (3))) */ + else /* ( HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) && HB_ISNUM( 3 ) ) */ { PHB_ITEM pSubst = NULL; int iArgErrorMode = ct_getargerrormode(); diff --git a/harbour/contrib/xhb/filestat.c b/harbour/contrib/xhb/filestat.c index 5db9d70494..1604bbdc54 100644 --- a/harbour/contrib/xhb/filestat.c +++ b/harbour/contrib/xhb/filestat.c @@ -65,23 +65,23 @@ #elif defined( HB_OS_WIN ) #include #if ! defined( INVALID_FILE_ATTRIBUTES ) - #define INVALID_FILE_ATTRIBUTES ((DWORD)(-1)) + #define INVALID_FILE_ATTRIBUTES ( ( DWORD ) ( -1 ) ) #endif #include "hbwinuni.h" #endif HB_FUNC( FILESTATS ) { - HB_BOOL fResult = HB_FALSE; - char szAttr[ 21 ]; - HB_FOFFSET llSize = 0; - long lcDate = 0, lcTime = 0, lmDate = 0, lmTime = 0; + HB_BOOL fResult = HB_FALSE; + char szAttr[ 21 ]; + HB_FOFFSET llSize = 0; + long lcDate = 0, lcTime = 0, lmDate = 0, lmTime = 0; /* Parameter checking */ if( hb_parclen( 1 ) == 0 ) { hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, 1, - hb_paramError(1) ); + hb_paramError( 1 ) ); return; } @@ -92,91 +92,91 @@ HB_FUNC( FILESTATS ) if( stat( hb_parc( 1 ), &statbuf ) == 0 ) { // determine if we can read/write/execute the file - HB_FATTR usAttr, ushbAttr = 0; - time_t ftime; + HB_FATTR usAttr, ushbAttr = 0; + time_t ftime; #if defined( HB_HAS_LOCALTIME_R ) - struct tm tms; + struct tm tms; #endif - struct tm *ptms; - char * pszAttr = szAttr; + struct tm * ptms; + char * pszAttr = szAttr; /* See which attribs are applicable */ if( statbuf.st_uid == geteuid() ) { usAttr = - ((statbuf.st_mode & S_IRUSR ) ? 1 << 2 : 0) | - ((statbuf.st_mode & S_IWUSR ) ? 1 << 1 : 0) | - ((statbuf.st_mode & S_IXUSR ) ? 1 : 0); + ( ( statbuf.st_mode & S_IRUSR ) ? 1 << 2 : 0 ) | + ( ( statbuf.st_mode & S_IWUSR ) ? 1 << 1 : 0 ) | + ( ( statbuf.st_mode & S_IXUSR ) ? 1 : 0 ); } else if( statbuf.st_gid == getegid() ) { usAttr = - ((statbuf.st_mode & S_IRGRP ) ? 1 << 2 : 0) | - ((statbuf.st_mode & S_IWGRP ) ? 1 << 1 : 0) | - ((statbuf.st_mode & S_IXGRP ) ? 1 : 0); + ( ( statbuf.st_mode & S_IRGRP ) ? 1 << 2 : 0 ) | + ( ( statbuf.st_mode & S_IWGRP ) ? 1 << 1 : 0 ) | + ( ( statbuf.st_mode & S_IXGRP ) ? 1 : 0 ); } else { usAttr = - ((statbuf.st_mode & S_IROTH ) ? 1 << 2 : 0) | - ((statbuf.st_mode & S_IWOTH ) ? 1 << 1 : 0) | - ((statbuf.st_mode & S_IXOTH ) ? 1 : 0); + ( ( statbuf.st_mode & S_IROTH ) ? 1 << 2 : 0 ) | + ( ( statbuf.st_mode & S_IWOTH ) ? 1 << 1 : 0 ) | + ( ( statbuf.st_mode & S_IXOTH ) ? 1 : 0 ); } /* Standard characters */ - if( (usAttr & 4) == 0 ) /* Hidden (can't read)*/ + if( ( usAttr & 4 ) == 0 ) /* Hidden (can't read)*/ ushbAttr |= HB_FA_HIDDEN; - if( (usAttr & 2) == 0 ) /* read only (can't write)*/ + if( ( usAttr & 2 ) == 0 ) /* read only (can't write)*/ ushbAttr |= HB_FA_READONLY; - if( (usAttr & 1) == 1 ) /* executable? (xbit)*/ + if( ( usAttr & 1 ) == 1 ) /* executable? (xbit)*/ ushbAttr |= HB_FA_SYSTEM; /* Extension characters */ - if( ( statbuf.st_mode & S_IFLNK ) == S_IFLNK) - *pszAttr++ = 'Z'; /* Xharbour extension */ + if( ( statbuf.st_mode & S_IFLNK ) == S_IFLNK ) + *pszAttr++ = 'Z'; /* Xharbour extension */ if( ( statbuf.st_mode & S_IFSOCK ) == S_IFSOCK ) - *pszAttr++ = 'K'; /* Xharbour extension */ + *pszAttr++ = 'K'; /* Xharbour extension */ /* device */ if( ( statbuf.st_mode & S_IFBLK ) == S_IFBLK || ( statbuf.st_mode & S_IFCHR ) == S_IFCHR ) - ushbAttr |= HB_FA_DEVICE; /* Xharbour extension */ + ushbAttr |= HB_FA_DEVICE; /* Xharbour extension */ if( ( statbuf.st_mode & S_IFIFO ) == S_IFIFO ) - *pszAttr++ = 'Y'; /* Xharbour extension */ + *pszAttr++ = 'Y'; /* Xharbour extension */ if( S_ISDIR( statbuf.st_mode ) ) - ushbAttr |= HB_FA_DIRECTORY; /* Xharbour extension */ + ushbAttr |= HB_FA_DIRECTORY; /* Xharbour extension */ /* Give the ARCHIVE if readwrite, not executable and not special */ else if( S_ISREG( statbuf.st_mode ) && ushbAttr == 0 ) ushbAttr |= HB_FA_ARCHIVE; - llSize = ( HB_FOFFSET ) statbuf.st_size; + llSize = ( HB_FOFFSET ) statbuf.st_size; - ftime = statbuf.st_mtime; + ftime = statbuf.st_mtime; #if defined( HB_HAS_LOCALTIME_R ) - ptms = localtime_r( &ftime, &tms ); + ptms = localtime_r( &ftime, &tms ); #else - ptms = localtime( &ftime ); + ptms = localtime( &ftime ); #endif - lcDate = hb_dateEncode( ptms->tm_year + 1900, - ptms->tm_mon + 1, ptms->tm_mday ); - lcTime = ptms->tm_hour*3600 + ptms->tm_min * 60 + ptms->tm_sec; + lcDate = hb_dateEncode( ptms->tm_year + 1900, + ptms->tm_mon + 1, ptms->tm_mday ); + lcTime = ptms->tm_hour * 3600 + ptms->tm_min * 60 + ptms->tm_sec; - ftime = statbuf.st_atime; + ftime = statbuf.st_atime; #if defined( HB_HAS_LOCALTIME_R ) - ptms = localtime_r( &ftime, &tms ); + ptms = localtime_r( &ftime, &tms ); #else - ptms = localtime( &ftime ); + ptms = localtime( &ftime ); #endif - lmDate = hb_dateEncode( ptms->tm_year + 1900, - ptms->tm_mon + 1, ptms->tm_mday ); - lmTime = ptms->tm_hour*3600 + ptms->tm_min * 60 + ptms->tm_sec; + lmDate = hb_dateEncode( ptms->tm_year + 1900, + ptms->tm_mon + 1, ptms->tm_mday ); + lmTime = ptms->tm_hour * 3600 + ptms->tm_min * 60 + ptms->tm_sec; hb_fsAttrDecode( ushbAttr, szAttr ); @@ -187,13 +187,13 @@ HB_FUNC( FILESTATS ) #elif defined( HB_OS_WIN ) { - void * hFileName; - LPCTSTR lpFileName = HB_PARSTR( 1, &hFileName, NULL ); - DWORD dwAttribs; - WIN32_FIND_DATA ffind; - HANDLE hFind; - FILETIME filetime; - SYSTEMTIME time; + void * hFileName; + LPCTSTR lpFileName = HB_PARSTR( 1, &hFileName, NULL ); + DWORD dwAttribs; + WIN32_FIND_DATA ffind; + HANDLE hFind; + FILETIME filetime; + SYSTEMTIME time; /* Get attributes... */ dwAttribs = GetFileAttributes( lpFileName ); @@ -213,25 +213,25 @@ HB_FUNC( FILESTATS ) if( FileTimeToLocalFileTime( &ffind.ftCreationTime, &filetime ) && FileTimeToSystemTime( &filetime, &time ) ) { - lcDate = hb_dateEncode( time.wYear, time.wMonth, time.wDay ); - lcTime = time.wHour * 3600 + time.wMinute * 60 + time.wSecond; + lcDate = hb_dateEncode( time.wYear, time.wMonth, time.wDay ); + lcTime = time.wHour * 3600 + time.wMinute * 60 + time.wSecond; } else { - lcDate = hb_dateEncode( 0, 0, 0 ); - lcTime = 0; + lcDate = hb_dateEncode( 0, 0, 0 ); + lcTime = 0; } if( FileTimeToLocalFileTime( &ffind.ftLastAccessTime, &filetime ) && FileTimeToSystemTime( &filetime, &time ) ) { - lmDate = hb_dateEncode( time.wYear, time.wMonth, time.wDay ); - lmTime = time.wHour * 3600 + time.wMinute * 60 + time.wSecond; + lmDate = hb_dateEncode( time.wYear, time.wMonth, time.wDay ); + lmTime = time.wHour * 3600 + time.wMinute * 60 + time.wSecond; } else { - lcDate = hb_dateEncode( 0, 0, 0 ); - lcTime = 0; + lcDate = hb_dateEncode( 0, 0, 0 ); + lcTime = 0; } fResult = HB_TRUE; } @@ -248,18 +248,18 @@ HB_FUNC( FILESTATS ) if( findinfo ) { hb_fsAttrDecode( findinfo->attr, szAttr ); - llSize = ( HB_FOFFSET ) findinfo->size; - lcDate = findinfo->lDate; - lcTime = (findinfo->szTime[0] - '0') * 36000 + - (findinfo->szTime[1] - '0') * 3600 + - (findinfo->szTime[3] - '0') * 600 + - (findinfo->szTime[4] - '0') * 60 + - (findinfo->szTime[6] - '0') * 10 + - (findinfo->szTime[7] - '0'); - lmDate = hb_dateEncode( 0, 0, 0 ); - lmTime = 0; + llSize = ( HB_FOFFSET ) findinfo->size; + lcDate = findinfo->lDate; + lcTime = ( findinfo->szTime[ 0 ] - '0' ) * 36000 + + ( findinfo->szTime[ 1 ] - '0' ) * 3600 + + ( findinfo->szTime[ 3 ] - '0' ) * 600 + + ( findinfo->szTime[ 4 ] - '0' ) * 60 + + ( findinfo->szTime[ 6 ] - '0' ) * 10 + + ( findinfo->szTime[ 7 ] - '0' ); + lmDate = hb_dateEncode( 0, 0, 0 ); + lmTime = 0; hb_fsFindClose( findinfo ); - fResult = HB_TRUE; + fResult = HB_TRUE; } } @@ -269,11 +269,11 @@ HB_FUNC( FILESTATS ) if( fResult ) { - hb_storc ( szAttr, 2 ); + hb_storc( szAttr, 2 ); hb_stornint( llSize, 3 ); - hb_stordl ( lcDate, 4 ); + hb_stordl( lcDate, 4 ); hb_stornint( lcTime, 5 ); - hb_stordl ( lmDate, 6 ); + hb_stordl( lmDate, 6 ); hb_stornint( lmTime, 7 ); hb_retl( HB_TRUE ); diff --git a/harbour/contrib/xhb/hbxml.c b/harbour/contrib/xhb/hbxml.c index 559f435040..5908cb34fb 100644 --- a/harbour/contrib/xhb/hbxml.c +++ b/harbour/contrib/xhb/hbxml.c @@ -2292,8 +2292,8 @@ static const char *edesc[] = static const char *mxml_error_desc( MXML_ERROR_CODE code ) { - int iCode = ((int)code) - 1; - if( iCode < 0 || iCode > (signed) (sizeof( edesc ) / sizeof( char * ) ) ) + int iCode = ( ( int ) code ) - 1; + if( iCode < 0 || iCode > ( signed ) ( sizeof( edesc ) / sizeof( char * ) ) ) return NULL; return edesc[ iCode ]; @@ -2319,7 +2319,7 @@ HB_FUNC( HBXML_DATAREAD ) { PHB_ITEM pParam = hb_param( 2, HB_IT_ANY ); PHB_ITEM pDoc = hb_param( 1, HB_IT_OBJECT ); - int iStyle = hb_parni(3); + int iStyle = hb_parni( 3 ); PHB_ITEM pRoot; MXML_REFIL refil; char buffer[ 512 ], * buf; diff --git a/harbour/include/hbexpra.c b/harbour/include/hbexpra.c index efc9094bf0..166b68ca08 100644 --- a/harbour/include/hbexpra.c +++ b/harbour/include/hbexpra.c @@ -263,7 +263,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_COM pName->value.asSymbol.name = "__GETA"; /* NOTE: a[ i, j ] is stored as: (pExprList)->(pIndex) - * ((a->[ i ])->[ j ]) + * ( ( a->[ i ] )->[ j ] ) */ pVar = HB_EXPR_USE( pArg->value.asList.pExprList, HB_EA_REDUCE ); pBase = pVar->ExprType == HB_ET_ARRAYAT ? pVar : NULL; diff --git a/harbour/src/rtl/gtxwc/gtxwc.c b/harbour/src/rtl/gtxwc/gtxwc.c index 4126df3b9e..d2af792d9a 100644 --- a/harbour/src/rtl/gtxwc/gtxwc.c +++ b/harbour/src/rtl/gtxwc/gtxwc.c @@ -3065,7 +3065,7 @@ static void hb_gt_xwc_WndProc( PXWND_DEF wnd, XEvent *evt ) } else { - Time evtTime = ((XButtonEvent *) evt)->time; + Time evtTime = ( ( XButtonEvent * ) evt )->time; if( evtTime - wnd->mouseButtonsTime[ button ] < ( Time ) HB_GTSELF_MOUSEGETDOUBLECLICKSPEED( wnd->pGT ) ) key = s_mouseDblPressKeys[ button ];