Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
php-bencode
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Frederick Zhang
php-bencode
Commits
cbc9e5be
Commit
cbc9e5be
authored
May 12, 2016
by
Frederick Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use long instead of string for searching mode
parent
b3bc81de
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
22 additions
and
15 deletions
+22
-15
bdict.cc
bdict.cc
+7
-4
bdict.h
bdict.h
+1
-1
bint.cc
bint.cc
+1
-1
bint.h
bint.h
+1
-1
bitem.h
bitem.h
+2
-1
blist.cc
blist.cc
+7
-4
blist.h
blist.h
+1
-1
bstr.cc
bstr.cc
+1
-1
bstr.h
bstr.h
+1
-1
No files found.
bdict.cc
View file @
cbc9e5be
...
...
@@ -302,11 +302,14 @@ zval * bdict::to_array(const bool include_meta) const {
return
zv
;
}
zval
*
bdict
::
search
(
const
std
::
string
&
needle
,
const
std
::
string
&
mode
,
const
std
::
string
path
)
const
{
bool
modek
=
(
mode
.
find
(
'k'
)
==
std
::
string
::
npos
)
?
false
:
true
;
bool
modev
=
(
mode
.
find
(
'v'
)
==
std
::
string
::
npos
)
?
false
:
true
;
if
(
!
(
modek
||
modev
))
zval
*
bdict
::
search
(
const
std
::
string
&
needle
,
const
long
&
mode
,
const
std
::
string
path
)
const
{
if
(
mode
<
0
||
mode
>
1
)
bitem
::
throw_general_exception
(
"Illegal search mode"
);
bool
modek
=
false
,
modev
=
false
;
if
(
mode
==
0
)
modek
=
true
;
else
modev
=
true
;
zval
_zv
;
zval
*
zv
=
&
_zv
;
...
...
bdict.h
View file @
cbc9e5be
...
...
@@ -31,7 +31,7 @@ class bdict : public bitem {
static
zval
*
parse
(
const
std
::
string
&
ben
,
size_t
&
pt
);
std
::
string
encode
()
const
;
zval
*
to_array
(
const
bool
include_meta
)
const
;
zval
*
search
(
const
std
::
string
&
needle
,
const
std
::
stri
ng
&
mode
,
const
std
::
string
path
)
const
;
zval
*
search
(
const
std
::
string
&
needle
,
const
lo
ng
&
mode
,
const
std
::
string
path
)
const
;
};
#endif
bint.cc
View file @
cbc9e5be
...
...
@@ -68,6 +68,6 @@ zval * bint::to_array(const bool include_meta) const {
return
zv
;
}
zval
*
bint
::
search
(
const
std
::
string
&
needle
,
const
std
::
stri
ng
&
mode
,
const
std
::
string
path
)
const
{
zval
*
bint
::
search
(
const
std
::
string
&
needle
,
const
lo
ng
&
mode
,
const
std
::
string
path
)
const
{
return
nullptr
;
}
bint.h
View file @
cbc9e5be
...
...
@@ -28,7 +28,7 @@ class bint : public bitem {
static
zval
*
parse
(
const
std
::
string
&
ben
,
size_t
&
pt
);
std
::
string
encode
()
const
;
zval
*
to_array
(
const
bool
include_meta
)
const
;
zval
*
search
(
const
std
::
string
&
needle
,
const
std
::
stri
ng
&
mode
,
const
std
::
string
path
)
const
;
zval
*
search
(
const
std
::
string
&
needle
,
const
lo
ng
&
mode
,
const
std
::
string
path
)
const
;
};
#endif
bitem.h
View file @
cbc9e5be
...
...
@@ -28,7 +28,8 @@ class bitem {
virtual
std
::
string
encode
()
const
=
0
;
static
zval
*
load
(
const
std
::
string
&
file_path
);
void
save
(
const
std
::
string
&
file_path
)
const
;
virtual
zval
*
search
(
const
std
::
string
&
needle
,
const
std
::
string
&
mode
,
const
std
::
string
path
)
const
=
0
;
// mode 0: search in keys; mode 1: search in values
virtual
zval
*
search
(
const
std
::
string
&
needle
,
const
long
&
mode
,
const
std
::
string
path
)
const
=
0
;
};
#endif
blist.cc
View file @
cbc9e5be
...
...
@@ -323,11 +323,14 @@ zval * blist::to_array(const bool include_meta) const {
return
zv
;
}
zval
*
blist
::
search
(
const
std
::
string
&
needle
,
const
std
::
string
&
mode
,
const
std
::
string
path
)
const
{
bool
modek
=
(
mode
.
find
(
'k'
)
==
std
::
string
::
npos
)
?
false
:
true
;
bool
modev
=
(
mode
.
find
(
'v'
)
==
std
::
string
::
npos
)
?
false
:
true
;
if
(
!
(
modek
||
modev
))
zval
*
blist
::
search
(
const
std
::
string
&
needle
,
const
long
&
mode
,
const
std
::
string
path
)
const
{
if
(
mode
<
0
||
mode
>
1
)
bitem
::
throw_general_exception
(
"Illegal search mode"
);
bool
modek
=
false
,
modev
=
false
;
if
(
mode
==
0
)
modek
=
true
;
else
modev
=
true
;
zval
_zv
;
zval
*
zv
=
&
_zv
;
...
...
blist.h
View file @
cbc9e5be
...
...
@@ -32,7 +32,7 @@ class blist : public bitem {
static
zval
*
parse
(
const
std
::
string
&
ben
,
size_t
&
pt
);
std
::
string
encode
()
const
;
zval
*
to_array
(
const
bool
include_meta
)
const
;
zval
*
search
(
const
std
::
string
&
needle
,
const
std
::
stri
ng
&
mode
,
const
std
::
string
path
)
const
;
zval
*
search
(
const
std
::
string
&
needle
,
const
lo
ng
&
mode
,
const
std
::
string
path
)
const
;
};
#endif
bstr.cc
View file @
cbc9e5be
...
...
@@ -72,6 +72,6 @@ zval * bstr::to_array(const bool include_meta) const {
return
zv
;
}
zval
*
bstr
::
search
(
const
std
::
string
&
needle
,
const
std
::
stri
ng
&
mode
,
const
std
::
string
path
)
const
{
zval
*
bstr
::
search
(
const
std
::
string
&
needle
,
const
lo
ng
&
mode
,
const
std
::
string
path
)
const
{
return
nullptr
;
}
bstr.h
View file @
cbc9e5be
...
...
@@ -28,7 +28,7 @@ class bstr : public bitem {
static
zval
*
parse
(
const
std
::
string
&
ben
,
size_t
&
pt
);
std
::
string
encode
()
const
;
zval
*
to_array
(
const
bool
include_meta
)
const
;
zval
*
search
(
const
std
::
string
&
needle
,
const
std
::
stri
ng
&
mode
,
const
std
::
string
path
)
const
;
zval
*
search
(
const
std
::
string
&
needle
,
const
lo
ng
&
mode
,
const
std
::
string
path
)
const
;
};
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment