Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2015-12-07 18:22:55 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fabcc91a0e34bafc43ab31d8f655413a4e775579
fabcc91a
1 parent
b2ae1aca
refine codes.
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
71 行增加
和
1 行删除
trunk/src/kernel/srs_kernel_utility.cpp
trunk/src/kernel/srs_kernel_utility.hpp
trunk/src/protocol/srs_http_stack.cpp
trunk/src/protocol/srs_protocol_json.cpp
trunk/src/protocol/srs_protocol_json.hpp
trunk/src/kernel/srs_kernel_utility.cpp
查看文件 @
fabcc91
...
...
@@ -357,7 +357,57 @@ vector<string> srs_string_split(string str, string flag)
while
((
pos
=
s
.
find
(
flag
))
!=
string
::
npos
)
{
arr
.
push_back
(
s
.
substr
(
0
,
pos
));
s
=
s
.
substr
(
pos
+
1
);
s
=
s
.
substr
(
pos
+
flag
.
length
());
}
if
(
!
s
.
empty
())
{
arr
.
push_back
(
s
);
}
return
arr
;
}
string
srs_string_min_match
(
string
str
,
vector
<
string
>
flags
)
{
string
match
;
size_t
min_pos
=
string
::
npos
;
for
(
vector
<
string
>::
iterator
it
=
flags
.
begin
();
it
!=
flags
.
end
();
++
it
)
{
string
flag
=
*
it
;
size_t
pos
=
str
.
find
(
flag
);
if
(
pos
==
string
::
npos
)
{
continue
;
}
if
(
min_pos
==
string
::
npos
||
pos
<
min_pos
)
{
min_pos
=
pos
;
match
=
flag
;
}
}
return
match
;
}
vector
<
string
>
srs_string_split
(
string
str
,
vector
<
string
>
flags
)
{
vector
<
string
>
arr
;
size_t
pos
=
string
::
npos
;
string
s
=
str
;
while
(
true
)
{
string
flag
=
srs_string_min_match
(
s
,
flags
);
if
(
flag
.
empty
())
{
break
;
}
if
((
pos
=
s
.
find
(
flag
))
==
string
::
npos
)
{
break
;
}
arr
.
push_back
(
s
.
substr
(
0
,
pos
));
s
=
s
.
substr
(
pos
+
flag
.
length
());
}
if
(
!
s
.
empty
())
{
...
...
trunk/src/kernel/srs_kernel_utility.hpp
查看文件 @
fabcc91
...
...
@@ -90,6 +90,7 @@ extern bool srs_string_starts_with(std::string str, std::string flag0, std::stri
extern
bool
srs_string_contains
(
std
::
string
str
,
std
::
string
flag
);
// split the string by flag to array.
extern
std
::
vector
<
std
::
string
>
srs_string_split
(
std
::
string
str
,
std
::
string
flag
);
extern
std
::
vector
<
std
::
string
>
srs_string_split
(
std
::
string
str
,
std
::
vector
<
std
::
string
>
flags
);
// create dir recursively
extern
int
srs_create_dir_recursively
(
std
::
string
dir
);
...
...
trunk/src/protocol/srs_http_stack.cpp
100755 → 100644
查看文件 @
fabcc91
...
...
@@ -2989,6 +2989,9 @@ int SrsHttpUri::initialize(string _url)
{
int
ret
=
ERROR_SUCCESS
;
port
=
0
;
schema
=
host
=
path
=
query
=
""
;
url
=
_url
;
const
char
*
purl
=
url
.
c_str
();
...
...
trunk/src/protocol/srs_protocol_json.cpp
查看文件 @
fabcc91
...
...
@@ -630,6 +630,21 @@ SrsJsonAny* SrsJsonObject::ensure_property_integer(string name)
return
prop
;
}
SrsJsonAny
*
SrsJsonObject
::
ensure_property_number
(
string
name
)
{
SrsJsonAny
*
prop
=
get_property
(
name
);
if
(
!
prop
)
{
return
NULL
;
}
if
(
!
prop
->
is_number
())
{
return
NULL
;
}
return
prop
;
}
SrsJsonAny
*
SrsJsonObject
::
ensure_property_boolean
(
string
name
)
{
SrsJsonAny
*
prop
=
get_property
(
name
);
...
...
trunk/src/protocol/srs_protocol_json.hpp
查看文件 @
fabcc91
...
...
@@ -157,6 +157,7 @@ public:
virtual
SrsJsonAny
*
get_property
(
std
::
string
name
);
virtual
SrsJsonAny
*
ensure_property_string
(
std
::
string
name
);
virtual
SrsJsonAny
*
ensure_property_integer
(
std
::
string
name
);
virtual
SrsJsonAny
*
ensure_property_number
(
std
::
string
name
);
virtual
SrsJsonAny
*
ensure_property_boolean
(
std
::
string
name
);
virtual
SrsJsonAny
*
ensure_property_object
(
std
::
string
name
);
virtual
SrsJsonAny
*
ensure_property_array
(
std
::
string
name
);
...
...
请
注册
或
登录
后发表评论