diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 55a8c45370..bc3cdde7e7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,28 @@ The license applies to all entries newer than 2009-04-28. */ +2011-05-09 09:49 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbide/ideedit.prg + * contrib/hbide/idemisc.prg + * contrib/hbide/idedict.prg + * contrib/hbide/idethemes.prg + * contrib/hbide/idesaveload.prg + * contrib/hbide/idetools.prg + * contrib/hbide/ideharbourhelp.prg + * contrib/hbide/idemain.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/ideprojmanager.prg + * contrib/hbide/ideskeletons.prg + * contrib/hbide/ideenviron.prg + * contrib/hbide/idebrowse.prg + * contrib/hbide/idedocks.prg + ! fixed '!=' operator usage on strings + It has been told and written a hundred times, I hope this + is the final one: + Please never use '!=' operator on string operands, even + if both operands are always the same length. Use '!( == )' + instead. + 2011-05-09 09:40 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/net.c ! fixed potential NULL dereference with pass->pw_name diff --git a/harbour/contrib/hbide/idebrowse.prg b/harbour/contrib/hbide/idebrowse.prg index 11b2cb8156..7599ee370b 100644 --- a/harbour/contrib/hbide/idebrowse.prg +++ b/harbour/contrib/hbide/idebrowse.prg @@ -509,7 +509,7 @@ METHOD IdeBrowseManager:addPanels() IF empty( aPnl[ 2 ] ) aPnl[ 2 ] := "NO" ENDIF - IF aPnl[ 1 ] != "Main" + IF !( aPnl[ 1 ] == "Main" ) ::addPanel( aPnl[ 1 ], aPnl[ 2 ] == "YES" ) ENDIF NEXT @@ -621,7 +621,7 @@ METHOD IdeBrowseManager:execEvent( cEvent, p, p1 ) CASE "qPanelsButton_clicked" cPanel := hbide_fetchAString( ::qToolbar, "New...", "Name the Panel", "New Panel" ) - IF cPanel != "New..." .AND. cPanel != "Main" + IF !( cPanel == "New..." ) .AND. !( cPanel == "Main" ) IF ::isPanel( cPanel ) MsgBox( "Panel: " + cPanel + ", already exists" ) ELSE diff --git a/harbour/contrib/hbide/idedict.prg b/harbour/contrib/hbide/idedict.prg index 7e4cc2b4e0..2e3f47b6e6 100644 --- a/harbour/contrib/hbide/idedict.prg +++ b/harbour/contrib/hbide/idedict.prg @@ -175,7 +175,7 @@ METHOD IdeDictionary:load( cDict ) ::lAutoComplete := iif( a_[ 4 ] == "NO", .f., .t. ) ::cBgColor := a_[ 5 ] - IF ::cBgColor != "NONE" + IF !( ::cBgColor == "NONE" ) q_:= hbide_evalAsIs( ::cBgColor ) IF hb_isArray( q_ ) .AND. len( q_ ) == 3 ::qBgColor := QColor( q_[ 1 ], q_[ 2 ], q_[ 3 ] ) diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index f94436917d..3c1ef2f872 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -806,9 +806,9 @@ HB_TRACE( HB_TR_DEBUG, "projectTree_dropEvent" ) ::aViewsInfo[ n, 3 ] := p1[ 1 ] ::aViewsInfo[ n, 4 ] := p1[ 2 ] ENDIF - IF p1[ 2 ] >= 8 .AND. ::cWrkView != p:objectName() + IF p1[ 2 ] >= 8 .AND. !( ::cWrkView == p:objectName() ) ::setView( p:objectName() ) - IF p:objectName() != "Stats" .AND. ! empty( ::oEM ) .AND. ! empty( oEdit := ::oEM:getEditorCurrent() ) + IF !( p:objectName() == "Stats" ) .AND. ! empty( ::oEM ) .AND. ! empty( oEdit := ::oEM:getEditorCurrent() ) oEdit:setDocumentProperties() oEdit:qCoEdit:relayMarkButtons() oEdit:qCoEdit:toggleLineNumbers() @@ -859,7 +859,7 @@ METHOD IdeDocks:stackZoom( nMode ) IF ::nViewStyle == 4 nT := 0 FOR EACH qMdi IN ::oIde:aMdies - IF ::aViewsInfo[ qMdi:__enumIndex(), 1 ] != "Stats" + IF !( ::aViewsInfo[ qMdi:__enumIndex(), 1 ] == "Stats" ) qRect := qMdi:geometry() nH := qRect:height() + ( nMode * ( qRect:height() / 4 ) ) qMdi:setGeometry( QRect( 0, nT, qRect:width(), nH ) ) @@ -869,7 +869,7 @@ METHOD IdeDocks:stackZoom( nMode ) ELSE nL := 0 FOR EACH qMdi IN ::oIde:aMdies - IF ::aViewsInfo[ qMdi:__enumIndex(), 1 ] != "Stats" + IF !( ::aViewsInfo[ qMdi:__enumIndex(), 1 ] == "Stats" ) qRect := qMdi:geometry() nW := qRect:width() + ( nMode * ( qRect:width() / 4 ) ) qMdi:setGeometry( QRect( nL, 0, nW, qRect:height() ) ) @@ -896,7 +896,7 @@ METHOD IdeDocks:stackHorizontally() nL := 0 FOR EACH qMdi IN ::oIde:aMdies - IF ::aViewsInfo[ qMdi:__enumIndex(), 1 ] != "Stats" + IF !( ::aViewsInfo[ qMdi:__enumIndex(), 1 ] == "Stats" ) qMdi:setGeometry( QRect( nL, nT, nW, nH ) ) nL += nW ENDIF @@ -920,7 +920,7 @@ METHOD IdeDocks:stackVertically() nT := 0 FOR EACH qMdi IN ::oIde:aMdies - IF ::aViewsInfo[ qMdi:__enumIndex(), 1 ] != "Stats" + IF !( ::aViewsInfo[ qMdi:__enumIndex(), 1 ] == "Stats" ) qMdi:setGeometry( QRect( 0, nT, nW, nH ) ) nT += nH ENDIF @@ -1004,7 +1004,7 @@ METHOD IdeDocks:setViewInitials() LOCAL a_ FOR EACH a_ IN ::aViewsInfo - IF a_[ 1 ] != "Stats" + IF !( a_[ 1 ] == "Stats" ) ::setView( a_[ 1 ] ) IF ::qTabWidget:count() == 1 @@ -1028,7 +1028,7 @@ METHOD IdeDocks:setView( cView ) CASE "New..." cView := hbide_fetchAString( ::qViewsCombo, cView, "Name the View", "New View" ) - IF cView != "New..." .AND. cView != "Stats" .AND. cView != "Main" + IF !( cView == "New..." ) .AND. !( cView == "Stats" ) .AND. !( cView == "Main" ) IF ascan( ::aViewsInfo, {|e_| e_[ 1 ] == cView } ) > 0 MsgBox( "View: " + cView + ", already exists" ) ELSE @@ -1353,7 +1353,7 @@ METHOD IdeDocks:buildToolBarPanels() ::oDlg:oWidget:addToolBar( Qt_LeftToolBarArea, ::qTBarPanels ) FOR EACH a_ IN ::aViewsInfo - IF a_[ 1 ] != "Stats" + IF !( a_[ 1 ] == "Stats" ) ::addPanelButton( a_[ 1 ] ) ENDIF NEXT diff --git a/harbour/contrib/hbide/ideedit.prg b/harbour/contrib/hbide/ideedit.prg index 07a4616836..d894e9f2df 100644 --- a/harbour/contrib/hbide/ideedit.prg +++ b/harbour/contrib/hbide/ideedit.prg @@ -2429,7 +2429,7 @@ FUNCTION hbide_getFrontSpacesAndWord( cText, cWord ) LOCAL n := 0 DO WHILE .t. - IF substr( cText, ++n, 1 ) != " " + IF !( substr( cText, ++n, 1 ) == " " ) EXIT ENDIF ENDDO diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index b138295b03..a11cc21cbf 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -1352,7 +1352,7 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView, a ::qDocument := ::qEdit:document() - IF ::cType != "U" + IF !( ::cType == "U" ) ::qHiliter := ::oTH:SetSyntaxHilighting( ::oEdit:qEdit, @::cTheme ) ENDIF ::qCursor := ::qEdit:textCursor() @@ -1700,7 +1700,7 @@ METHOD IdeEditor:setTabImage( qEdit ) METHOD IdeEditor:applyTheme( cTheme ) - IF ::cType != "U" + IF !( ::cType == "U" ) IF empty( cTheme ) cTheme := ::oTH:selectTheme() ENDIF @@ -1722,7 +1722,7 @@ METHOD IdeEditor:showThumbnail() ::qThumbnail:fontFamily := "Courier New" ::qThumbnail:setFont() ::qThumbnail:setReadOnly( .t. ) - IF ::cType != "U" + IF !( ::cType == "U" ) ::qTNHiliter := ::oTH:SetSyntaxHilighting( ::qThumbnail:qEdit, @::cTheme ) ENDIF ::qThumbnail:qEdit:setTextInteractionFlags( Qt_TextSelectableByMouse + Qt_TextSelectableByKeyboard ) diff --git a/harbour/contrib/hbide/ideenviron.prg b/harbour/contrib/hbide/ideenviron.prg index 18d313d631..446447cca8 100644 --- a/harbour/contrib/hbide/ideenviron.prg +++ b/harbour/contrib/hbide/ideenviron.prg @@ -156,7 +156,7 @@ METHOD IdeEnvironments:parse( cEnvFile ) cPart := "common" ELSE cPart := "environment" - IF ( s != cEnv ) .AND. !empty( cEnv ) + IF !( s == cEnv ) .AND. !empty( cEnv ) aadd( ::aNames, cEnv ) aadd( ::aEnvrns, { cEnv, a_ } ) ENDIF diff --git a/harbour/contrib/hbide/ideharbourhelp.prg b/harbour/contrib/hbide/ideharbourhelp.prg index 04e95ddfff..2b66b546fd 100644 --- a/harbour/contrib/hbide/ideharbourhelp.prg +++ b/harbour/contrib/hbide/ideharbourhelp.prg @@ -725,7 +725,7 @@ METHOD IdeHarbourHelp:refreshDocTree() aDir := directory( cFolder + "*.txt" ) ENDIF FOR EACH a_ IN aDir - IF a_[ 5 ] != "D" + IF !( a_[ 5 ] == "D" ) cTextFile := cFolder + a_[ 1 ] oChild := QTreeWidgetItem() oChild:setText( 0, a_[ 1 ] ) @@ -1043,7 +1043,7 @@ METHOD IdeHarbourHelp:getFunctionPrototypes() IF empty( aHbd ) FOR EACH cFolder IN aDocs FOR EACH a_ IN directory( cFolder + "*.txt" ) - IF a_[ 5 ] != "D" + IF !( a_[ 5 ] == "D" ) aFn := ::pullDefinitions( cFolder + a_[ 1 ] ) FOR EACH oFunc IN aFn IF hb_isObject( oFunc ) @@ -1368,7 +1368,7 @@ METHOD IdeHarbourHelp:exportAsPdf() IF !empty( cPdf := hbide_fetchAFile( ::oDlg, "Provide a file name", { { "Pdf Documents", "*.pdf" } } ) ) hb_fNameSplit( cPdf, @cPath, @cFile, @cExt ) - IF empty( cExt ) .OR. lower( cExt ) != ".pdf" + IF empty( cExt ) .OR. !( Lower( cExt ) == ".pdf" ) cPdf := cPath + cFile + ".pdf" ENDIF qPrinter := QPrinter() diff --git a/harbour/contrib/hbide/idemain.prg b/harbour/contrib/hbide/idemain.prg index 670218b4de..0baa517ba8 100644 --- a/harbour/contrib/hbide/idemain.prg +++ b/harbour/contrib/hbide/idemain.prg @@ -1380,7 +1380,7 @@ METHOD HbIde:manageProjectContext( mp1, mp2, oXbpTreeItem ) CASE ::aProjData[ n, TRE_TYPE ] == "Project Name" cHbp := hbide_pathToOSPath( ::oPM:getProjectFileNameFromTitle( ::aProjData[ n, TRE_ORIGINAL ] ) ) // - IF Alltrim( Upper( ::cWrkProject ) ) != Alltrim( Upper( oXbpTreeItem:caption ) ) + IF !( Alltrim( Upper( ::cWrkProject ) ) == Alltrim( Upper( oXbpTreeItem:caption ) ) ) aadd( aPops, { "Set as Current" , {|| ::oPM:setCurrentProject( oXbpTreeItem:caption ) } } ) End aadd( aPops, { "Properties" , {|| ::oPM:loadProperties( cHbp, .f., .t., .t. ) } } ) diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index e5b9823471..a4afb67996 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -1486,7 +1486,7 @@ FUNCTION hbide_fetchSubPaths( aPaths, cRootPath, lSubs ) DEFAULT lSubs TO .t. - IF right( cRootPath, 1 ) != hb_ps() + IF !( right( cRootPath, 1 ) == hb_ps() ) cRootPath += hb_ps() ENDIF cRootPath := hbide_pathToOSPath( cRootPath ) @@ -1496,7 +1496,7 @@ FUNCTION hbide_fetchSubPaths( aPaths, cRootPath, lSubs ) IF lSubs aDir := directory( cRootPath + "*", "D" ) FOR EACH a_ IN aDir - IF a_[ 5 ] == "D" .AND. left( a_[ 1 ], 1 ) != "." + IF a_[ 5 ] == "D" .AND. !( left( a_[ 1 ], 1 ) == "." ) hbide_fetchSubPaths( @aPaths, cRootPath + a_[ 1 ] ) ENDIF NEXT @@ -1662,7 +1662,7 @@ FUNCTION hbide_groupSources( cMode, a_ ) FOR EACH s IN a_ s := alltrim( s ) - IF left( s, 1 ) != "#" + IF !( left( s, 1 ) == "#" ) cTyp := hbide_sourceType( s ) IF ( n := ascan( aSrc, {|e| cTyp == e } ) ) > 0 diff --git a/harbour/contrib/hbide/ideprojmanager.prg b/harbour/contrib/hbide/ideprojmanager.prg index 2b23e0661d..e8ed5da140 100644 --- a/harbour/contrib/hbide/ideprojmanager.prg +++ b/harbour/contrib/hbide/ideprojmanager.prg @@ -964,7 +964,7 @@ METHOD IdeProjManager:sortSources( cMode ) FOR EACH s IN a_ s := alltrim( s ) - IF left( s, 1 ) != "#" + IF !( left( s, 1 ) == "#" ) cTyp := hbide_sourceType( s ) IF ( n := ascan( aSrc, {|e| cTyp == e } ) ) > 0 diff --git a/harbour/contrib/hbide/idesaveload.prg b/harbour/contrib/hbide/idesaveload.prg index 235d5d2efa..4fbe1a189b 100644 --- a/harbour/contrib/hbide/idesaveload.prg +++ b/harbour/contrib/hbide/idesaveload.prg @@ -593,9 +593,9 @@ METHOD IdeINI:load( cHbideIni ) CASE "DbStructDialogGeometry" ; ::cDbStructDialogGeometry := cVal ; EXIT CASE "TablesDialogGeometry" ; ::cTablesDialogGeometry := cVal ; EXIT // - CASE "CurrentLineHighlightMode" ; ::oIde:lCurrentLineHighlightEnabled := ( cVal != "NO" ); EXIT - CASE "LineNumbersDisplayMode" ; ::oIde:lLineNumbersVisible := ( cVal != "NO" ); EXIT - CASE "HorzRulerDisplayMode" ; ::oIde:lHorzRulerVisible := ( cVal != "NO" ); EXIT + CASE "CurrentLineHighlightMode" ; ::oIde:lCurrentLineHighlightEnabled := !( cVal == "NO" ); EXIT + CASE "LineNumbersDisplayMode" ; ::oIde:lLineNumbersVisible := !( cVal == "NO" ); EXIT + CASE "HorzRulerDisplayMode" ; ::oIde:lHorzRulerVisible := !( cVal == "NO" ); EXIT // CASE "RecentTabIndex" ; ::cRecentTabIndex := cVal ; EXIT // @@ -625,22 +625,22 @@ METHOD IdeINI:load( cHbideIni ) CASE "PointSize" ; ::nPointSize := val( cVal ); EXIT CASE "LineEndingMode" ; ::cLineEndingMode := cVal ; EXIT // - CASE "TrimTrailingBlanks" ; ::oINI:lTrimTrailingBlanks := cVal != "NO" ; EXIT - CASE "SaveSourceWhenComp" ; ::oINI:lSaveSourceWhenComp := cVal != "NO" ; EXIT - CASE "SupressHbKWordsToUpper" ; ::oINI:lSupressHbKWordsToUpper := cVal != "NO" ; EXIT - CASE "ReturnAsBeginKeyword" ; ::oINI:lReturnAsBeginKeyword := cVal != "NO" ; EXIT - CASE "ConvTabToSpcWhenLoading" ; ::oINI:lConvTabToSpcWhenLoading := cVal != "NO" ; EXIT - CASE "AutoIndent" ; ::oINI:lAutoIndent := cVal != "NO" ; EXIT - CASE "SmartIndent" ; ::oINI:lSmartIndent := cVal != "NO" ; EXIT - CASE "TabToSpcInEdits" ; ::oINI:lTabToSpcInEdits := cVal != "NO" ; EXIT + CASE "TrimTrailingBlanks" ; ::oINI:lTrimTrailingBlanks := !( cVal == "NO" ) ; EXIT + CASE "SaveSourceWhenComp" ; ::oINI:lSaveSourceWhenComp := !( cVal == "NO" ) ; EXIT + CASE "SupressHbKWordsToUpper" ; ::oINI:lSupressHbKWordsToUpper := !( cVal == "NO" ) ; EXIT + CASE "ReturnAsBeginKeyword" ; ::oINI:lReturnAsBeginKeyword := !( cVal == "NO" ) ; EXIT + CASE "ConvTabToSpcWhenLoading" ; ::oINI:lConvTabToSpcWhenLoading := !( cVal == "NO" ) ; EXIT + CASE "AutoIndent" ; ::oINI:lAutoIndent := !( cVal == "NO" ) ; EXIT + CASE "SmartIndent" ; ::oINI:lSmartIndent := !( cVal == "NO" ) ; EXIT + CASE "TabToSpcInEdits" ; ::oINI:lTabToSpcInEdits := !( cVal == "NO" ) ; EXIT CASE "TabSpaces" ; ::oIde:nTabSpaces := val( cVal ) ; EXIT CASE "IndentSpaces" ; ::oINI:nIndentSpaces := val( cVal ) ; EXIT CASE "TmpBkpPrd" ; ::oINI:nTmpBkpPrd := val( cVal ) ; EXIT CASE "BkpPath" ; ::oINI:cBkpPath := cVal ; EXIT CASE "BkpSuffix" ; ::oINI:cBkpSuffix := cVal ; EXIT - CASE "CodeListWithArgs" ; ::oINI:lCompletionWithArgs := cVal != "NO" ; EXIT - CASE "CompletionWithArgs" ; ::oINI:lCompleteArgumented := cVal != "NO" ; EXIT - CASE "EditsMdi" ; ::lEditsMdi := cVal != "NO" ; EXIT + CASE "CodeListWithArgs" ; ::oINI:lCompletionWithArgs := !( cVal == "NO" ) ; EXIT + CASE "CompletionWithArgs" ; ::oINI:lCompleteArgumented := !( cVal == "NO" ) ; EXIT + CASE "EditsMdi" ; ::lEditsMdi := !( cVal == "NO" ) ; EXIT ENDSWITCH ENDIF diff --git a/harbour/contrib/hbide/ideskeletons.prg b/harbour/contrib/hbide/ideskeletons.prg index c92e0519b4..f6b1fd9e9c 100644 --- a/harbour/contrib/hbide/ideskeletons.prg +++ b/harbour/contrib/hbide/ideskeletons.prg @@ -260,7 +260,7 @@ METHOD IdeSkeletons:rename( cName ) IF ( n := ascan( ::aSkltns, {|e_| e_[ 1 ] == cName } ) ) > 0 cNewName := hbide_fetchAString( ::oDlg:oWidget, cName, "Name", "Change Skeleton's Name" ) - IF !empty( cNewName ) .AND. cNewName != cName + IF !empty( cNewName ) .AND. !( cNewName == cName ) ::aSkltns[ n, 1 ] := cNewName ::updateTree() hbide_saveSkltns( ::oIde ) diff --git a/harbour/contrib/hbide/idethemes.prg b/harbour/contrib/hbide/idethemes.prg index 13a43bb2ca..69f16404a1 100644 --- a/harbour/contrib/hbide/idethemes.prg +++ b/harbour/contrib/hbide/idethemes.prg @@ -602,7 +602,7 @@ METHOD IdeThemes:copy() cTheme := qGo:textValue() - IF !empty( cTheme ) .and. ( cTheme != ::aThemes[ ::nCurTheme, 1 ] ) + IF !empty( cTheme ) .and. !( cTheme == ::aThemes[ ::nCurTheme, 1 ] ) aItems := aclone( ::aThemes[ ::nCurTheme ] ) aItems[ 1 ] := cTheme aadd( ::aThemes, aItems ) diff --git a/harbour/contrib/hbide/idetools.prg b/harbour/contrib/hbide/idetools.prg index cc29f0c582..5e446684e7 100644 --- a/harbour/contrib/hbide/idetools.prg +++ b/harbour/contrib/hbide/idetools.prg @@ -465,7 +465,7 @@ METHOD IdeToolsManager:buildUserToolbars() qTBtn:setMaximumHeight( 20 ) qTBtn:connect( "clicked()", hbide_toolBlock( Self, b_ ) ) qTBar:addWidget( qTBtn ) - IF b_[ 8 ] != "YES" + IF !( b_[ 8 ] == "YES" ) qTBtn:setEnabled( .f. ) ENDIF aadd( ::aBtns, qTBtn )