@matheusbsbs / matheus-bagliano / commits / 2ed49d5424
Fork 0

[PATCH] gitk: put braces around exprs

This braces all exprs. It just seemed to be a few that were missed. Signed-off-by: Paul Mackerras <paulus@samba.org>

Jeff Hobbs committed Nov 22, 2005 at 17:39 UTC 2ed49d542470e265cbebbe1eb8083f61a512c680
1 file changed +42 -41
gitk
+42 -41
@@ -30,7 +30,7 @@ proc getcommits {rargs} {
30 set commits {}
31 set phase getcommits
32 set startmsecs [clock clicks -milliseconds]
33 - set nextupdate [expr $startmsecs + 100]
33 + set nextupdate [expr {$startmsecs + 100}]
34 set ncmupdate 1
35 if [catch {
36 set parse_args [concat --default HEAD $rargs]
@@ -74,9 +74,9 @@ proc getcommitlines {commfd} {
74 }
75 if {[string range $err 0 4] == "usage"} {
76 set err \
77 -{Gitk: error reading commits: bad arguments to git-rev-list.
78 -(Note: arguments to gitk are passed to git-rev-list
79 -to allow selection of commits to be displayed.)}
77 + "Gitk: error reading commits: bad arguments to git-rev-list.\
78 + (Note: arguments to gitk are passed to git-rev-list\
79 + to allow selection of commits to be displayed.)"
80 } else {
81 set err "Error reading commits: $err"
82 }
@@ -310,10 +310,10 @@ proc makewindow {} {
310 . configure -menu .bar
311
312 if {![info exists geometry(canv1)]} {
313 - set geometry(canv1) [expr 45 * $charspc]
314 - set geometry(canv2) [expr 30 * $charspc]
315 - set geometry(canv3) [expr 15 * $charspc]
316 - set geometry(canvh) [expr 25 * $linespc + 4]
313 + set geometry(canv1) [expr {45 * $charspc}]
314 + set geometry(canv2) [expr {30 * $charspc}]
315 + set geometry(canv3) [expr {15 * $charspc}]
316 + set geometry(canvh) [expr {25 * $linespc + 4}]
317 set geometry(ctextw) 80
318 set geometry(ctexth) 30
319 set geometry(cflistw) 30
@@ -548,10 +548,10 @@ proc savestuff {w} {
548 puts $f [list set maxwidth $maxwidth]
549 puts $f "set geometry(width) [winfo width .ctop]"
550 puts $f "set geometry(height) [winfo height .ctop]"
551 - puts $f "set geometry(canv1) [expr [winfo width $canv]-2]"
552 - puts $f "set geometry(canv2) [expr [winfo width $canv2]-2]"
553 - puts $f "set geometry(canv3) [expr [winfo width $canv3]-2]"
554 - puts $f "set geometry(canvh) [expr [winfo height $canv]-2]"
551 + puts $f "set geometry(canv1) [expr {[winfo width $canv]-2}]"
552 + puts $f "set geometry(canv2) [expr {[winfo width $canv2]-2}]"
553 + puts $f "set geometry(canv3) [expr {[winfo width $canv3]-2}]"
554 + puts $f "set geometry(canvh) [expr {[winfo height $canv]-2}]"
555 set wid [expr {([winfo width $ctext] - 8) \
556 / [font measure $textfont "0"]}]
557 puts $f "set geometry(ctextw) $wid"
@@ -580,12 +580,12 @@ proc resizeclistpanes {win w} {
580 set sash0 30
581 }
582 if {$sash1 < $sash0 + 20} {
583 - set sash1 [expr $sash0 + 20]
583 + set sash1 [expr {$sash0 + 20}]
584 }
585 if {$sash1 > $w - 10} {
586 - set sash1 [expr $w - 10]
586 + set sash1 [expr {$w - 10}]
587 if {$sash0 > $sash1 - 20} {
588 - set sash0 [expr $sash1 - 20]
588 + set sash0 [expr {$sash1 - 20}]
589 }
590 }
591 }
@@ -608,7 +608,7 @@ proc resizecdetpanes {win w} {
608 set sash0 45
609 }
610 if {$sash0 > $w - 15} {
611 - set sash0 [expr $w - 15]
611 + set sash0 [expr {$w - 15}]
612 }
613 }
614 $win sash place 0 $sash0 [lindex $s0 1]
@@ -819,9 +819,9 @@ proc drawcommitline {level} {
819 }
820 set x [xcoord $level $level $lineno]
821 set y1 $canvy
822 - set canvy [expr $canvy + $linespc]
822 + set canvy [expr {$canvy + $linespc}]
823 allcanvs conf -scrollregion \
824 - [list 0 0 0 [expr $y1 + 0.5 * $linespc + 2]]
824 + [list 0 0 0 [expr {$y1 + 0.5 * $linespc + 2}]]
825 if {[info exists mainline($id)]} {
826 lappend mainline($id) $x $y1
827 if {$mainlinearrow($id) ne "none"} {
@@ -830,8 +830,8 @@ proc drawcommitline {level} {
830 }
831 drawlines $id 0 0
832 set orad [expr {$linespc / 3}]
833 - set t [$canv create oval [expr $x - $orad] [expr $y1 - $orad] \
834 - [expr $x + $orad - 1] [expr $y1 + $orad - 1] \
833 + set t [$canv create oval [expr {$x - $orad}] [expr {$y1 - $orad}] \
834 + [expr {$x + $orad - 1}] [expr {$y1 + $orad - 1}] \
835 -fill $ofill -outline black -width 1]
836 $canv raise $t
837 $canv bind $t <1> {selcanvline {} %x %y}
@@ -886,8 +886,8 @@ proc drawtags {id x xt y1} {
886 }
887
888 set delta [expr {int(0.5 * ($linespc - $lthickness))}]
889 - set yt [expr $y1 - 0.5 * $linespc]
890 - set yb [expr $yt + $linespc - 1]
889 + set yt [expr {$y1 - 0.5 * $linespc}]
890 + set yb [expr {$yt + $linespc - 1}]
891 set xvals {}
892 set wvals {}
893 foreach tag $marks {
@@ -900,12 +900,12 @@ proc drawtags {id x xt y1} {
900 -width $lthickness -fill black -tags tag.$id]
901 $canv lower $t
902 foreach tag $marks x $xvals wid $wvals {
903 - set xl [expr $x + $delta]
904 - set xr [expr $x + $delta + $wid + $lthickness]
903 + set xl [expr {$x + $delta}]
904 + set xr [expr {$x + $delta + $wid + $lthickness}]
905 if {[incr ntags -1] >= 0} {
906 # draw a tag
907 - set t [$canv create polygon $x [expr $yt + $delta] $xl $yt \
908 - $xr $yt $xr $yb $xl $yb $x [expr $yb - $delta] \
907 + set t [$canv create polygon $x [expr {$yt + $delta}] $xl $yt \
908 + $xr $yt $xr $yb $xl $yb $x [expr {$yb - $delta}] \
909 -width 1 -outline black -fill yellow -tags tag.$id]
910 $canv bind $t <1> [list showtag $tag 1]
911 set rowtextx($idline($id)) [expr {$xr + $linespc}]
@@ -916,7 +916,7 @@ proc drawtags {id x xt y1} {
916 } else {
917 set col "#ddddff"
918 }
919 - set xl [expr $xl - $delta/2]
919 + set xl [expr {$xl - $delta/2}]
920 $canv create polygon $x $yt $xr $yt $xr $yb $x $yb \
921 -width 1 -outline black -fill $col -tags tag.$id
922 }
@@ -1491,7 +1491,7 @@ proc drawgraph {} {
1491
1492 if {$displayorder == {}} return
1493 set startmsecs [clock clicks -milliseconds]
1494 - set nextupdate [expr $startmsecs + 100]
1494 + set nextupdate [expr {$startmsecs + 100}]
1495 set ncmupdate 1
1496 initgraph
1497 foreach id $displayorder {
@@ -1520,7 +1520,7 @@ proc drawrest {} {
1520 }
1521 drawmore 0
1522 set phase {}
1523 - set drawmsecs [expr [clock clicks -milliseconds] - $startmsecs]
1523 + set drawmsecs [expr {[clock clicks -milliseconds] - $startmsecs}]
1524 #puts "overall $drawmsecs ms for $numcommits commits"
1525 if {$redisplaying} {
1526 if {$stopped == 0 && [info exists selectedline]} {
@@ -1548,8 +1548,8 @@ proc findmatches {f} {
1548 set matches {}
1549 set i 0
1550 while {[set j [string first $foundstring $str $i]] >= 0} {
1551 - lappend matches [list $j [expr $j+$foundstrlen-1]]
1552 - set i [expr $j + $foundstrlen]
1551 + lappend matches [list $j [expr {$j+$foundstrlen-1}]]
1552 + set i [expr {$j + $foundstrlen}]
1553 }
1554 }
1555 return $matches
@@ -1630,7 +1630,7 @@ proc findselectline {l} {
1630 set matches [findmatches $f]
1631 foreach match $matches {
1632 set start [lindex $match 0]
1633 - set end [expr [lindex $match 1] + 1]
1633 + set end [expr {[lindex $match 1] + 1}]
1634 $ctext tag add found "1.0 + $start c" "1.0 + $end c"
1635 }
1636 }
@@ -1984,9 +1984,10 @@ proc markmatches {canv l str tag matches font} {
1984 set start [lindex $match 0]
1985 set end [lindex $match 1]
1986 if {$start > $end} continue
1987 - set xoff [font measure $font [string range $str 0 [expr $start-1]]]
1988 - set xlen [font measure $font [string range $str 0 [expr $end]]]
1989 - set t [$canv create rect [expr $x0+$xoff] $y0 [expr $x0+$xlen+2] $y1 \
1987 + set xoff [font measure $font [string range $str 0 [expr {$start-1}]]]
1988 + set xlen [font measure $font [string range $str 0 [expr {$end}]]]
1989 + set t [$canv create rect [expr {$x0+$xoff}] $y0 \
1990 + [expr {$x0+$xlen+2}] $y1 \
1991 -outline {} -tags matches -fill yellow]
1992 $canv lower $t
1993 }
@@ -2078,8 +2079,8 @@ proc selectline {l isnew} {
2079 set ytop [expr {$y - $linespc - 1}]
2080 set ybot [expr {$y + $linespc + 1}]
2081 set wnow [$canv yview]
2081 - set wtop [expr [lindex $wnow 0] * $ymax]
2082 - set wbot [expr [lindex $wnow 1] * $ymax]
2082 + set wtop [expr {[lindex $wnow 0] * $ymax}]
2083 + set wbot [expr {[lindex $wnow 1] * $ymax}]
2084 set wh [expr {$wbot - $wtop}]
2085 set newtop $wtop
2086 if {$ytop < $wtop} {
@@ -2105,7 +2106,7 @@ proc selectline {l isnew} {
2106 if {$newtop < 0} {
2107 set newtop 0
2108 }
2108 - allcanvs yview moveto [expr $newtop * 1.0 / $ymax]
2109 + allcanvs yview moveto [expr {$newtop * 1.0 / $ymax}]
2110 }
2111
2112 if {$isnew} {
@@ -2173,7 +2174,7 @@ proc selectline {l isnew} {
2174 proc selnextline {dir} {
2175 global selectedline
2176 if {![info exists selectedline]} return
2176 - set l [expr $selectedline + $dir]
2177 + set l [expr {$selectedline + $dir}]
2178 unmarkmatches
2179 selectline $l 1
2180 }
@@ -2966,8 +2967,8 @@ proc setcoords {} {
2967
2968 set linespc [font metrics $mainfont -linespace]
2969 set charspc [font measure $mainfont "m"]
2969 - set canvy0 [expr 3 + 0.5 * $linespc]
2970 - set canvx0 [expr 3 + 0.5 * $linespc]
2970 + set canvy0 [expr {3 + 0.5 * $linespc}]
2971 + set canvx0 [expr {3 + 0.5 * $linespc}]
2972 set lthickness [expr {int($linespc / 9) + 1}]
2973 set xspc1(0) $linespc
2974 set xspc2 $linespc