diff --git a/src/help.cpp b/src/help.cpp index 6a8dbad1..f67d589d 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -78,7 +78,7 @@ namespace } if (result.length() > 12) result = result.substr(0, 12); - for (int i = result.length(); i <= 12; result += " ", i++); + for (int i = result.length(); i <= 12; result += " ", i++) { } result += ": "; return result; } diff --git a/src/helpers.cpp b/src/helpers.cpp index d84c71e7..d56610ee 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -295,6 +295,8 @@ string DisplayItem(const Item &item, void *, const Menu *menu) return DisplaySong(*item.song, &Config.song_list_format, (const Menu *)menu); case itPlaylist: return Config.browser_playlist_prefix + item.name; + default: + return ""; } } @@ -363,7 +365,7 @@ string DisplayColumns(string song_template) } v = v.substr(0, width-1); - for (int i = v.length(); i < width; i++, v += " "); + for (int i = v.length(); i < width; i++, v += " ") { } result += v; } @@ -457,7 +459,7 @@ string DisplaySongInColumns(const Song &s, void *s_template, const Menu *) } v = TO_WSTRING(Window::OmitBBCodes(ss)).substr(0, width-1); - for (int i = v.length(); i < width; i++, v += space); + for (int i = v.length(); i < width; i++, v += space) { } if (!color.empty()) result += open_col + color + close_col; result += v; @@ -494,7 +496,7 @@ string DisplaySong(const Song &s, void *s_template, const Menu *menu) if (!tags_present) it++; else - while (*++it != '}'); + while (*++it != '}') { } } } @@ -512,7 +514,7 @@ string DisplaySong(const Song &s, void *s_template, const Menu *menu) if (!tags_present) it++; else - while (*it++ != '}'); + while (*it++ != '}') { } } } diff --git a/src/lyrics.cpp b/src/lyrics.cpp index a4dc973a..2703bac1 100644 --- a/src/lyrics.cpp +++ b/src/lyrics.cpp @@ -186,7 +186,7 @@ void * GetArtistInfo(void *ptr) int i = result->length(); if (!isgraph((*result)[i-1])) { - while (!isgraph((*result)[--i])); + while (!isgraph((*result)[--i])) { } *result = result->substr(0, i+1); } diff --git a/src/menu.h b/src/menu.h index 25d473b5..aae039ca 100644 --- a/src/menu.h +++ b/src/menu.h @@ -48,7 +48,7 @@ class Menu : public Window typedef string (*ItemDisplayer) (const T &, void *, const Menu *); public: - Menu(int startx, int starty, int width, int height, string title, Color color, Border border) : itsItemDisplayer(0), itsItemDisplayerUserdata(0), Window(startx, starty, width, height, title, color, border), itsSelectedPrefix("[.r]"), itsSelectedSuffix("[/r]"), itsStaticsNumber(0), itsBeginning(0), itsHighlight(0), itsHighlightColor(itsBaseColor), itsHighlightEnabled(1) { } + Menu(int startx, int starty, int width, int height, string title, Color color, Border border) : Window(startx, starty, width, height, title, color, border), itsItemDisplayer(0), itsItemDisplayerUserdata(0), itsSelectedPrefix("[.r]"), itsSelectedSuffix("[/r]"), itsStaticsNumber(0), itsBeginning(0), itsHighlight(0), itsHighlightColor(itsBaseColor), itsHighlightEnabled(1) { } Menu(const Menu &); virtual ~Menu(); @@ -284,7 +284,7 @@ void Menu::Insert(int where, const T &item, bool bold, bool is_static, bool s { Option *new_option = new Option; new_option->item = item; - new_option->location = lLeft; + new_option->location = location; new_option->have_separator = separator; new_option->is_static = is_static; new_option->is_bold = bold; @@ -365,7 +365,7 @@ void Menu::Refresh(bool redraw_whole_window) if (itsOptions[*it]->location == lCenter) { - for (; x < (itsWidth-strlength-(!ch ? 4 : 0))/2; x++); + x = (itsWidth-strlength-(!ch ? 2 : 0))/2; if (!ch) { AltCharset(1); @@ -376,8 +376,8 @@ void Menu::Refresh(bool redraw_whole_window) } if (itsOptions[*it]->location == lRight) { - for (; x < (itsWidth-strlength); x++) - if (!ch) + x = itsWidth-strlength-(!ch ? 2 : 0); + if (!ch) { AltCharset(1); mvwaddstr(itsWindow, line, x, "u "); diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index 2ae75937..b083299b 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -373,6 +373,8 @@ int main(int argc, char *argv[]) case csPlaylistEditor: title = "Playlist editor"; break; + default: + break; } if (title_allowed) @@ -1258,7 +1260,6 @@ int main(int argc, char *argv[]) Search(s); if (mSearcher->Back().first == ".") { - bool bold = 0; int found = mSearcher->Size()-search_engine_static_options; found += 3; // don't count options inserted below mSearcher->InsertSeparator(14); @@ -2130,7 +2131,10 @@ int main(int argc, char *argv[]) TraceMpdStatus(); timer = time(NULL); for (vector::iterator it = list.begin(); it != list.end(); it++) - mPlaylist->Swap(--*it, *it); + { + (*it)--; + mPlaylist->Swap(*it, (*it)+1); + } mPlaylist->Highlight(list[(list.size()-1)/2]); mPlaylist->Refresh(); mPlaylist->ReadKey(input); @@ -2150,7 +2154,8 @@ int main(int argc, char *argv[]) { TraceMpdStatus(); timer = time(NULL); - mPlaylist->Swap(to--, to); + to--; + mPlaylist->Swap(to, to+1); mPlaylist->Go(wUp); mPlaylist->Refresh(); mPlaylist->ReadKey(input); @@ -2174,7 +2179,10 @@ int main(int argc, char *argv[]) TraceMpdStatus(); timer = time(NULL); for (vector::iterator it = list.begin(); it != list.end(); it++) - mPlaylistEditor->Swap(--*it, *it); + { + (*it)--; + mPlaylistEditor->Swap(*it, (*it)+1); + } mPlaylistEditor->Highlight(list[(list.size()-1)/2]); mPlaylistEditor->Refresh(); mPlaylistEditor->ReadKey(input); @@ -2192,7 +2200,8 @@ int main(int argc, char *argv[]) { TraceMpdStatus(); timer = time(NULL); - mPlaylistEditor->Swap(to--, to); + to--; + mPlaylistEditor->Swap(to, to+1); mPlaylistEditor->Go(wUp); mPlaylistEditor->Refresh(); mPlaylistEditor->ReadKey(input); @@ -2225,7 +2234,10 @@ int main(int argc, char *argv[]) TraceMpdStatus(); timer = time(NULL); for (vector::reverse_iterator it = list.rbegin(); it != list.rend(); it++) - mPlaylist->Swap(++*it, *it); + { + (*it)++; + mPlaylist->Swap(*it, (*it)-1); + } mPlaylist->Highlight(list[(list.size()-1)/2]); mPlaylist->Refresh(); mPlaylist->ReadKey(input); @@ -2245,7 +2257,8 @@ int main(int argc, char *argv[]) { TraceMpdStatus(); timer = time(NULL); - mPlaylist->Swap(to++, to); + to++; + mPlaylist->Swap(to, to-1); mPlaylist->Go(wDown); mPlaylist->Refresh(); mPlaylist->ReadKey(input); @@ -2270,7 +2283,10 @@ int main(int argc, char *argv[]) TraceMpdStatus(); timer = time(NULL); for (vector::reverse_iterator it = list.rbegin(); it != list.rend(); it++) - mPlaylistEditor->Swap(++*it, *it); + { + (*it)++; + mPlaylistEditor->Swap(*it, (*it)-1); + } mPlaylistEditor->Highlight(list[(list.size()-1)/2]); mPlaylistEditor->Refresh(); mPlaylistEditor->ReadKey(input); @@ -2288,7 +2304,8 @@ int main(int argc, char *argv[]) { TraceMpdStatus(); timer = time(NULL); - mPlaylistEditor->Swap(to++, to); + to++; + mPlaylistEditor->Swap(to, to-1); mPlaylistEditor->Go(wDown); mPlaylistEditor->Refresh(); mPlaylistEditor->ReadKey(input); @@ -2630,7 +2647,7 @@ int main(int argc, char *argv[]) ShowMessage("Cannot rename '" + old_name + "' to '" + new_name + "'!"); } }*/ - else if (wCurrent == mPlaylistList || wCurrent == mBrowser && mBrowser->Current().type == itPlaylist) + else if (wCurrent == mPlaylistList || (wCurrent == mBrowser && mBrowser->Current().type == itPlaylist)) { string old_name = wCurrent == mPlaylistList ? mPlaylistList->GetOption() : mBrowser->Current().name; LockStatusbar(); diff --git a/src/scrollpad.cpp b/src/scrollpad.cpp index ea39ca1f..29290ee4 100644 --- a/src/scrollpad.cpp +++ b/src/scrollpad.cpp @@ -123,7 +123,7 @@ void Scrollpad::Recreate() Write(itsContent.c_str()); } -void Scrollpad::Refresh(bool stub) +void Scrollpad::Refresh(bool) { prefresh(itsWindow,itsBeginning,0,itsStartY,itsStartX,itsStartY+itsHeight-1,itsStartX+itsWidth); } diff --git a/src/settings.cpp b/src/settings.cpp index 23223241..b83051ab 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -281,7 +281,7 @@ namespace line = line.substr(i, line.length()-i); i = 0; if (line[i] == ' ') - while (line[++i] == ' '); + while (line[++i] == ' ') { } line = line.substr(i, line.length()-i); i = line.find(" "); string one; diff --git a/src/song.cpp b/src/song.cpp index 96d2c5b3..73f97a50 100644 --- a/src/song.cpp +++ b/src/song.cpp @@ -48,9 +48,9 @@ void DefineEmptyTags() } Song::Song(mpd_Song *s, bool copy_ptr) : itsSong(s), - isStream(0), itsHash(0), copyPtr(copy_ptr), + isStream(0), itsGetEmptyFields(0) { string itsFile = itsSong->file ? itsSong->file : ""; @@ -284,6 +284,7 @@ Song & Song::operator=(const Song &s) copyPtr = s.copyPtr; isStream = s.isStream; itsGetEmptyFields = s.itsGetEmptyFields; + return *this; } bool Song::operator==(const Song &s) const diff --git a/src/status_checker.cpp b/src/status_checker.cpp index 1eea3702..7c05b998 100644 --- a/src/status_checker.cpp +++ b/src/status_checker.cpp @@ -126,13 +126,15 @@ void TraceMpdStatus() case psPlay: case psPause: changes.ElapsedTime = 1; // restore status break; + default: + break; } NcmpcppStatusChanged(Mpd, changes, NULL); } //wHeader->WriteXY(0,1, IntoStr(now_playing), 1); } -void NcmpcppErrorCallback(MPDConnection *Mpd, int errorid, string msg, void *data) +void NcmpcppErrorCallback(MPDConnection *Mpd, int errorid, string msg, void *) { if (errorid == MPD_ACK_ERROR_PERMISSION) { @@ -148,7 +150,7 @@ void NcmpcppErrorCallback(MPDConnection *Mpd, int errorid, string msg, void *dat ShowMessage(msg); } -void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *data) +void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *) { int sx, sy; wFooter->DisableBB(); diff --git a/src/tag_editor.cpp b/src/tag_editor.cpp index 436f0881..cd40e01a 100644 --- a/src/tag_editor.cpp +++ b/src/tag_editor.cpp @@ -93,7 +93,7 @@ string FindSharedDir(const SongList &v) return result; } -string DisplayTag(const Song &s, void *data, const Menu *null) +string DisplayTag(const Song &s, void *data, const Menu *) { switch (static_cast *>(data)->GetChoice()) { diff --git a/src/window.cpp b/src/window.cpp index 94bb7699..ed62935c 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -218,12 +218,12 @@ void Window::Display(bool stub) Refresh(stub); } -void Window::Refresh(bool stub) +void Window::Refresh(bool) { wrefresh(itsWindow); } -void Window::Clear(bool stub) +void Window::Clear(bool) { werase(itsWindow); wrefresh(itsWindow);