Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
292d0b2e
提交
292d0b2e
authored
7月 12, 2019
作者:
Andrey Volk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-11903: Fix errors reported by PVS-Studio Static Code Analyzer for switch_utils.c
上级
0d73ca2f
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
18 行增加
和
15 行删除
+18
-15
switch_utils.c
src/switch_utils.c
+18
-15
没有找到文件。
src/switch_utils.c
浏览文件 @
292d0b2e
...
@@ -312,6 +312,7 @@ SWITCH_DECLARE(switch_status_t) switch_frame_dup(switch_frame_t *orig, switch_fr
...
@@ -312,6 +312,7 @@ SWITCH_DECLARE(switch_status_t) switch_frame_dup(switch_frame_t *orig, switch_fr
if
(
orig
->
packet
)
{
if
(
orig
->
packet
)
{
new_frame
->
packet
=
malloc
(
SWITCH_RTP_MAX_BUF_LEN
);
new_frame
->
packet
=
malloc
(
SWITCH_RTP_MAX_BUF_LEN
);
switch_assert
(
new_frame
->
packet
);
memcpy
(
new_frame
->
packet
,
orig
->
packet
,
orig
->
packetlen
);
memcpy
(
new_frame
->
packet
,
orig
->
packet
,
orig
->
packetlen
);
new_frame
->
data
=
((
unsigned
char
*
)
new_frame
->
packet
)
+
12
;
new_frame
->
data
=
((
unsigned
char
*
)
new_frame
->
packet
)
+
12
;
}
else
{
}
else
{
...
@@ -2659,7 +2660,7 @@ static char *cleanup_separated_string(char *str, char delim)
...
@@ -2659,7 +2660,7 @@ static char *cleanup_separated_string(char *str, char delim)
}
}
}
}
if
(
!
esc
)
{
if
(
!
esc
)
{
if
(
*
ptr
==
'\''
&&
(
inside_quotes
||
((
ptr
+
1
)
&&
strchr
(
ptr
+
1
,
'\''
)
)))
{
if
(
*
ptr
==
'\''
&&
(
inside_quotes
||
strchr
(
ptr
+
1
,
'\''
)))
{
if
((
inside_quotes
=
(
1
-
inside_quotes
)))
{
if
((
inside_quotes
=
(
1
-
inside_quotes
)))
{
end
=
dest
;
end
=
dest
;
}
}
...
@@ -2722,7 +2723,7 @@ static unsigned int separate_string_char_delim(char *buf, char delim, char **arr
...
@@ -2722,7 +2723,7 @@ static unsigned int separate_string_char_delim(char *buf, char delim, char **arr
/* escaped characters are copied verbatim to the destination string */
/* escaped characters are copied verbatim to the destination string */
if
(
*
ptr
==
ESCAPE_META
)
{
if
(
*
ptr
==
ESCAPE_META
)
{
++
ptr
;
++
ptr
;
}
else
if
(
*
ptr
==
'\''
&&
(
inside_quotes
||
((
ptr
+
1
)
&&
strchr
(
ptr
+
1
,
'\''
)
)))
{
}
else
if
(
*
ptr
==
'\''
&&
(
inside_quotes
||
strchr
(
ptr
+
1
,
'\''
)))
{
inside_quotes
=
(
1
-
inside_quotes
);
inside_quotes
=
(
1
-
inside_quotes
);
}
else
if
(
*
ptr
==
delim
&&
!
inside_quotes
)
{
}
else
if
(
*
ptr
==
delim
&&
!
inside_quotes
)
{
*
ptr
=
'\0'
;
*
ptr
=
'\0'
;
...
@@ -2811,7 +2812,7 @@ SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char
...
@@ -2811,7 +2812,7 @@ SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char
if
(
*
buf
==
'^'
&&
*
(
buf
+
1
)
==
'^'
)
{
if
(
*
buf
==
'^'
&&
*
(
buf
+
1
)
==
'^'
)
{
char
*
p
=
buf
+
2
;
char
*
p
=
buf
+
2
;
if
(
p
&&
*
p
&&
*
(
p
+
1
))
{
if
(
*
p
&&
*
(
p
+
1
))
{
buf
=
p
;
buf
=
p
;
delim
=
*
buf
++
;
delim
=
*
buf
++
;
}
}
...
@@ -3058,6 +3059,7 @@ SWITCH_DECLARE(int) switch_wait_socklist(switch_waitlist_t *waitlist, uint32_t l
...
@@ -3058,6 +3059,7 @@ SWITCH_DECLARE(int) switch_wait_socklist(switch_waitlist_t *waitlist, uint32_t l
int
s
=
0
,
r
=
0
,
i
;
int
s
=
0
,
r
=
0
,
i
;
pfds
=
calloc
(
len
,
sizeof
(
struct
pollfd
));
pfds
=
calloc
(
len
,
sizeof
(
struct
pollfd
));
switch_assert
(
pfds
);
for
(
i
=
0
;
i
<
len
;
i
++
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
waitlist
[
i
].
sock
==
SWITCH_SOCK_INVALID
)
{
if
(
waitlist
[
i
].
sock
==
SWITCH_SOCK_INVALID
)
{
...
@@ -3387,11 +3389,13 @@ SWITCH_DECLARE(char *) switch_core_url_encode_opt(switch_memory_pool_t *pool, co
...
@@ -3387,11 +3389,13 @@ SWITCH_DECLARE(char *) switch_core_url_encode_opt(switch_memory_pool_t *pool, co
const
char
hex
[]
=
"0123456789ABCDEF"
;
const
char
hex
[]
=
"0123456789ABCDEF"
;
switch_size_t
len
=
0
;
switch_size_t
len
=
0
;
switch_size_t
slen
=
0
;
switch_size_t
slen
=
0
;
const
char
*
p
,
*
e
=
end_of_p
(
url
)
;
const
char
*
p
,
*
e
;
if
(
!
url
)
return
NULL
;
if
(
!
url
)
return
NULL
;
if
(
!
pool
)
return
NULL
;
if
(
!
pool
)
return
NULL
;
e
=
end_of_p
(
url
);
for
(
p
=
url
;
*
p
;
p
++
)
{
for
(
p
=
url
;
*
p
;
p
++
)
{
int
ok
=
0
;
int
ok
=
0
;
...
@@ -3507,13 +3511,13 @@ SWITCH_DECLARE(void) switch_split_time(const char *exp, int *hour, int *min, int
...
@@ -3507,13 +3511,13 @@ SWITCH_DECLARE(void) switch_split_time(const char *exp, int *hour, int *min, int
}
else
{
}
else
{
ssec
=
"00"
;
ssec
=
"00"
;
}
}
if
(
hour
&&
shour
)
{
if
(
hour
)
{
*
hour
=
atol
(
shour
);
*
hour
=
atol
(
shour
);
}
}
if
(
min
&&
smin
)
{
if
(
min
)
{
*
min
=
atol
(
smin
);
*
min
=
atol
(
smin
);
}
}
if
(
sec
&&
ssec
)
{
if
(
sec
)
{
*
sec
=
atol
(
ssec
);
*
sec
=
atol
(
ssec
);
}
}
...
@@ -3537,13 +3541,13 @@ SWITCH_DECLARE(void) switch_split_date(const char *exp, int *year, int *month, i
...
@@ -3537,13 +3541,13 @@ SWITCH_DECLARE(void) switch_split_date(const char *exp, int *year, int *month, i
*
smonth
++
=
'\0'
;
*
smonth
++
=
'\0'
;
if
((
sday
=
strchr
(
smonth
,
'-'
)))
{
if
((
sday
=
strchr
(
smonth
,
'-'
)))
{
*
sday
++
=
'\0'
;
*
sday
++
=
'\0'
;
if
(
year
&&
syear
)
{
if
(
year
)
{
*
year
=
atol
(
syear
);
*
year
=
atol
(
syear
);
}
}
if
(
month
&&
smonth
)
{
if
(
month
)
{
*
month
=
atol
(
smonth
);
*
month
=
atol
(
smonth
);
}
}
if
(
day
&&
sday
)
{
if
(
day
)
{
*
day
=
atol
(
sday
);
*
day
=
atol
(
sday
);
}
}
}
}
...
@@ -3923,7 +3927,7 @@ SWITCH_DECLARE(switch_bool_t) switch_dow_cmp(const char *exp, int val)
...
@@ -3923,7 +3927,7 @@ SWITCH_DECLARE(switch_bool_t) switch_dow_cmp(const char *exp, int val)
while
((
cur
=
_dow_read_token
(
&
p
))
!=
DOW_EOF
)
{
while
((
cur
=
_dow_read_token
(
&
p
))
!=
DOW_EOF
)
{
if
(
cur
==
DOW_COMA
)
{
if
(
cur
==
DOW_COMA
)
{
/* Reset state */
/* Reset state */
cur
=
prev
=
DOW_EOF
;
cur
=
DOW_EOF
;
}
else
if
(
cur
==
DOW_HYPHEN
)
{
}
else
if
(
cur
==
DOW_HYPHEN
)
{
/* Save the previous token and move to the next one */
/* Save the previous token and move to the next one */
range_start
=
prev
;
range_start
=
prev
;
...
@@ -4258,12 +4262,11 @@ SWITCH_DECLARE(switch_status_t) switch_http_parse_header(char *buffer, uint32_t
...
@@ -4258,12 +4262,11 @@ SWITCH_DECLARE(switch_status_t) switch_http_parse_header(char *buffer, uint32_t
}
}
request
->
_buffer
=
strdup
(
buffer
);
request
->
_buffer
=
strdup
(
buffer
);
switch_assert
(
request
->
_buffer
);
request
->
method
=
request
->
_buffer
;
request
->
method
=
request
->
_buffer
;
request
->
bytes_buffered
=
datalen
;
request
->
bytes_buffered
=
datalen
;
if
(
body
)
{
request
->
bytes_header
=
body
-
buffer
;
request
->
bytes_header
=
body
-
buffer
;
request
->
bytes_read
=
body
-
buffer
;
request
->
bytes_read
=
body
-
buffer
;
}
p
=
strchr
(
request
->
method
,
' '
);
p
=
strchr
(
request
->
method
,
' '
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论