make it compile with -O2 -Werror

This commit is contained in:
Andrzej Rybczak
2012-08-14 02:24:22 +02:00
parent 23a612e184
commit 456c855adb
3 changed files with 9 additions and 4 deletions

View File

@@ -18,6 +18,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/ ***************************************************************************/
#include <cassert>
#include <cstring> #include <cstring>
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
@@ -298,7 +299,7 @@ int CaseInsensitiveStringComparison::operator()(const std::string &a, const std:
bool CaseInsensitiveSorting::operator()(const MPD::Item &a, const MPD::Item &b) bool CaseInsensitiveSorting::operator()(const MPD::Item &a, const MPD::Item &b)
{ {
bool result; bool result = false;
if (a.type == b.type) if (a.type == b.type)
{ {
switch (a.type) switch (a.type)
@@ -323,6 +324,8 @@ bool CaseInsensitiveSorting::operator()(const MPD::Item &a, const MPD::Item &b)
break; break;
} }
break; break;
default: // there is no other option, silence compiler
assert(false);
} }
} }
else else

View File

@@ -375,9 +375,10 @@ void Lyrics::Edit()
ShowMessage("Opening lyrics in external editor..."); ShowMessage("Opening lyrics in external editor...");
GNUC_UNUSED int res;
if (Config.use_console_editor) if (Config.use_console_editor)
{ {
system(("/bin/sh -c \"" + Config.external_editor + " \\\"" + itsFilename + "\\\"\"").c_str()); res = system(("/bin/sh -c \"" + Config.external_editor + " \\\"" + itsFilename + "\\\"\"").c_str());
// below is needed as screen gets cleared, but apparently // below is needed as screen gets cleared, but apparently
// ncurses doesn't know about it, so we need to reload main screen // ncurses doesn't know about it, so we need to reload main screen
endwin(); endwin();
@@ -385,7 +386,7 @@ void Lyrics::Edit()
curs_set(0); curs_set(0);
} }
else else
system(("nohup " + Config.external_editor + " \"" + itsFilename + "\" > /dev/null 2>&1 &").c_str()); res = system(("nohup " + Config.external_editor + " \"" + itsFilename + "\" > /dev/null 2>&1 &").c_str());
} }
#ifdef HAVE_CURL_CURL_H #ifdef HAVE_CURL_CURL_H

View File

@@ -386,8 +386,9 @@ void NcmpcppStatusChanged(MPD::Connection *, MPD::StatusChanges changed, void *)
{ {
if (myPlaylist->isPlaying()) if (myPlaylist->isPlaying())
{ {
GNUC_UNUSED int res;
if (!Config.execute_on_song_change.empty()) if (!Config.execute_on_song_change.empty())
system(Config.execute_on_song_change.c_str()); res = system(Config.execute_on_song_change.c_str());
# ifdef HAVE_CURL_CURL_H # ifdef HAVE_CURL_CURL_H
if (Config.fetch_lyrics_in_background) if (Config.fetch_lyrics_in_background)