db/Print: add "noexcept"
This commit is contained in:
@@ -38,8 +38,9 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
gcc_pure
|
||||||
static const char *
|
static const char *
|
||||||
ApplyBaseFlag(const char *uri, bool base)
|
ApplyBaseFlag(const char *uri, bool base) noexcept
|
||||||
{
|
{
|
||||||
if (base)
|
if (base)
|
||||||
uri = PathTraitsUTF8::GetBase(uri);
|
uri = PathTraitsUTF8::GetBase(uri);
|
||||||
@@ -47,21 +48,24 @@ ApplyBaseFlag(const char *uri, bool base)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PrintDirectoryURI(Response &r, bool base, const LightDirectory &directory)
|
PrintDirectoryURI(Response &r, bool base,
|
||||||
|
const LightDirectory &directory) noexcept
|
||||||
{
|
{
|
||||||
r.Format("directory: %s\n",
|
r.Format("directory: %s\n",
|
||||||
ApplyBaseFlag(directory.GetPath(), base));
|
ApplyBaseFlag(directory.GetPath(), base));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PrintDirectoryBrief(Response &r, bool base, const LightDirectory &directory)
|
PrintDirectoryBrief(Response &r, bool base,
|
||||||
|
const LightDirectory &directory) noexcept
|
||||||
{
|
{
|
||||||
if (!directory.IsRoot())
|
if (!directory.IsRoot())
|
||||||
PrintDirectoryURI(r, base, directory);
|
PrintDirectoryURI(r, base, directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PrintDirectoryFull(Response &r, bool base, const LightDirectory &directory)
|
PrintDirectoryFull(Response &r, bool base,
|
||||||
|
const LightDirectory &directory) noexcept
|
||||||
{
|
{
|
||||||
if (!directory.IsRoot()) {
|
if (!directory.IsRoot()) {
|
||||||
PrintDirectoryURI(r, base, directory);
|
PrintDirectoryURI(r, base, directory);
|
||||||
@@ -74,7 +78,7 @@ PrintDirectoryFull(Response &r, bool base, const LightDirectory &directory)
|
|||||||
static void
|
static void
|
||||||
print_playlist_in_directory(Response &r, bool base,
|
print_playlist_in_directory(Response &r, bool base,
|
||||||
const char *directory,
|
const char *directory,
|
||||||
const char *name_utf8)
|
const char *name_utf8) noexcept
|
||||||
{
|
{
|
||||||
if (base || directory == nullptr)
|
if (base || directory == nullptr)
|
||||||
r.Format("playlist: %s\n",
|
r.Format("playlist: %s\n",
|
||||||
@@ -87,7 +91,7 @@ print_playlist_in_directory(Response &r, bool base,
|
|||||||
static void
|
static void
|
||||||
print_playlist_in_directory(Response &r, bool base,
|
print_playlist_in_directory(Response &r, bool base,
|
||||||
const LightDirectory *directory,
|
const LightDirectory *directory,
|
||||||
const char *name_utf8)
|
const char *name_utf8) noexcept
|
||||||
{
|
{
|
||||||
if (base || directory == nullptr || directory->IsRoot())
|
if (base || directory == nullptr || directory->IsRoot())
|
||||||
r.Format("playlist: %s\n", name_utf8);
|
r.Format("playlist: %s\n", name_utf8);
|
||||||
@@ -97,7 +101,7 @@ print_playlist_in_directory(Response &r, bool base,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PrintSongBrief(Response &r, bool base, const LightSong &song)
|
PrintSongBrief(Response &r, bool base, const LightSong &song) noexcept
|
||||||
{
|
{
|
||||||
song_print_uri(r, song, base);
|
song_print_uri(r, song, base);
|
||||||
|
|
||||||
@@ -108,7 +112,7 @@ PrintSongBrief(Response &r, bool base, const LightSong &song)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PrintSongFull(Response &r, bool base, const LightSong &song)
|
PrintSongFull(Response &r, bool base, const LightSong &song) noexcept
|
||||||
{
|
{
|
||||||
song_print_info(r, song, base);
|
song_print_info(r, song, base);
|
||||||
|
|
||||||
@@ -121,7 +125,7 @@ PrintSongFull(Response &r, bool base, const LightSong &song)
|
|||||||
static void
|
static void
|
||||||
PrintPlaylistBrief(Response &r, bool base,
|
PrintPlaylistBrief(Response &r, bool base,
|
||||||
const PlaylistInfo &playlist,
|
const PlaylistInfo &playlist,
|
||||||
const LightDirectory &directory)
|
const LightDirectory &directory) noexcept
|
||||||
{
|
{
|
||||||
print_playlist_in_directory(r, base,
|
print_playlist_in_directory(r, base,
|
||||||
&directory, playlist.name.c_str());
|
&directory, playlist.name.c_str());
|
||||||
@@ -130,7 +134,7 @@ PrintPlaylistBrief(Response &r, bool base,
|
|||||||
static void
|
static void
|
||||||
PrintPlaylistFull(Response &r, bool base,
|
PrintPlaylistFull(Response &r, bool base,
|
||||||
const PlaylistInfo &playlist,
|
const PlaylistInfo &playlist,
|
||||||
const LightDirectory &directory)
|
const LightDirectory &directory) noexcept
|
||||||
{
|
{
|
||||||
print_playlist_in_directory(r, base,
|
print_playlist_in_directory(r, base,
|
||||||
&directory, playlist.name.c_str());
|
&directory, playlist.name.c_str());
|
||||||
@@ -139,8 +143,9 @@ PrintPlaylistFull(Response &r, bool base,
|
|||||||
time_print(r, "Last-Modified", playlist.mtime);
|
time_print(r, "Last-Modified", playlist.mtime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gcc_pure
|
||||||
static bool
|
static bool
|
||||||
CompareNumeric(const char *a, const char *b)
|
CompareNumeric(const char *a, const char *b) noexcept
|
||||||
{
|
{
|
||||||
long a_value = strtol(a, nullptr, 10);
|
long a_value = strtol(a, nullptr, 10);
|
||||||
long b_value = strtol(b, nullptr, 10);
|
long b_value = strtol(b, nullptr, 10);
|
||||||
@@ -148,8 +153,9 @@ CompareNumeric(const char *a, const char *b)
|
|||||||
return a_value < b_value;
|
return a_value < b_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gcc_pure
|
||||||
static bool
|
static bool
|
||||||
CompareTags(TagType type, bool descending, const Tag &a, const Tag &b)
|
CompareTags(TagType type, bool descending, const Tag &a, const Tag &b) noexcept
|
||||||
{
|
{
|
||||||
const char *a_value = a.GetSortValue(type);
|
const char *a_value = a.GetSortValue(type);
|
||||||
const char *b_value = b.GetSortValue(type);
|
const char *b_value = b.GetSortValue(type);
|
||||||
@@ -262,14 +268,14 @@ db_selection_print(Response &r, Partition &partition,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PrintSongURIVisitor(Response &r, const LightSong &song)
|
PrintSongURIVisitor(Response &r, const LightSong &song) noexcept
|
||||||
{
|
{
|
||||||
song_print_uri(r, song);
|
song_print_uri(r, song);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PrintUniqueTag(Response &r, TagType tag_type,
|
PrintUniqueTag(Response &r, TagType tag_type,
|
||||||
const Tag &tag)
|
const Tag &tag) noexcept
|
||||||
{
|
{
|
||||||
const char *value = tag.GetValue(tag_type);
|
const char *value = tag.GetValue(tag_type);
|
||||||
assert(value != nullptr);
|
assert(value != nullptr);
|
||||||
|
Reference in New Issue
Block a user