From ffe10ac9b52912659b8cfdf5634bae47e3f8ac84 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 10 Jul 2012 18:24:40 +0000 Subject: [PATCH] 2012-07-10 20:23 UTC+0200 Viktor Szakats (harbour syenar.net) * src/rtl/alert.prg * src/rtl/typefile.prg % using FOR EACH * src/rtl/spfiles.c * formatting (whitespace) --- harbour/ChangeLog | 8 ++++++++ harbour/src/rtl/alert.prg | 15 ++++++++------- harbour/src/rtl/spfiles.c | 8 ++++---- harbour/src/rtl/typefile.prg | 16 +++++++++------- 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b9aeff89fa..f88a2d0c36 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2012-07-10 20:23 UTC+0200 Viktor Szakats (harbour syenar.net) + * src/rtl/alert.prg + * src/rtl/typefile.prg + % using FOR EACH + + * src/rtl/spfiles.c + * formatting (whitespace) + 2012-07-10 10:46 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtgui/hbqtgui.ch + Added: few QLCD* constants. diff --git a/harbour/src/rtl/alert.prg b/harbour/src/rtl/alert.prg index 6c268e7110..6b3bdfac58 100644 --- a/harbour/src/rtl/alert.prg +++ b/harbour/src/rtl/alert.prg @@ -43,7 +43,7 @@ STATIC s_lNoAlert FUNCTION Alert( cMessage, aOptions, cColorNorm ) LOCAL cColorHigh LOCAL aOptionsOK - LOCAL nEval + LOCAL cOption #ifdef HB_CLP_UNDOC @@ -76,9 +76,9 @@ FUNCTION Alert( cMessage, aOptions, cColorNorm ) ENDIF aOptionsOK := {} - FOR nEval := 1 TO Len( aOptions ) - IF HB_ISSTRING( aOptions[ nEval ] ) .AND. ! Empty( aOptions[ nEval ] ) - AAdd( aOptionsOK, aOptions[ nEval ] ) + FOR EACH cOption IN aOptions + IF HB_ISSTRING( cOption ) .AND. ! Empty( cOption ) + AAdd( aOptionsOK, cOption ) ENDIF NEXT @@ -100,6 +100,7 @@ FUNCTION hb_Alert( xMessage, aOptions, cColorNorm, nDelay ) LOCAL cMessage LOCAL cColorHigh LOCAL aOptionsOK + LOCAL cOption LOCAL nEval #ifdef HB_CLP_UNDOC @@ -142,9 +143,9 @@ FUNCTION hb_Alert( xMessage, aOptions, cColorNorm, nDelay ) ENDIF aOptionsOK := {} - FOR nEval := 1 TO Len( aOptions ) - IF HB_ISSTRING( aOptions[ nEval ] ) .AND. ! Empty( aOptions[ nEval ] ) - AAdd( aOptionsOK, aOptions[ nEval ] ) + FOR EACH cOption IN aOptions + IF HB_ISSTRING( cOption ) .AND. ! Empty( cOption ) + AAdd( aOptionsOK, cOption ) ENDIF NEXT diff --git a/harbour/src/rtl/spfiles.c b/harbour/src/rtl/spfiles.c index 5750504d95..e98332e7ad 100644 --- a/harbour/src/rtl/spfiles.c +++ b/harbour/src/rtl/spfiles.c @@ -55,7 +55,7 @@ HB_BOOL hb_spFile( const char * pFilename, char * pRetPath ) { - char *Path; + char * Path; HB_BOOL bIsFile = HB_FALSE; PHB_FNAME pFilepath; @@ -83,7 +83,7 @@ HB_BOOL hb_spFile( const char * pFilename, char * pRetPath ) bIsFile = hb_fsFile( Path ); } - if( !bIsFile && hb_setGetPath() ) + if( ! bIsFile && hb_setGetPath() ) { HB_PATHNAMES * NextPath = hb_setGetFirstSetPath(); @@ -119,7 +119,7 @@ HB_BOOL hb_spFile( const char * pFilename, char * pRetPath ) HB_BOOL hb_spFileExists( const char * pFilename, char * pRetPath ) { - char *Path; + char * Path; HB_BOOL bIsFile = HB_FALSE; PHB_FNAME pFilepath; @@ -147,7 +147,7 @@ HB_BOOL hb_spFileExists( const char * pFilename, char * pRetPath ) bIsFile = hb_fsFileExists( Path ); } - if( !bIsFile && hb_setGetPath() ) + if( ! bIsFile && hb_setGetPath() ) { HB_PATHNAMES * NextPath = hb_setGetFirstSetPath(); diff --git a/harbour/src/rtl/typefile.prg b/harbour/src/rtl/typefile.prg index 5acdf78bd0..17f46077fb 100644 --- a/harbour/src/rtl/typefile.prg +++ b/harbour/src/rtl/typefile.prg @@ -69,7 +69,7 @@ PROCEDURE __TypeFile( cFile, lPrint ) LOCAL aSaveSet[ 2 ] LOCAL cDir, cName, cExt LOCAL cTmp - LOCAL aPath + LOCAL cPath LOCAL i IF ! HB_ISLOGICAL( lPrint ) @@ -89,16 +89,18 @@ PROCEDURE __TypeFile( cFile, lPrint ) /* If no drive/dir specified, search the SET DEFAULT and PATH directories */ hb_FNameSplit( cFile, @cDir, @cName, @cExt ) + IF Empty( cDir ) - cTmp := Set( _SET_DEFAULT ) + ";" + Set( _SET_PATH ) - cTmp := StrTran( cTmp, ",", ";" ) + + cTmp := StrTran( Set( _SET_DEFAULT ) + ";" + Set( _SET_PATH ), ",", ";" ) + i := Len( cTmp ) DO WHILE SubStr( cTmp, i, 1 ) == ";" /* remove last ";" */ cTmp := Left( cTmp, --i ) ENDDO - aPath := hb_ATokens( cTmp, ";" ) - FOR i := 1 TO Len( aPath ) - IF File( cTmp := hb_FNameMerge( aPath[ i ], cName, cExt ) ) + + FOR EACH cPath IN hb_ATokens( cTmp, ";" ) + IF File( cTmp := hb_FNameMerge( cPath, cName, cExt ) ) cFile := cTmp EXIT ENDIF @@ -134,7 +136,7 @@ PROCEDURE __TypeFile( cFile, lPrint ) nSize := FSeek( nHandle, 0, FS_END ) nBuffer := Min( nSize, BUFFER_LENGTH ) - FSeek( nHandle, 0 ) // go top + FSeek( nHandle, 0 ) /* go top */ /* Here we try to read a line at a time but I think we could just display the whole buffer since it said: