From ba372197fbda68d72857585008061ca5f781f805 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 19 Jan 2014 11:23:02 +0100 Subject: db/simple: make borrowed_song_count "mutable" Simpler to use than const_cast. --- src/db/SimpleDatabasePlugin.cxx | 4 ++-- src/db/SimpleDatabasePlugin.hxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/db/SimpleDatabasePlugin.cxx b/src/db/SimpleDatabasePlugin.cxx index 9b17ada29..c33db3831 100644 --- a/src/db/SimpleDatabasePlugin.cxx +++ b/src/db/SimpleDatabasePlugin.cxx @@ -206,7 +206,7 @@ SimpleDatabase::GetSong(const char *uri, Error &error) const "No such song: %s", uri); #ifndef NDEBUG else - ++const_cast(borrowed_song_count); + ++borrowed_song_count; #endif return song; @@ -219,7 +219,7 @@ SimpleDatabase::ReturnSong(gcc_unused Song *song) const #ifndef NDEBUG assert(borrowed_song_count > 0); - --const_cast(borrowed_song_count); + --borrowed_song_count; #endif } diff --git a/src/db/SimpleDatabasePlugin.hxx b/src/db/SimpleDatabasePlugin.hxx index 5145c0bc8..d51174194 100644 --- a/src/db/SimpleDatabasePlugin.hxx +++ b/src/db/SimpleDatabasePlugin.hxx @@ -37,7 +37,7 @@ class SimpleDatabase : public Database { time_t mtime; #ifndef NDEBUG - unsigned borrowed_song_count; + mutable unsigned borrowed_song_count; #endif SimpleDatabase() -- cgit v1.2.3