From 1e3f0650df89dd101eb008a17d30d92945b20dfa Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 21 Jan 2018 11:40:42 +0100 Subject: [PATCH] SongUpdate: add "noexcept" --- src/DetachedSong.hxx | 4 ++-- src/SongUpdate.cxx | 13 +++++++------ src/db/plugins/simple/Song.hxx | 8 ++++---- test/test_translate_song.cxx | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/DetachedSong.hxx b/src/DetachedSong.hxx index 5b9e07a7b..a161ad427 100644 --- a/src/DetachedSong.hxx +++ b/src/DetachedSong.hxx @@ -237,12 +237,12 @@ public: * * @return true on success */ - bool Update(); + bool Update() noexcept; /** * Load #tag and #mtime from a local file. */ - bool LoadFile(Path path); + bool LoadFile(Path path) noexcept; }; #endif diff --git a/src/SongUpdate.cxx b/src/SongUpdate.cxx index 99d0f0761..9a0e2cd01 100644 --- a/src/SongUpdate.cxx +++ b/src/SongUpdate.cxx @@ -42,7 +42,8 @@ #ifdef ENABLE_DATABASE Song * -Song::LoadFile(Storage &storage, const char *path_utf8, Directory &parent) +Song::LoadFile(Storage &storage, const char *path_utf8, + Directory &parent) noexcept { assert(!uri_has_scheme(path_utf8)); assert(strchr(path_utf8, '\n') == nullptr); @@ -61,7 +62,7 @@ Song::LoadFile(Storage &storage, const char *path_utf8, Directory &parent) #ifdef ENABLE_DATABASE bool -Song::UpdateFile(Storage &storage) +Song::UpdateFile(Storage &storage) noexcept { const auto &relative_uri = GetURI(); @@ -99,7 +100,7 @@ Song::UpdateFile(Storage &storage) Song * Song::LoadFromArchive(ArchiveFile &archive, const char *name_utf8, - Directory &parent) + Directory &parent) noexcept { assert(!uri_has_scheme(name_utf8)); assert(strchr(name_utf8, '\n') == nullptr); @@ -115,7 +116,7 @@ Song::LoadFromArchive(ArchiveFile &archive, const char *name_utf8, } bool -Song::UpdateFileInArchive(ArchiveFile &archive) +Song::UpdateFileInArchive(ArchiveFile &archive) noexcept { assert(parent != nullptr); assert(parent->device == DEVICE_INARCHIVE); @@ -141,7 +142,7 @@ Song::UpdateFileInArchive(ArchiveFile &archive) #endif bool -DetachedSong::LoadFile(Path path) +DetachedSong::LoadFile(Path path) noexcept { FileInfo fi; if (!GetFileInfo(path, fi) || !fi.IsRegular()) @@ -157,7 +158,7 @@ DetachedSong::LoadFile(Path path) } bool -DetachedSong::Update() +DetachedSong::Update() noexcept { if (IsAbsoluteFile()) { const AllocatedPath path_fs = diff --git a/src/db/plugins/simple/Song.hxx b/src/db/plugins/simple/Song.hxx index 13c8bd6be..e6f0d3758 100644 --- a/src/db/plugins/simple/Song.hxx +++ b/src/db/plugins/simple/Song.hxx @@ -109,17 +109,17 @@ struct Song { */ gcc_malloc static Song *LoadFile(Storage &storage, const char *name_utf8, - Directory &parent); + Directory &parent) noexcept; void Free(); - bool UpdateFile(Storage &storage); + bool UpdateFile(Storage &storage) noexcept; #ifdef ENABLE_ARCHIVE static Song *LoadFromArchive(ArchiveFile &archive, const char *name_utf8, - Directory &parent); - bool UpdateFileInArchive(ArchiveFile &archive); + Directory &parent) noexcept; + bool UpdateFileInArchive(ArchiveFile &archive) noexcept; #endif /** diff --git a/test/test_translate_song.cxx b/test/test_translate_song.cxx index 0526f761f..e958552ba 100644 --- a/test/test_translate_song.cxx +++ b/test/test_translate_song.cxx @@ -121,7 +121,7 @@ DatabaseDetachSong(gcc_unused const Database &db, } bool -DetachedSong::LoadFile(Path path) +DetachedSong::LoadFile(Path path) noexcept { if (path.ToUTF8() == uri1) { SetTag(MakeTag1a());