fix various compiler warnings and a few minor bugs

This commit is contained in:
unK
2008-10-05 00:26:02 +02:00
parent 5c7b7a04e1
commit f8727b0a10
11 changed files with 51 additions and 29 deletions

View File

@@ -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;
}

View File

@@ -295,6 +295,8 @@ string DisplayItem(const Item &item, void *, const Menu<Item> *menu)
return DisplaySong(*item.song, &Config.song_list_format, (const Menu<Song> *)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<Song> *)
}
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<Song> *menu)
if (!tags_present)
it++;
else
while (*++it != '}');
while (*++it != '}') { }
}
}
@@ -512,7 +514,7 @@ string DisplaySong(const Song &s, void *s_template, const Menu<Song> *menu)
if (!tags_present)
it++;
else
while (*it++ != '}');
while (*it++ != '}') { }
}
}

View File

@@ -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);
}

View File

@@ -48,7 +48,7 @@ class Menu : public Window
typedef string (*ItemDisplayer) (const T &, void *, const Menu<T> *);
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<T>::Insert(int where, const T &item, bool bold, bool is_static, bool s
{
Option<T> *new_option = new Option<T>;
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<T>::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<T>::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 ");

View File

@@ -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<int>::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<int>::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<int>::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<int>::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();

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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

View File

@@ -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();

View File

@@ -93,7 +93,7 @@ string FindSharedDir(const SongList &v)
return result;
}
string DisplayTag(const Song &s, void *data, const Menu<Song> *null)
string DisplayTag(const Song &s, void *data, const Menu<Song> *)
{
switch (static_cast<Menu<string> *>(data)->GetChoice())
{

View File

@@ -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);