From 5205d0825884b53f24cc8f3b05028d196e5b828f Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 19 Jun 2022 16:32:42 +0200 Subject: [PATCH] Improve coding style of a few functions in `id3v2frame.cpp` * Declare functions only used in the compile unit as static * Use `std` namespace explicitly * Use `auto` where it makes sense --- id3/id3v2frame.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/id3/id3v2frame.cpp b/id3/id3v2frame.cpp index 9d8aaeb..d9ad01d 100644 --- a/id3/id3v2frame.cpp +++ b/id3/id3v2frame.cpp @@ -65,9 +65,9 @@ Id3v2Frame::Id3v2Frame(const IdentifierType &id, const TagValue &value, std::uin * \brief Helper function to parse the genre index. * \returns Returns the genre index or -1 if the specified string does not denote a genre index. */ -template int parseGenreIndex(const stringtype &denotation) +template static int parseGenreIndex(const stringtype &denotation) { - int index = -1; + auto index = -1; for (auto c : denotation) { if (index == -1) { switch (c) { @@ -106,17 +106,17 @@ template int parseGenreIndex(const stringtype &denotation) /*! * \brief Returns an std::string instance for the substring parsed using parseSubstring(). */ -string stringFromSubstring(tuple substr) +static std::string stringFromSubstring(std::tuple substr) { - return string(get<0>(substr), get<1>(substr)); + return std::string(std::get<0>(substr), std::get<1>(substr)); } /*! * \brief Returns an std::u16string instance for the substring parsed using parseSubstring(). */ -u16string wideStringFromSubstring(tuple substr, TagTextEncoding encoding) +static std::u16string wideStringFromSubstring(std::tuple substr, TagTextEncoding encoding) { - u16string res(reinterpret_cast(get<0>(substr)), get<1>(substr) / 2); + std::u16string res(reinterpret_cast(std::get<0>(substr)), std::get<1>(substr) / 2); TagValue::ensureHostByteOrder(res, encoding); return res; }