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
6b77ee9a
Commit
6b77ee9a
authored
Dec 20, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IcyMetaDataParser: add "noexcept"
parent
25fa3cca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
18 deletions
+18
-18
IcyMetaDataParser.cxx
src/IcyMetaDataParser.cxx
+9
-8
IcyMetaDataParser.hxx
src/IcyMetaDataParser.hxx
+9
-10
No files found.
src/IcyMetaDataParser.cxx
View file @
6b77ee9a
...
...
@@ -31,7 +31,7 @@
static
constexpr
Domain
icy_metadata_domain
(
"icy_metadata"
);
void
IcyMetaDataParser
::
Reset
()
IcyMetaDataParser
::
Reset
()
noexcept
{
if
(
!
IsDefined
())
return
;
...
...
@@ -46,7 +46,7 @@ IcyMetaDataParser::Reset()
}
size_t
IcyMetaDataParser
::
Data
(
size_t
length
)
IcyMetaDataParser
::
Data
(
size_t
length
)
noexcept
{
assert
(
length
>
0
);
...
...
@@ -66,7 +66,7 @@ IcyMetaDataParser::Data(size_t length)
}
static
void
icy_add_item
(
TagBuilder
&
tag
,
TagType
type
,
const
char
*
value
)
icy_add_item
(
TagBuilder
&
tag
,
TagType
type
,
const
char
*
value
)
noexcept
{
size_t
length
=
strlen
(
value
);
...
...
@@ -81,7 +81,8 @@ icy_add_item(TagBuilder &tag, TagType type, const char *value)
}
static
void
icy_parse_tag_item
(
TagBuilder
&
tag
,
const
char
*
name
,
const
char
*
value
)
icy_parse_tag_item
(
TagBuilder
&
tag
,
const
char
*
name
,
const
char
*
value
)
noexcept
{
if
(
strcmp
(
name
,
"StreamTitle"
)
==
0
)
icy_add_item
(
tag
,
TAG_TITLE
,
value
);
...
...
@@ -96,7 +97,7 @@ icy_parse_tag_item(TagBuilder &tag, const char *name, const char *value)
* that also fails, return #end.
*/
static
char
*
find_end_quote
(
char
*
p
,
char
*
const
end
)
find_end_quote
(
char
*
p
,
char
*
const
end
)
noexcept
{
char
*
fallback
=
std
::
find
(
p
,
end
,
'\''
);
if
(
fallback
>=
end
-
1
||
fallback
[
1
]
==
';'
)
...
...
@@ -116,7 +117,7 @@ find_end_quote(char *p, char *const end)
}
static
std
::
unique_ptr
<
Tag
>
icy_parse_tag
(
char
*
p
,
char
*
const
end
)
icy_parse_tag
(
char
*
p
,
char
*
const
end
)
noexcept
{
assert
(
p
!=
nullptr
);
assert
(
end
!=
nullptr
);
...
...
@@ -165,7 +166,7 @@ icy_parse_tag(char *p, char *const end)
}
size_t
IcyMetaDataParser
::
Meta
(
const
void
*
data
,
size_t
length
)
IcyMetaDataParser
::
Meta
(
const
void
*
data
,
size_t
length
)
noexcept
{
const
unsigned
char
*
p
=
(
const
unsigned
char
*
)
data
;
...
...
@@ -223,7 +224,7 @@ IcyMetaDataParser::Meta(const void *data, size_t length)
}
size_t
IcyMetaDataParser
::
ParseInPlace
(
void
*
data
,
size_t
length
)
IcyMetaDataParser
::
ParseInPlace
(
void
*
data
,
size_t
length
)
noexcept
{
uint8_t
*
const
dest0
=
(
uint8_t
*
)
data
;
uint8_t
*
dest
=
dest0
;
...
...
src/IcyMetaDataParser.hxx
View file @
6b77ee9a
...
...
@@ -25,7 +25,7 @@
struct
Tag
;
class
IcyMetaDataParser
{
size_t
data_size
,
data_rest
;
size_t
data_size
=
0
,
data_rest
;
size_t
meta_size
,
meta_position
;
char
*
meta_data
;
...
...
@@ -33,8 +33,7 @@ class IcyMetaDataParser {
Tag
*
tag
;
public
:
IcyMetaDataParser
()
:
data_size
(
0
)
{}
~
IcyMetaDataParser
()
{
~
IcyMetaDataParser
()
noexcept
{
Reset
();
}
...
...
@@ -42,7 +41,7 @@ public:
* Initialize an enabled icy_metadata object with the specified
* data_size (from the icy-metaint HTTP response header).
*/
void
Start
(
size_t
_data_size
)
{
void
Start
(
size_t
_data_size
)
noexcept
{
data_size
=
data_rest
=
_data_size
;
meta_size
=
0
;
tag
=
nullptr
;
...
...
@@ -51,12 +50,12 @@ public:
/**
* Resets the icy_metadata. Call this after rewinding the stream.
*/
void
Reset
();
void
Reset
()
noexcept
;
/**
* Checks whether the icy_metadata object is enabled.
*/
bool
IsDefined
()
const
{
bool
IsDefined
()
const
noexcept
{
return
data_size
>
0
;
}
...
...
@@ -66,23 +65,23 @@ public:
* return value is smaller than "length", the caller should invoke
* icy_meta().
*/
size_t
Data
(
size_t
length
);
size_t
Data
(
size_t
length
)
noexcept
;
/**
* Reads metadata from the stream. Returns the number of bytes
* consumed. If the return value is smaller than "length", the caller
* should invoke icy_data().
*/
size_t
Meta
(
const
void
*
data
,
size_t
length
);
size_t
Meta
(
const
void
*
data
,
size_t
length
)
noexcept
;
/**
* Parse data and eliminate metadata.
*
* @return the number of data bytes remaining in the buffer
*/
size_t
ParseInPlace
(
void
*
data
,
size_t
length
);
size_t
ParseInPlace
(
void
*
data
,
size_t
length
)
noexcept
;
Tag
*
ReadTag
()
{
Tag
*
ReadTag
()
noexcept
{
Tag
*
result
=
tag
;
tag
=
nullptr
;
return
result
;
...
...
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