diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 780c1e26cc..55a8c45370 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,10 +16,30 @@ The license applies to all entries newer than 2009-04-28. */ +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 + I'm not sure it's real possibility anyhow it cannot hurt + reason for this change is that I was getting GPF under + Linux in this call which wasn't BTW fixed by this change. + + * contrib/hbxbp/xbpcheckbox.prg + * contrib/hbxbp/xbpbrowse.prg + * contrib/hbxbp/xbpstatusbar.prg + * contrib/hbxbp/xbpfontdialog.prg + * contrib/hbxbp/xbptreeview.prg + * contrib/hbxbp/xbpparthandler.prg + * contrib/hbxbp/xbpdataref.prg + * contrib/hbide/idemisc.prg + * contrib/hbide/ideeditor.prg + ! Fixed '!=' operator used with string + ! '<>' operator changed to '!=' + Please never use '<>' or '#' unequality operator in Harbour SVN + 2011-05-09 00:16 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbxbp/xbpmenubar.prg * contrib/hbxbp/xbpparthandler.prg - ! Corrected: many artifacts related to XbpMenu() and + ! Corrected: many artifacts related to XbpMenu() and :setOwner()/:setParent() functionality. Thanks Shum for insight. 2011-05-07 13:18 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index bd9b06b78a..b138295b03 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -1493,12 +1493,12 @@ METHOD IdeEditor:prepareBufferToSave( cBuffer ) // here we can extercise user settings via Setup // cEOL := iif( ::cEOL == "", cE, ::cEOL ) - IF cEOL <> cE + IF !( cEOL == cE ) // MsgBox( "Difference in set EOL and current file EOL mode, saving with original mode!" ) ENDIF cBuffer := strtran( cBuffer, chr( 13 ) ) - IF cEOL != chr( 10 ) + IF !( cEOL == chr( 10 ) ) cBuffer := strtran( cBuffer, chr( 10 ), cEOL ) ENDIF IF ::oINI:lTrimTrailingBlanks diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index 1467fa7f51..e5b9823471 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -725,7 +725,7 @@ FUNCTION hbide_parseFNfromStatusMsg( cText, cFileName, nLine, lValidText ) IF ( nPos := hb_At( '(', cText ) ) > 0 cFileName := alltrim( Subst( cText, 1, nPos - 1 ) ) ELSE - IF ( nPos := At( 'referenced from', Lower( cText ) ) ) <> 00 + IF ( nPos := At( 'referenced from', Lower( cText ) ) ) != 0 cFileName := SubStr( cText, nPos + Len( 'referenced from' ) ) ELSE * GCC & MSVC filename detect... @@ -734,7 +734,7 @@ FUNCTION hbide_parseFNfromStatusMsg( cText, cFileName, nLine, lValidText ) ELSE nPos := hb_At( ':', cText ) ENDIF - IF nPos <> 00 + IF nPos != 0 cFileName := SubStr( cText, 1, nPos - 1 ) ENDIF ENDIF @@ -746,7 +746,7 @@ FUNCTION hbide_parseFNfromStatusMsg( cText, cFileName, nLine, lValidText ) cFileName := strtran( cFileName, "\\", "/" ) cFileName := strtran( cFileName, "\" , "/" ) - IF ( nPos := Rat( ' ', cFileName ) ) <> 00 + IF ( nPos := Rat( ' ', cFileName ) ) != 0 cFileName := SubStr( cFileName, nPos + 1 ) ENDIF @@ -756,7 +756,7 @@ FUNCTION hbide_parseFNfromStatusMsg( cText, cFileName, nLine, lValidText ) nPos := hb_At( ':', cFileName ) ENDIF - IF nPos <> 00 + IF nPos != 0 cFileName := SubStr( cFileName, 1, nPos - 1 ) ENDIF @@ -943,7 +943,7 @@ function hbide_toString( x, lLineFeed, lInherited, lType, cFile, lForceLineFeed FOR i := 1 TO j s += iif( valtype( x[i] ) == "A", " ", " " ) + iif( lForceLineFeed, " ", "" ) + hbide_toString( x[i], .F. ) - s += iif( i <> j, ",", "" ) + s += iif( i != j, ",", "" ) IF lLineFeed IF !lInherited .and. ( valtype( x[i] ) == "A" .or. lForceLineFeed ) s += hb_eol() @@ -1038,7 +1038,7 @@ FUNCTION hbide_getUniqueFuncName() t := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' n := len( t ) b := '' - WHILE Len( b ) <> 10 + DO WHILE Len( b ) != 10 c := Substr( t, HB_RANDOMINT( 1, n ), 1 ) IF !( c $ b ) @@ -1047,7 +1047,7 @@ FUNCTION hbide_getUniqueFuncName() ENDIF b += c ENDIF - End + ENDDO b += '( ' RETURN b @@ -2054,5 +2054,3 @@ FUNCTION hbide_setAdsAvailable( lYes ) RETURN yes /*----------------------------------------------------------------------*/ - - diff --git a/harbour/contrib/hbxbp/xbpbrowse.prg b/harbour/contrib/hbxbp/xbpbrowse.prg index 9f692b24e0..17d36e2d0d 100644 --- a/harbour/contrib/hbxbp/xbpbrowse.prg +++ b/harbour/contrib/hbxbp/xbpbrowse.prg @@ -1023,7 +1023,7 @@ METHOD XbpBrowse:manageScrollContents( nX, nY ) HB_SYMBOL_UNUSED( nY ) - IF nX <> 0 + IF nX != 0 ::setHorzOffset() ENDIF diff --git a/harbour/contrib/hbxbp/xbpcheckbox.prg b/harbour/contrib/hbxbp/xbpcheckbox.prg index 6c10c209aa..c9c0b5587a 100644 --- a/harbour/contrib/hbxbp/xbpcheckbox.prg +++ b/harbour/contrib/hbxbp/xbpcheckbox.prg @@ -132,7 +132,7 @@ METHOD XbpCheckBox:execSlot( cSlot, p ) SWITCH cSlot CASE "stateChanged(int)" - ::sl_editBuffer := p <> 0 + ::sl_editBuffer := ( p != 0 ) ::selected( ::sl_editBuffer ) EXIT ENDSWITCH diff --git a/harbour/contrib/hbxbp/xbpdataref.prg b/harbour/contrib/hbxbp/xbpdataref.prg index adec107c6e..9bde2624ef 100644 --- a/harbour/contrib/hbxbp/xbpdataref.prg +++ b/harbour/contrib/hbxbp/xbpdataref.prg @@ -145,7 +145,7 @@ METHOD DataRef:setData( xValue, mp2 ) IF hb_isBlock( ::dataLink ) ::sl_editBuffer := eval( ::dataLink, xValue ) - ELSEIF xValue <> NIL + ELSEIF xValue != NIL ::sl_editBuffer := xValue ENDIF @@ -164,7 +164,7 @@ METHOD DataRef:setData( xValue, mp2 ) RETURN .f. CASE cClass == "XBPTREEVIEW" - IF ::sl_editBuffer <> NIL .and. ::sl_editBuffer:hItem <> NIL + IF ::sl_editBuffer != NIL .and. ::sl_editBuffer:hItem != NIL //Win_TreeView_SelectItem( ::hWnd, ::sl_editBuffer:hItem ) ENDIF @@ -225,4 +225,3 @@ METHOD DataRef:editBuffer( xData ) RETURN ::sl_editBuffer /*----------------------------------------------------------------------*/ - diff --git a/harbour/contrib/hbxbp/xbpfontdialog.prg b/harbour/contrib/hbxbp/xbpfontdialog.prg index f5ce895c4f..405ce85331 100644 --- a/harbour/contrib/hbxbp/xbpfontdialog.prg +++ b/harbour/contrib/hbxbp/xbpfontdialog.prg @@ -543,12 +543,12 @@ METHOD XbpFont:list() METHOD XbpFont:createFont() LOCAL aFont := {} - IF ::hFont <> NIL + IF ::hFont != NIL // Win_DeleteObject( ::hFont ) ::hFont := NIL ENDIF - IF ::oPS <> NIL + IF ::oPS != NIL //::height := xbp_PointSizeToHeight( ::oPS:hdc, ::nominalPointSize ) ENDIF diff --git a/harbour/contrib/hbxbp/xbpparthandler.prg b/harbour/contrib/hbxbp/xbpparthandler.prg index 17a0d6a6c1..3b3262841c 100644 --- a/harbour/contrib/hbxbp/xbpparthandler.prg +++ b/harbour/contrib/hbxbp/xbpparthandler.prg @@ -222,11 +222,11 @@ METHOD XbpPartHandler:childFromName( nNameId ) FOR EACH oXbp IN ::aChildren - IF oXbp:nNameID <> NIL .AND. oXbp:nNameID == nNameID + IF oXbp:nNameID != NIL .AND. oXbp:nNameID == nNameID RETURN oXbp ELSE FOR EACH oXbpC IN oXbp:aChildren - IF oXbpC:nNameID <> NIL .AND. oXbpC:nNameID == nNameID + IF oXbpC:nNameID != NIL .AND. oXbpC:nNameID == nNameID RETURN oXbpC ENDIF NEXT @@ -339,4 +339,3 @@ METHOD XbpPartHandler:moveOwned( nOffSetX, nOffSetY ) RETURN Self /*----------------------------------------------------------------------*/ - diff --git a/harbour/contrib/hbxbp/xbpstatusbar.prg b/harbour/contrib/hbxbp/xbpstatusbar.prg index 39612fa428..cc8dadae5b 100644 --- a/harbour/contrib/hbxbp/xbpstatusbar.prg +++ b/harbour/contrib/hbxbp/xbpstatusbar.prg @@ -346,7 +346,7 @@ METHOD XbpStatusBarPanel:caption( cCaption ) ::sl_caption := cCaption - IF ::oWidget <> NIL + IF ::oWidget != NIL ::oWidget:setText( cCaption ) ELSE ::oParent:oWidget:showMessage( cCaption ) diff --git a/harbour/contrib/hbxbp/xbptreeview.prg b/harbour/contrib/hbxbp/xbptreeview.prg index c4e2742896..7914c41340 100644 --- a/harbour/contrib/hbxbp/xbptreeview.prg +++ b/harbour/contrib/hbxbp/xbptreeview.prg @@ -406,16 +406,16 @@ METHOD XbpTreeViewItem:addItem( xItem, xNormalImage, xMarkedImage, xExpandedImag oItem:oParent := self oItem:oXbpTree := oItem:oParent:oXbpTree - IF xNormalImage <> NIL + IF xNormalImage != NIL oItem:image := xNormalImage ENDIF - IF xMarkedImage <> NIL + IF xMarkedImage != NIL oItem:markedImage := xMarkedImage ENDIF - IF xExpandedImage <> NIL + IF xExpandedImage != NIL oItem:expandedImage := xExpandedImage ENDIF - IF xValue <> NIL + IF xValue != NIL oItem:xValue := xValue ENDIF diff --git a/harbour/src/rtl/net.c b/harbour/src/rtl/net.c index 4f79670b20..af9c5dda07 100644 --- a/harbour/src/rtl/net.c +++ b/harbour/src/rtl/net.c @@ -195,7 +195,7 @@ char * hb_username( void ) return hb_getenv( "USER" ); # else struct passwd * pwd = getpwuid( getuid() ); - return pwd ? hb_strdup( pwd->pw_name ) : hb_getenv( "USER" ); + return pwd && pwd->pw_name ? hb_strdup( pwd->pw_name ) : hb_getenv( "USER" ); # endif #elif defined( HB_OS_WIN )