Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
64f31f70
Commit
64f31f70
authored
Mar 15, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/curl: pass std::string&& to HeaderReceived()
Code simplification.
parent
23eacbd1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
25 deletions
+8
-25
CurlInputPlugin.cxx
src/input/plugins/CurlInputPlugin.cxx
+8
-25
No files found.
src/input/plugins/CurlInputPlugin.cxx
View file @
64f31f70
...
...
@@ -209,8 +209,7 @@ struct CurlInputStream {
*/
void
FreeEasyIndirect
();
void
HeaderReceived
(
const
char
*
name
,
const
char
*
value
,
const
char
*
end
);
void
HeaderReceived
(
const
char
*
name
,
std
::
string
&&
value
);
size_t
DataReceived
(
const
void
*
ptr
,
size_t
size
);
...
...
@@ -899,29 +898,20 @@ input_curl_eof(gcc_unused InputStream *is)
}
inline
void
CurlInputStream
::
HeaderReceived
(
const
char
*
name
,
const
char
*
value
,
const
char
*
end
)
CurlInputStream
::
HeaderReceived
(
const
char
*
name
,
std
::
string
&&
value
)
{
if
(
StringEqualsCaseASCII
(
name
,
"accept-ranges"
))
{
/* a stream with icy-metadata is not seekable */
if
(
!
icy
.
IsDefined
())
base
.
seekable
=
true
;
}
else
if
(
StringEqualsCaseASCII
(
name
,
"content-length"
))
{
char
buffer
[
64
];
if
((
size_t
)(
end
-
value
)
>=
sizeof
(
buffer
))
return
;
memcpy
(
buffer
,
value
,
end
-
value
);
buffer
[
end
-
value
]
=
0
;
base
.
size
=
base
.
offset
+
ParseUint64
(
buffer
);
base
.
size
=
base
.
offset
+
ParseUint64
(
value
.
c_str
());
}
else
if
(
StringEqualsCaseASCII
(
name
,
"content-type"
))
{
base
.
mime
.
assign
(
value
,
end
);
base
.
mime
=
std
::
move
(
value
);
}
else
if
(
StringEqualsCaseASCII
(
name
,
"icy-name"
)
||
StringEqualsCaseASCII
(
name
,
"ice-name"
)
||
StringEqualsCaseASCII
(
name
,
"x-audiocast-name"
))
{
meta_name
.
assign
(
value
,
end
);
meta_name
=
std
::
move
(
value
);
delete
tag
;
...
...
@@ -930,17 +920,10 @@ CurlInputStream::HeaderReceived(const char *name,
tag
=
tag_builder
.
CommitNew
();
}
else
if
(
StringEqualsCaseASCII
(
name
,
"icy-metaint"
))
{
char
buffer
[
64
];
size_t
icy_metaint
;
if
((
size_t
)(
end
-
value
)
>=
sizeof
(
buffer
)
||
icy
.
IsDefined
())
if
(
icy
.
IsDefined
())
return
;
memcpy
(
buffer
,
value
,
end
-
value
);
buffer
[
end
-
value
]
=
0
;
icy_metaint
=
ParseUint64
(
buffer
);
size_t
icy_metaint
=
ParseUint64
(
value
.
c_str
());
FormatDebug
(
curl_domain
,
"icy-metaint=%zu"
,
icy_metaint
);
if
(
icy_metaint
>
0
)
{
...
...
@@ -985,7 +968,7 @@ input_curl_headerfunction(void *ptr, size_t size, size_t nmemb, void *stream)
while
(
end
>
value
&&
IsWhitespaceOrNull
(
end
[
-
1
]))
--
end
;
c
.
HeaderReceived
(
name
,
value
,
end
);
c
.
HeaderReceived
(
name
,
std
::
string
(
value
,
end
)
);
return
size
;
}
...
...
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