Skip to content

Commit

Permalink
prevent underflow
Browse files Browse the repository at this point in the history
  • Loading branch information
wagoodman committed Jun 1, 2018
1 parent 71b36ea commit 563d4b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions filetree.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ func (tree *FileTree) MarkRemoved(path string) error {
return node.AssignDiffType(Removed)
}

func StackRange(trees []*FileTree, index int) *FileTree {
func StackRange(trees []*FileTree, index uint) *FileTree {
tree := trees[0].Copy()
for idx := 1; idx < index; idx++ {
for idx := uint(1); idx < index; idx++ {
tree.Stack(trees[idx])
}
return tree
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ var data struct {
tree *FileTree
refTrees []*FileTree
manifest *Manifest
absDFSTreeIndex int
layerIndex int
absDFSTreeIndex uint
layerIndex uint
}

func check(e error) {
Expand Down Expand Up @@ -118,7 +118,7 @@ func demo() {
func getAbsPositionNode() (node *FileNode) {
var visiter func(*FileNode) error
var evaluator func(*FileNode) bool
var dfsCounter int
var dfsCounter uint

visiter = func(curNode *FileNode) error {
if dfsCounter == data.absDFSTreeIndex {
Expand Down

0 comments on commit 563d4b3

Please sign in to comment.