Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
0ab8692b
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0ab8692b
编写于
2月 05, 2016
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
re2: fixed warnings [#METR-17973].
上级
80284a4a
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
66 addition
and
61 deletion
+66
-61
contrib/libre2/re2/compile.cc
contrib/libre2/re2/compile.cc
+2
-2
contrib/libre2/re2/dfa.cc
contrib/libre2/re2/dfa.cc
+3
-3
contrib/libre2/re2/filtered_re2.cc
contrib/libre2/re2/filtered_re2.cc
+5
-5
contrib/libre2/re2/parse.cc
contrib/libre2/re2/parse.cc
+9
-9
contrib/libre2/re2/prefilter.cc
contrib/libre2/re2/prefilter.cc
+5
-5
contrib/libre2/re2/prefilter_tree.cc
contrib/libre2/re2/prefilter_tree.cc
+18
-18
contrib/libre2/re2/re2.cc
contrib/libre2/re2/re2.cc
+4
-4
contrib/libre2/re2/regexp.cc
contrib/libre2/re2/regexp.cc
+2
-2
contrib/libre2/re2/set.cc
contrib/libre2/re2/set.cc
+1
-1
contrib/libre2/util/arena.cc
contrib/libre2/util/arena.cc
+2
-2
contrib/libre2/util/pcre.cc
contrib/libre2/util/pcre.cc
+7
-2
contrib/libre2/util/sparse_array.h
contrib/libre2/util/sparse_array.h
+3
-3
contrib/libre2/util/sparse_set.h
contrib/libre2/util/sparse_set.h
+2
-2
contrib/libre2/util/stringpiece.cc
contrib/libre2/util/stringpiece.cc
+2
-2
contrib/libre2/util/stringprintf.cc
contrib/libre2/util/stringprintf.cc
+1
-1
未找到文件。
contrib/libre2/re2/compile.cc
浏览文件 @
0ab8692b
...
...
@@ -591,7 +591,7 @@ static struct ByteRangeProg {
void
Compiler
::
Add_80_10ffff
()
{
int
inst
[
arraysize
(
prog_80_10ffff
)]
=
{
0
};
// does not need to be initialized; silences gcc warning
for
(
in
t
i
=
0
;
i
<
arraysize
(
prog_80_10ffff
);
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
arraysize
(
prog_80_10ffff
);
i
++
)
{
const
ByteRangeProg
&
p
=
prog_80_10ffff
[
i
];
int
next
=
0
;
if
(
p
.
next
>=
0
)
...
...
@@ -958,7 +958,7 @@ void Compiler::Setup(Regexp::ParseFlags flags, int64 max_mem,
max_mem_
=
max_mem
;
if
(
max_mem
<=
0
)
{
max_inst_
=
100000
;
// more than enough
}
else
if
(
max_mem
<=
s
izeof
(
Prog
))
{
}
else
if
(
max_mem
<=
s
tatic_cast
<
int64
>
(
sizeof
(
Prog
)
))
{
// No room for anything.
max_inst_
=
0
;
}
else
{
...
...
contrib/libre2/re2/dfa.cc
浏览文件 @
0ab8692b
...
...
@@ -787,7 +787,7 @@ void DFA::ClearCache() {
it
!=
state_cache_
.
end
();
++
it
)
v
.
push_back
(
*
it
);
state_cache_
.
clear
();
for
(
in
t
i
=
0
;
i
<
v
.
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
v
.
size
();
i
++
)
delete
[]
reinterpret_cast
<
const
char
*>
(
v
[
i
]);
}
...
...
@@ -1394,7 +1394,7 @@ inline bool DFA::InlinedSearchLoop(SearchParams* params,
// of 10 bytes per state computation, fail so that RE2 can
// fall back to the NFA.
if
(
FLAGS_re2_dfa_bail_when_slow
&&
resetp
!=
NULL
&&
(
p
-
resetp
)
<
10
*
state_cache_
.
size
(
))
{
(
p
-
resetp
)
<
static_cast
<
ptrdiff_t
>
(
10
*
state_cache_
.
size
()
))
{
params
->
failed
=
true
;
return
false
;
}
...
...
@@ -1932,7 +1932,7 @@ int DFA::BuildAllStates() {
q
.
push_back
(
params
.
start
);
// Flood to expand every state.
for
(
in
t
i
=
0
;
i
<
q
.
size
();
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
q
.
size
();
i
++
)
{
State
*
s
=
q
[
i
];
for
(
int
c
=
0
;
c
<
257
;
c
++
)
{
State
*
ns
=
RunStateOnByteUnlocked
(
s
,
c
);
...
...
contrib/libre2/re2/filtered_re2.cc
浏览文件 @
0ab8692b
...
...
@@ -16,7 +16,7 @@ FilteredRE2::FilteredRE2()
}
FilteredRE2
::~
FilteredRE2
()
{
for
(
in
t
i
=
0
;
i
<
re2_vec_
.
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
re2_vec_
.
size
();
i
++
)
delete
re2_vec_
[
i
];
delete
prefilter_tree_
;
}
...
...
@@ -46,7 +46,7 @@ void FilteredRE2::Compile(vector<string>* atoms) {
return
;
}
for
(
in
t
i
=
0
;
i
<
re2_vec_
.
size
();
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
re2_vec_
.
size
();
i
++
)
{
Prefilter
*
prefilter
=
Prefilter
::
FromRE2
(
re2_vec_
[
i
]);
prefilter_tree_
->
Add
(
prefilter
);
}
...
...
@@ -56,7 +56,7 @@ void FilteredRE2::Compile(vector<string>* atoms) {
}
int
FilteredRE2
::
SlowFirstMatch
(
const
StringPiece
&
text
)
const
{
for
(
in
t
i
=
0
;
i
<
re2_vec_
.
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
re2_vec_
.
size
();
i
++
)
if
(
RE2
::
PartialMatch
(
text
,
*
re2_vec_
[
i
]))
return
i
;
return
-
1
;
...
...
@@ -70,7 +70,7 @@ int FilteredRE2::FirstMatch(const StringPiece& text,
}
vector
<
int
>
regexps
;
prefilter_tree_
->
RegexpsGivenStrings
(
atoms
,
&
regexps
);
for
(
in
t
i
=
0
;
i
<
regexps
.
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
regexps
.
size
();
i
++
)
if
(
RE2
::
PartialMatch
(
text
,
*
re2_vec_
[
regexps
[
i
]]))
return
regexps
[
i
];
return
-
1
;
...
...
@@ -83,7 +83,7 @@ bool FilteredRE2::AllMatches(
matching_regexps
->
clear
();
vector
<
int
>
regexps
;
prefilter_tree_
->
RegexpsGivenStrings
(
atoms
,
&
regexps
);
for
(
in
t
i
=
0
;
i
<
regexps
.
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
regexps
.
size
();
i
++
)
if
(
RE2
::
PartialMatch
(
text
,
*
re2_vec_
[
regexps
[
i
]]))
matching_regexps
->
push_back
(
regexps
[
i
]);
return
!
matching_regexps
->
empty
();
...
...
contrib/libre2/re2/parse.cc
浏览文件 @
0ab8692b
...
...
@@ -246,9 +246,9 @@ const CaseFold* LookupCaseFold(const CaseFold *f, int n, Rune r) {
// Binary search for entry containing r.
while
(
n
>
0
)
{
int
m
=
n
/
2
;
if
(
f
[
m
].
lo
<=
r
&&
r
<=
f
[
m
].
hi
)
if
(
static_cast
<
Rune
>
(
f
[
m
].
lo
)
<=
r
&&
r
<=
static_cast
<
Rune
>
(
f
[
m
].
hi
)
)
return
&
f
[
m
];
if
(
r
<
f
[
m
].
lo
)
{
if
(
r
<
static_cast
<
Rune
>
(
f
[
m
].
lo
)
)
{
n
=
m
;
}
else
{
f
+=
m
+
1
;
...
...
@@ -305,7 +305,7 @@ Rune ApplyFold(const CaseFold *f, Rune r) {
// CycleFoldRune('?') = '?'
Rune
CycleFoldRune
(
Rune
r
)
{
const
CaseFold
*
f
=
LookupCaseFold
(
unicode_casefold
,
num_unicode_casefold
,
r
);
if
(
f
==
NULL
||
r
<
f
->
lo
)
if
(
f
==
NULL
||
r
<
static_cast
<
Rune
>
(
f
->
lo
)
)
return
r
;
return
ApplyFold
(
f
,
r
);
}
...
...
@@ -330,7 +330,7 @@ static void AddFoldedRange(CharClassBuilder* cc, Rune lo, Rune hi, int depth) {
const
CaseFold
*
f
=
LookupCaseFold
(
unicode_casefold
,
num_unicode_casefold
,
lo
);
if
(
f
==
NULL
)
// lo has no fold, nor does anything above lo
break
;
if
(
lo
<
f
->
lo
)
{
// lo has no fold; next rune with a fold is f->lo
if
(
lo
<
static_cast
<
Rune
>
(
f
->
lo
)
)
{
// lo has no fold; next rune with a fold is f->lo
lo
=
f
->
lo
;
continue
;
}
...
...
@@ -716,7 +716,7 @@ void Regexp::RemoveLeadingString(Regexp* re, int n) {
Regexp
*
stk
[
4
];
int
d
=
0
;
while
(
re
->
op
()
==
kRegexpConcat
)
{
if
(
d
<
arraysize
(
stk
))
if
(
static_cast
<
size_t
>
(
d
)
<
arraysize
(
stk
))
stk
[
d
++
]
=
re
;
re
=
re
->
sub
()[
0
];
}
...
...
@@ -1468,12 +1468,12 @@ static void AddUGroup(CharClassBuilder *cc, const UGroup *g, int sign,
}
int
next
=
0
;
for
(
int
i
=
0
;
i
<
g
->
nr16
;
i
++
)
{
if
(
next
<
g
->
r16
[
i
].
lo
)
if
(
next
<
static_cast
<
Rune
>
(
g
->
r16
[
i
].
lo
)
)
cc
->
AddRangeFlags
(
next
,
g
->
r16
[
i
].
lo
-
1
,
parse_flags
);
next
=
g
->
r16
[
i
].
hi
+
1
;
}
for
(
int
i
=
0
;
i
<
g
->
nr32
;
i
++
)
{
if
(
next
<
g
->
r32
[
i
].
lo
)
if
(
next
<
static_cast
<
Rune
>
(
g
->
r32
[
i
].
lo
)
)
cc
->
AddRangeFlags
(
next
,
g
->
r32
[
i
].
lo
-
1
,
parse_flags
);
next
=
g
->
r32
[
i
].
hi
+
1
;
}
...
...
@@ -1540,7 +1540,7 @@ ParseStatus ParseUnicodeGroup(StringPiece* s, Regexp::ParseFlags parse_flags,
}
else
{
// Name is in braces. Look for closing }
int
end
=
s
->
find
(
'}'
,
0
);
if
(
end
==
s
->
npos
)
{
if
(
end
==
s
tatic_cast
<
int
>
(
s
->
npos
)
)
{
if
(
!
IsValidUTF8
(
seq
,
status
))
return
kParseError
;
status
->
set_code
(
kRegexpBadCharRange
);
...
...
@@ -1823,7 +1823,7 @@ bool Regexp::ParseState::ParsePerlFlags(StringPiece* s) {
if
(
t
.
size
()
>
2
&&
t
[
0
]
==
'P'
&&
t
[
1
]
==
'<'
)
{
// Pull out name.
int
end
=
t
.
find
(
'>'
,
2
);
if
(
end
==
t
.
npos
)
{
if
(
end
==
static_cast
<
int
>
(
t
.
npos
)
)
{
if
(
!
IsValidUTF8
(
*
s
,
status_
))
return
false
;
status_
->
set_code
(
kRegexpBadNamedCapture
);
...
...
contrib/libre2/re2/prefilter.cc
浏览文件 @
0ab8692b
...
...
@@ -31,7 +31,7 @@ Prefilter::Prefilter(Op op) {
Prefilter
::~
Prefilter
()
{
VLOG
(
10
)
<<
"Deleted: "
<<
alloc_id_
;
if
(
subs_
)
{
for
(
in
t
i
=
0
;
i
<
subs_
->
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
subs_
->
size
();
i
++
)
delete
(
*
subs_
)[
i
];
delete
subs_
;
subs_
=
NULL
;
...
...
@@ -100,7 +100,7 @@ Prefilter* Prefilter::AndOr(Op op, Prefilter* a, Prefilter* b) {
// If a and b match op, merge their contents.
if
(
a
->
op
()
==
op
&&
b
->
op
()
==
op
)
{
for
(
in
t
i
=
0
;
i
<
b
->
subs
()
->
size
();
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
b
->
subs
()
->
size
();
i
++
)
{
Prefilter
*
bb
=
(
*
b
->
subs
())[
i
];
a
->
subs
()
->
push_back
(
bb
);
}
...
...
@@ -176,7 +176,7 @@ static Rune ToLowerRune(Rune r) {
}
const
CaseFold
*
f
=
LookupCaseFold
(
unicode_tolower
,
num_unicode_tolower
,
r
);
if
(
f
==
NULL
||
r
<
f
->
lo
)
if
(
f
==
NULL
||
r
<
static_cast
<
Rune
>
(
f
->
lo
)
)
return
r
;
return
ApplyFold
(
f
,
r
);
}
...
...
@@ -669,7 +669,7 @@ string Prefilter::DebugString() const {
return
""
;
case
AND
:
{
string
s
=
""
;
for
(
in
t
i
=
0
;
i
<
subs_
->
size
();
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
subs_
->
size
();
i
++
)
{
if
(
i
>
0
)
s
+=
" "
;
Prefilter
*
sub
=
(
*
subs_
)[
i
];
...
...
@@ -679,7 +679,7 @@ string Prefilter::DebugString() const {
}
case
OR
:
{
string
s
=
"("
;
for
(
in
t
i
=
0
;
i
<
subs_
->
size
();
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
subs_
->
size
();
i
++
)
{
if
(
i
>
0
)
s
+=
"|"
;
Prefilter
*
sub
=
(
*
subs_
)[
i
];
...
...
contrib/libre2/re2/prefilter_tree.cc
浏览文件 @
0ab8692b
...
...
@@ -19,10 +19,10 @@ PrefilterTree::PrefilterTree()
}
PrefilterTree
::~
PrefilterTree
()
{
for
(
in
t
i
=
0
;
i
<
prefilter_vec_
.
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
prefilter_vec_
.
size
();
i
++
)
delete
prefilter_vec_
[
i
];
for
(
in
t
i
=
0
;
i
<
entries_
.
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
entries_
.
size
();
i
++
)
delete
entries_
[
i
].
parents
;
}
...
...
@@ -43,12 +43,12 @@ static bool KeepPart(Prefilter* prefilter, int level) {
case
Prefilter
::
ATOM
:
return
prefilter
->
atom
().
size
()
>=
FLAGS_filtered_re2_min_atom_len
;
static_cast
<
size_t
>
(
FLAGS_filtered_re2_min_atom_len
)
;
case
Prefilter
::
AND
:
{
int
j
=
0
;
vector
<
Prefilter
*>*
subs
=
prefilter
->
subs
();
for
(
in
t
i
=
0
;
i
<
subs
->
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
subs
->
size
();
i
++
)
if
(
KeepPart
((
*
subs
)[
i
],
level
+
1
))
(
*
subs
)[
j
++
]
=
(
*
subs
)[
i
];
else
...
...
@@ -59,7 +59,7 @@ static bool KeepPart(Prefilter* prefilter, int level) {
}
case
Prefilter
::
OR
:
for
(
in
t
i
=
0
;
i
<
prefilter
->
subs
()
->
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
prefilter
->
subs
()
->
size
();
i
++
)
if
(
!
KeepPart
((
*
prefilter
->
subs
())[
i
],
level
+
1
))
return
false
;
return
true
;
...
...
@@ -101,7 +101,7 @@ void PrefilterTree::Compile(vector<string>* atom_vec) {
// no longer necessary for their parent to trigger; that is, we do
// not miss out on any regexps triggering by getting rid of a
// prefilter node.
for
(
in
t
i
=
0
;
i
<
entries_
.
size
();
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
entries_
.
size
();
i
++
)
{
StdIntMap
*
parents
=
entries_
[
i
].
parents
;
if
(
parents
->
size
()
>
8
)
{
// This one triggers too many things. If all the parents are AND
...
...
@@ -146,7 +146,7 @@ string PrefilterTree::NodeString(Prefilter* node) const {
if
(
node
->
op
()
==
Prefilter
::
ATOM
)
{
s
+=
node
->
atom
();
}
else
{
for
(
in
t
i
=
0
;
i
<
node
->
subs
()
->
size
()
;
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
node
->
subs
()
->
size
()
;
i
++
)
{
if
(
i
>
0
)
s
+=
','
;
s
+=
Itoa
((
*
node
->
subs
())[
i
]
->
unique_id
());
...
...
@@ -163,7 +163,7 @@ void PrefilterTree::AssignUniqueIds(vector<string>* atom_vec) {
vector
<
Prefilter
*>
v
;
// Add the top level nodes of each regexp prefilter.
for
(
in
t
i
=
0
;
i
<
prefilter_vec_
.
size
();
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
prefilter_vec_
.
size
();
i
++
)
{
Prefilter
*
f
=
prefilter_vec_
[
i
];
if
(
f
==
NULL
)
unfiltered_
.
push_back
(
i
);
...
...
@@ -174,13 +174,13 @@ void PrefilterTree::AssignUniqueIds(vector<string>* atom_vec) {
}
// Now add all the descendant nodes.
for
(
in
t
i
=
0
;
i
<
v
.
size
();
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
v
.
size
();
i
++
)
{
Prefilter
*
f
=
v
[
i
];
if
(
f
==
NULL
)
continue
;
if
(
f
->
op
()
==
Prefilter
::
AND
||
f
->
op
()
==
Prefilter
::
OR
)
{
const
vector
<
Prefilter
*>&
subs
=
*
f
->
subs
();
for
(
in
t
j
=
0
;
j
<
subs
.
size
();
j
++
)
for
(
size_
t
j
=
0
;
j
<
subs
.
size
();
j
++
)
v
.
push_back
(
subs
[
j
]);
}
}
...
...
@@ -245,7 +245,7 @@ void PrefilterTree::AssignUniqueIds(vector<string>* atom_vec) {
case
Prefilter
::
OR
:
case
Prefilter
::
AND
:
{
set
<
int
>
uniq_child
;
for
(
in
t
j
=
0
;
j
<
prefilter
->
subs
()
->
size
()
;
j
++
)
{
for
(
size_
t
j
=
0
;
j
<
prefilter
->
subs
()
->
size
()
;
j
++
)
{
Prefilter
*
child
=
(
*
prefilter
->
subs
())[
j
];
Prefilter
*
canonical
=
CanonicalNode
(
child
);
if
(
canonical
==
NULL
)
{
...
...
@@ -268,7 +268,7 @@ void PrefilterTree::AssignUniqueIds(vector<string>* atom_vec) {
}
// For top level nodes, populate regexp id.
for
(
in
t
i
=
0
;
i
<
prefilter_vec_
.
size
();
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
prefilter_vec_
.
size
();
i
++
)
{
if
(
prefilter_vec_
[
i
]
==
NULL
)
continue
;
int
id
=
CanonicalNode
(
prefilter_vec_
[
i
])
->
unique_id
();
...
...
@@ -285,13 +285,13 @@ void PrefilterTree::RegexpsGivenStrings(
regexps
->
clear
();
if
(
!
compiled_
)
{
LOG
(
WARNING
)
<<
"Compile() not called"
;
for
(
in
t
i
=
0
;
i
<
prefilter_vec_
.
size
();
++
i
)
for
(
size_
t
i
=
0
;
i
<
prefilter_vec_
.
size
();
++
i
)
regexps
->
push_back
(
i
);
}
else
{
if
(
!
prefilter_vec_
.
empty
())
{
IntMap
regexps_map
(
prefilter_vec_
.
size
());
vector
<
int
>
matched_atom_ids
;
for
(
in
t
j
=
0
;
j
<
matched_atoms
.
size
();
j
++
)
{
for
(
size_
t
j
=
0
;
j
<
matched_atoms
.
size
();
j
++
)
{
matched_atom_ids
.
push_back
(
atom_index_to_id_
[
matched_atoms
[
j
]]);
VLOG
(
10
)
<<
"Atom id:"
<<
atom_index_to_id_
[
matched_atoms
[
j
]];
}
...
...
@@ -311,13 +311,13 @@ void PrefilterTree::PropagateMatch(const vector<int>& atom_ids,
IntMap
*
regexps
)
const
{
IntMap
count
(
entries_
.
size
());
IntMap
work
(
entries_
.
size
());
for
(
in
t
i
=
0
;
i
<
atom_ids
.
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
atom_ids
.
size
();
i
++
)
work
.
set
(
atom_ids
[
i
],
1
);
for
(
IntMap
::
iterator
it
=
work
.
begin
();
it
!=
work
.
end
();
++
it
)
{
const
Entry
&
entry
=
entries_
[
it
->
index
()];
VLOG
(
10
)
<<
"Processing: "
<<
it
->
index
();
// Record regexps triggered.
for
(
in
t
i
=
0
;
i
<
entry
.
regexps
.
size
();
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
entry
.
regexps
.
size
();
i
++
)
{
VLOG
(
10
)
<<
"Regexp triggered: "
<<
entry
.
regexps
[
i
];
regexps
->
set
(
entry
.
regexps
[
i
],
1
);
}
...
...
@@ -357,7 +357,7 @@ void PrefilterTree::PrintDebugInfo() {
VLOG
(
10
)
<<
"#Unique Atoms: "
<<
atom_index_to_id_
.
size
();
VLOG
(
10
)
<<
"#Unique Nodes: "
<<
entries_
.
size
();
for
(
in
t
i
=
0
;
i
<
entries_
.
size
();
++
i
)
{
for
(
size_
t
i
=
0
;
i
<
entries_
.
size
();
++
i
)
{
StdIntMap
*
parents
=
entries_
[
i
].
parents
;
const
vector
<
int
>&
regexps
=
entries_
[
i
].
regexps
;
VLOG
(
10
)
<<
"EntryId: "
<<
i
...
...
@@ -382,7 +382,7 @@ string PrefilterTree::DebugNodeString(Prefilter* node) const {
// Adding the operation disambiguates AND and OR nodes.
node_string
+=
node
->
op
()
==
Prefilter
::
AND
?
"AND"
:
"OR"
;
node_string
+=
"("
;
for
(
in
t
i
=
0
;
i
<
node
->
subs
()
->
size
()
;
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
node
->
subs
()
->
size
()
;
i
++
)
{
if
(
i
>
0
)
node_string
+=
','
;
node_string
+=
Itoa
((
*
node
->
subs
())[
i
]
->
unique_id
());
...
...
contrib/libre2/re2/re2.cc
浏览文件 @
0ab8692b
...
...
@@ -356,7 +356,7 @@ bool RE2::Replace(string *str,
const
StringPiece
&
rewrite
)
{
StringPiece
vec
[
kVecSize
];
int
nvec
=
1
+
MaxSubmatch
(
rewrite
);
if
(
nvec
>
arraysize
(
vec
))
if
(
static_cast
<
size_t
>
(
nvec
)
>
arraysize
(
vec
))
return
false
;
if
(
!
re
.
Match
(
*
str
,
0
,
str
->
size
(),
UNANCHORED
,
vec
,
nvec
))
return
false
;
...
...
@@ -376,7 +376,7 @@ int RE2::GlobalReplace(string *str,
const
StringPiece
&
rewrite
)
{
StringPiece
vec
[
kVecSize
];
int
nvec
=
1
+
MaxSubmatch
(
rewrite
);
if
(
nvec
>
arraysize
(
vec
))
if
(
static_cast
<
size_t
>
(
nvec
)
>
arraysize
(
vec
))
return
false
;
const
char
*
p
=
str
->
data
();
...
...
@@ -417,7 +417,7 @@ bool RE2::Extract(const StringPiece &text,
string
*
out
)
{
StringPiece
vec
[
kVecSize
];
int
nvec
=
1
+
MaxSubmatch
(
rewrite
);
if
(
nvec
>
arraysize
(
vec
))
if
(
static_cast
<
size_t
>
(
nvec
)
>
arraysize
(
vec
))
return
false
;
if
(
!
re
.
Match
(
text
,
0
,
text
.
size
(),
UNANCHORED
,
vec
,
nvec
))
...
...
@@ -807,7 +807,7 @@ bool RE2::DoMatch(const StringPiece& text,
StringPiece
stkvec
[
kVecSize
];
StringPiece
*
heapvec
=
NULL
;
if
(
nvec
<=
arraysize
(
stkvec
))
{
if
(
static_cast
<
size_t
>
(
nvec
)
<=
arraysize
(
stkvec
))
{
vec
=
stkvec
;
}
else
{
vec
=
new
StringPiece
[
nvec
];
...
...
contrib/libre2/re2/regexp.cc
浏览文件 @
0ab8692b
...
...
@@ -849,7 +849,7 @@ void CharClassBuilder::Negate() {
}
ranges_
.
clear
();
for
(
in
t
i
=
0
;
i
<
v
.
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
v
.
size
();
i
++
)
ranges_
.
insert
(
v
[
i
]);
upper_
=
AlphaMask
&
~
upper_
;
...
...
@@ -920,7 +920,7 @@ CharClass* CharClassBuilder::GetCharClass() {
for
(
iterator
it
=
begin
();
it
!=
end
();
++
it
)
cc
->
ranges_
[
n
++
]
=
*
it
;
cc
->
nranges_
=
n
;
DCHECK_LE
(
n
,
ranges_
.
size
(
));
DCHECK_LE
(
n
,
static_cast
<
int
>
(
ranges_
.
size
()
));
cc
->
nrunes_
=
nrunes_
;
cc
->
folds_ascii_
=
FoldsASCII
();
return
cc
;
...
...
contrib/libre2/re2/set.cc
浏览文件 @
0ab8692b
...
...
@@ -20,7 +20,7 @@ RE2::Set::Set(const RE2::Options& options, RE2::Anchor anchor) {
}
RE2
::
Set
::~
Set
()
{
for
(
in
t
i
=
0
;
i
<
re_
.
size
();
i
++
)
for
(
size_
t
i
=
0
;
i
<
re_
.
size
();
i
++
)
re_
[
i
]
->
Decref
();
delete
prog_
;
}
...
...
contrib/libre2/util/arena.cc
浏览文件 @
0ab8692b
...
...
@@ -71,7 +71,7 @@ void UnsafeArena::Reset() {
UnsafeArena
::
AllocatedBlock
*
UnsafeArena
::
AllocNewBlock
(
const
size_t
block_size
)
{
AllocatedBlock
*
block
;
// Find the next block.
if
(
blocks_alloced_
<
arraysize
(
first_blocks_
)
)
{
if
(
static_cast
<
size_t
>
(
blocks_alloced_
)
<
arraysize
(
first_blocks_
)
)
{
// Use one of the pre-allocated blocks
block
=
&
first_blocks_
[
blocks_alloced_
++
];
}
else
{
// oops, out of space, move to the vector
...
...
@@ -119,7 +119,7 @@ void* UnsafeArena::GetMemoryFallback(const size_t size, const int align) {
if
(
overage
)
{
const
int
waste
=
align
-
overage
;
freestart_
+=
waste
;
if
(
waste
<
remaining_
)
{
if
(
waste
<
static_cast
<
int
>
(
remaining_
)
)
{
remaining_
-=
waste
;
}
else
{
remaining_
=
0
;
...
...
contrib/libre2/util/pcre.cc
浏览文件 @
0ab8692b
...
...
@@ -347,7 +347,7 @@ int PCRE::GlobalReplace(string *str,
int
count
=
0
;
int
vec
[
kVecSize
];
string
out
;
in
t
start
=
0
;
size_
t
start
=
0
;
bool
last_match_was_empty_string
=
false
;
for
(;
start
<=
str
->
length
();)
{
...
...
@@ -378,7 +378,7 @@ int PCRE::GlobalReplace(string *str,
break
;
}
int
matchstart
=
vec
[
0
],
matchend
=
vec
[
1
];
assert
(
matchstart
>=
sta
rt
);
assert
(
matchstart
>=
sta
tic_cast
<
int
>
(
start
)
);
assert
(
matchend
>=
matchstart
);
out
.
append
(
*
str
,
start
,
matchstart
-
start
);
...
...
@@ -550,6 +550,9 @@ int PCRE::TryMatch(const StringPiece& text,
return
rc
;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
bool
PCRE
::
DoMatchImpl
(
const
StringPiece
&
text
,
Anchor
anchor
,
int
*
consumed
,
...
...
@@ -589,6 +592,8 @@ bool PCRE::DoMatchImpl(const StringPiece& text,
return
true
;
}
#pragma GCC diagnostic pop
bool
PCRE
::
DoMatch
(
const
StringPiece
&
text
,
Anchor
anchor
,
int
*
consumed
,
...
...
contrib/libre2/util/sparse_array.h
浏览文件 @
0ab8692b
...
...
@@ -294,7 +294,7 @@ template<typename Value>
bool
SparseArray
<
Value
>::
has_index
(
int
i
)
const
{
DCHECK_GE
(
i
,
0
);
DCHECK_LT
(
i
,
max_size_
);
if
(
static_cast
<
uint
>
(
i
)
>=
max_size_
)
{
if
(
static_cast
<
uint
>
(
i
)
>=
static_cast
<
uint
>
(
max_size_
)
)
{
return
false
;
}
// Unsigned comparison avoids checking sparse_to_dense_[i] < 0.
...
...
@@ -306,7 +306,7 @@ bool SparseArray<Value>::has_index(int i) const {
template
<
typename
Value
>
typename
SparseArray
<
Value
>::
iterator
SparseArray
<
Value
>::
set
(
int
i
,
Value
v
)
{
DebugCheckInvariants
();
if
(
static_cast
<
uint
>
(
i
)
>=
max_size_
)
{
if
(
static_cast
<
uint
>
(
i
)
>=
static_cast
<
uint
>
(
max_size_
)
)
{
// Semantically, end() would be better here, but we already know
// the user did something stupid, so begin() insulates them from
// dereferencing an invalid pointer.
...
...
@@ -368,7 +368,7 @@ template<typename Value>
typename
SparseArray
<
Value
>::
iterator
SparseArray
<
Value
>::
set_new
(
int
i
,
Value
v
)
{
DebugCheckInvariants
();
if
(
static_cast
<
uint
>
(
i
)
>=
max_size_
)
{
if
(
static_cast
<
uint
>
(
i
)
>=
static_cast
<
uint
>
(
max_size_
)
)
{
// Semantically, end() would be better here, but we already know
// the user did something stupid, so begin() insulates them from
// dereferencing an invalid pointer.
...
...
contrib/libre2/util/sparse_set.h
浏览文件 @
0ab8692b
...
...
@@ -128,7 +128,7 @@ class SparseSet {
bool
contains
(
int
i
)
const
{
DCHECK_GE
(
i
,
0
);
DCHECK_LT
(
i
,
max_size_
);
if
(
static_cast
<
uint
>
(
i
)
>=
max_size_
)
{
if
(
static_cast
<
uint
>
(
i
)
>=
static_cast
<
uint
>
(
max_size_
)
)
{
return
false
;
}
// Unsigned comparison avoids checking sparse_to_dense_[i] < 0.
...
...
@@ -145,7 +145,7 @@ class SparseSet {
// Set the value at the new index i to v.
// Fast but unsafe: only use if contains(i) is false.
void
insert_new
(
int
i
)
{
if
(
static_cast
<
uint
>
(
i
)
>=
max_size_
)
{
if
(
static_cast
<
uint
>
(
i
)
>=
static_cast
<
uint
>
(
max_size_
)
)
{
// Semantically, end() would be better here, but we already know
// the user did something stupid, so begin() insulates them from
// dereferencing an invalid pointer.
...
...
contrib/libre2/util/stringpiece.cc
浏览文件 @
0ab8692b
...
...
@@ -46,7 +46,7 @@ int StringPiece::find(const StringPiece& s, size_type pos) const {
const
char
*
result
=
std
::
search
(
ptr_
+
pos
,
ptr_
+
length_
,
s
.
ptr_
,
s
.
ptr_
+
s
.
length_
);
const
size_type
xpos
=
result
-
ptr_
;
return
xpos
+
s
.
length_
<=
length_
?
xpos
:
npos
;
return
xpos
+
s
.
length_
<=
static_cast
<
size_type
>
(
length_
)
?
xpos
:
npos
;
}
int
StringPiece
::
find
(
char
c
,
size_type
pos
)
const
{
...
...
@@ -79,7 +79,7 @@ int StringPiece::rfind(char c, size_type pos) const {
}
StringPiece
StringPiece
::
substr
(
size_type
pos
,
size_type
n
)
const
{
if
(
pos
>
length_
)
pos
=
length_
;
if
(
pos
>
static_cast
<
size_type
>
(
length_
)
)
pos
=
length_
;
if
(
n
>
length_
-
pos
)
n
=
length_
-
pos
;
return
StringPiece
(
ptr_
+
pos
,
n
);
}
...
...
contrib/libre2/util/stringprintf.cc
浏览文件 @
0ab8692b
...
...
@@ -18,7 +18,7 @@ static void StringAppendV(string* dst, const char* format, va_list ap) {
int
result
=
vsnprintf
(
space
,
sizeof
(
space
),
format
,
backup_ap
);
va_end
(
backup_ap
);
if
((
result
>=
0
)
&&
(
result
<
sizeof
(
space
)))
{
if
((
result
>=
0
)
&&
(
static_cast
<
size_t
>
(
result
)
<
sizeof
(
space
)))
{
// It fit
dst
->
append
(
space
,
result
);
return
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录