Skip to content

Commit fb2a1a0

Browse files
committed
0 warning
1 parent 5ce8ce9 commit fb2a1a0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

include/suffix_tree.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class SuffixTree
2121
{
2222
public:
2323
// active point is initialized as (root, None, 0), remainder initialized as 1
24-
SuffixTree(string str):test_str(str), pos(0), root(test_str), active_point(&root, 0, 0), remainder(0), ls() {}
24+
SuffixTree(string str):test_str(str), root(test_str), active_point(&root, 0, 0), remainder(0), pos(0), ls() {}
2525
int construct(void);
2626

2727
// return -1 if no such sub exist, return the beginning postion of this substring in thr original string if it exist
@@ -82,13 +82,13 @@ class SuffixTree
8282

8383
struct Edge{
8484
// the begin and end pos of this edge, note that INT_MAX stands for #(the changing end pos of this entire string)
85-
int begin, end;
85+
unsigned int begin, end;
8686
// Is there a better way to find test_str?
8787
string& test_node_str;
8888

8989
Node * endpoint;
9090

91-
Edge(int b, int e, string& str):
91+
Edge(unsigned int b, unsigned int e, string& str):
9292
test_node_str(str)
9393
{
9494
begin = b;
@@ -97,7 +97,7 @@ class SuffixTree
9797
//std::cout << "Edge initialized" << std::endl;
9898
}
9999

100-
void change_edge(int b, int e)
100+
void change_edge(unsigned int b, unsigned int e)
101101
{
102102
begin = b;
103103
end = e;
@@ -118,7 +118,7 @@ class SuffixTree
118118
return me.begin < other.begin;
119119
}
120120

121-
char operator[](int i)
121+
char operator[](unsigned int i)
122122
{
123123
i += begin;
124124
if (i > end)
@@ -129,12 +129,12 @@ class SuffixTree
129129

130130
friend ostream& operator<<(ostream& os, Edge& edge)
131131
{
132-
int end = edge.test_node_str.size()-1;
132+
unsigned int end = edge.test_node_str.size()-1;
133133
if (end >= edge.end)
134134
end = edge.end;
135135

136136
char c;
137-
for (int i=edge.begin; i<=end; i++) {
137+
for (unsigned int i=edge.begin; i<=end; i++) {
138138
c = edge.test_node_str[i];
139139
os << c;
140140
}
@@ -246,7 +246,7 @@ class SuffixTree
246246
// how many suffixes is to be inserted?
247247
int remainder;
248248
// how many characters inserted?
249-
int pos;
249+
unsigned int pos;
250250
char get_ele(int i) { return test_str[i]; }
251251
// insert a char from pos to suffix tree
252252
int insert();

0 commit comments

Comments
 (0)