fix various compiler warnings and a few minor bugs
This commit is contained in:
@@ -78,7 +78,7 @@ namespace
|
|||||||
}
|
}
|
||||||
if (result.length() > 12)
|
if (result.length() > 12)
|
||||||
result = result.substr(0, 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 += ": ";
|
result += ": ";
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
return DisplaySong(*item.song, &Config.song_list_format, (const Menu<Song> *)menu);
|
||||||
case itPlaylist:
|
case itPlaylist:
|
||||||
return Config.browser_playlist_prefix + item.name;
|
return Config.browser_playlist_prefix + item.name;
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,7 +365,7 @@ string DisplayColumns(string song_template)
|
|||||||
}
|
}
|
||||||
|
|
||||||
v = v.substr(0, width-1);
|
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;
|
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);
|
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())
|
if (!color.empty())
|
||||||
result += open_col + color + close_col;
|
result += open_col + color + close_col;
|
||||||
result += v;
|
result += v;
|
||||||
@@ -494,7 +496,7 @@ string DisplaySong(const Song &s, void *s_template, const Menu<Song> *menu)
|
|||||||
if (!tags_present)
|
if (!tags_present)
|
||||||
it++;
|
it++;
|
||||||
else
|
else
|
||||||
while (*++it != '}');
|
while (*++it != '}') { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,7 +514,7 @@ string DisplaySong(const Song &s, void *s_template, const Menu<Song> *menu)
|
|||||||
if (!tags_present)
|
if (!tags_present)
|
||||||
it++;
|
it++;
|
||||||
else
|
else
|
||||||
while (*it++ != '}');
|
while (*it++ != '}') { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ void * GetArtistInfo(void *ptr)
|
|||||||
int i = result->length();
|
int i = result->length();
|
||||||
if (!isgraph((*result)[i-1]))
|
if (!isgraph((*result)[i-1]))
|
||||||
{
|
{
|
||||||
while (!isgraph((*result)[--i]));
|
while (!isgraph((*result)[--i])) { }
|
||||||
*result = result->substr(0, i+1);
|
*result = result->substr(0, i+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
src/menu.h
10
src/menu.h
@@ -48,7 +48,7 @@ class Menu : public Window
|
|||||||
typedef string (*ItemDisplayer) (const T &, void *, const Menu<T> *);
|
typedef string (*ItemDisplayer) (const T &, void *, const Menu<T> *);
|
||||||
|
|
||||||
public:
|
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 &);
|
Menu(const Menu &);
|
||||||
virtual ~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>;
|
Option<T> *new_option = new Option<T>;
|
||||||
new_option->item = item;
|
new_option->item = item;
|
||||||
new_option->location = lLeft;
|
new_option->location = location;
|
||||||
new_option->have_separator = separator;
|
new_option->have_separator = separator;
|
||||||
new_option->is_static = is_static;
|
new_option->is_static = is_static;
|
||||||
new_option->is_bold = bold;
|
new_option->is_bold = bold;
|
||||||
@@ -365,7 +365,7 @@ void Menu<T>::Refresh(bool redraw_whole_window)
|
|||||||
|
|
||||||
if (itsOptions[*it]->location == lCenter)
|
if (itsOptions[*it]->location == lCenter)
|
||||||
{
|
{
|
||||||
for (; x < (itsWidth-strlength-(!ch ? 4 : 0))/2; x++);
|
x = (itsWidth-strlength-(!ch ? 2 : 0))/2;
|
||||||
if (!ch)
|
if (!ch)
|
||||||
{
|
{
|
||||||
AltCharset(1);
|
AltCharset(1);
|
||||||
@@ -376,8 +376,8 @@ void Menu<T>::Refresh(bool redraw_whole_window)
|
|||||||
}
|
}
|
||||||
if (itsOptions[*it]->location == lRight)
|
if (itsOptions[*it]->location == lRight)
|
||||||
{
|
{
|
||||||
for (; x < (itsWidth-strlength); x++)
|
x = itsWidth-strlength-(!ch ? 2 : 0);
|
||||||
if (!ch)
|
if (!ch)
|
||||||
{
|
{
|
||||||
AltCharset(1);
|
AltCharset(1);
|
||||||
mvwaddstr(itsWindow, line, x, "u ");
|
mvwaddstr(itsWindow, line, x, "u ");
|
||||||
|
|||||||
@@ -373,6 +373,8 @@ int main(int argc, char *argv[])
|
|||||||
case csPlaylistEditor:
|
case csPlaylistEditor:
|
||||||
title = "Playlist editor";
|
title = "Playlist editor";
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (title_allowed)
|
if (title_allowed)
|
||||||
@@ -1258,7 +1260,6 @@ int main(int argc, char *argv[])
|
|||||||
Search(s);
|
Search(s);
|
||||||
if (mSearcher->Back().first == ".")
|
if (mSearcher->Back().first == ".")
|
||||||
{
|
{
|
||||||
bool bold = 0;
|
|
||||||
int found = mSearcher->Size()-search_engine_static_options;
|
int found = mSearcher->Size()-search_engine_static_options;
|
||||||
found += 3; // don't count options inserted below
|
found += 3; // don't count options inserted below
|
||||||
mSearcher->InsertSeparator(14);
|
mSearcher->InsertSeparator(14);
|
||||||
@@ -2130,7 +2131,10 @@ int main(int argc, char *argv[])
|
|||||||
TraceMpdStatus();
|
TraceMpdStatus();
|
||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
for (vector<int>::iterator it = list.begin(); it != list.end(); it++)
|
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->Highlight(list[(list.size()-1)/2]);
|
||||||
mPlaylist->Refresh();
|
mPlaylist->Refresh();
|
||||||
mPlaylist->ReadKey(input);
|
mPlaylist->ReadKey(input);
|
||||||
@@ -2150,7 +2154,8 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
TraceMpdStatus();
|
TraceMpdStatus();
|
||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
mPlaylist->Swap(to--, to);
|
to--;
|
||||||
|
mPlaylist->Swap(to, to+1);
|
||||||
mPlaylist->Go(wUp);
|
mPlaylist->Go(wUp);
|
||||||
mPlaylist->Refresh();
|
mPlaylist->Refresh();
|
||||||
mPlaylist->ReadKey(input);
|
mPlaylist->ReadKey(input);
|
||||||
@@ -2174,7 +2179,10 @@ int main(int argc, char *argv[])
|
|||||||
TraceMpdStatus();
|
TraceMpdStatus();
|
||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
for (vector<int>::iterator it = list.begin(); it != list.end(); it++)
|
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->Highlight(list[(list.size()-1)/2]);
|
||||||
mPlaylistEditor->Refresh();
|
mPlaylistEditor->Refresh();
|
||||||
mPlaylistEditor->ReadKey(input);
|
mPlaylistEditor->ReadKey(input);
|
||||||
@@ -2192,7 +2200,8 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
TraceMpdStatus();
|
TraceMpdStatus();
|
||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
mPlaylistEditor->Swap(to--, to);
|
to--;
|
||||||
|
mPlaylistEditor->Swap(to, to+1);
|
||||||
mPlaylistEditor->Go(wUp);
|
mPlaylistEditor->Go(wUp);
|
||||||
mPlaylistEditor->Refresh();
|
mPlaylistEditor->Refresh();
|
||||||
mPlaylistEditor->ReadKey(input);
|
mPlaylistEditor->ReadKey(input);
|
||||||
@@ -2225,7 +2234,10 @@ int main(int argc, char *argv[])
|
|||||||
TraceMpdStatus();
|
TraceMpdStatus();
|
||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
for (vector<int>::reverse_iterator it = list.rbegin(); it != list.rend(); it++)
|
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->Highlight(list[(list.size()-1)/2]);
|
||||||
mPlaylist->Refresh();
|
mPlaylist->Refresh();
|
||||||
mPlaylist->ReadKey(input);
|
mPlaylist->ReadKey(input);
|
||||||
@@ -2245,7 +2257,8 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
TraceMpdStatus();
|
TraceMpdStatus();
|
||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
mPlaylist->Swap(to++, to);
|
to++;
|
||||||
|
mPlaylist->Swap(to, to-1);
|
||||||
mPlaylist->Go(wDown);
|
mPlaylist->Go(wDown);
|
||||||
mPlaylist->Refresh();
|
mPlaylist->Refresh();
|
||||||
mPlaylist->ReadKey(input);
|
mPlaylist->ReadKey(input);
|
||||||
@@ -2270,7 +2283,10 @@ int main(int argc, char *argv[])
|
|||||||
TraceMpdStatus();
|
TraceMpdStatus();
|
||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
for (vector<int>::reverse_iterator it = list.rbegin(); it != list.rend(); it++)
|
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->Highlight(list[(list.size()-1)/2]);
|
||||||
mPlaylistEditor->Refresh();
|
mPlaylistEditor->Refresh();
|
||||||
mPlaylistEditor->ReadKey(input);
|
mPlaylistEditor->ReadKey(input);
|
||||||
@@ -2288,7 +2304,8 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
TraceMpdStatus();
|
TraceMpdStatus();
|
||||||
timer = time(NULL);
|
timer = time(NULL);
|
||||||
mPlaylistEditor->Swap(to++, to);
|
to++;
|
||||||
|
mPlaylistEditor->Swap(to, to-1);
|
||||||
mPlaylistEditor->Go(wDown);
|
mPlaylistEditor->Go(wDown);
|
||||||
mPlaylistEditor->Refresh();
|
mPlaylistEditor->Refresh();
|
||||||
mPlaylistEditor->ReadKey(input);
|
mPlaylistEditor->ReadKey(input);
|
||||||
@@ -2630,7 +2647,7 @@ int main(int argc, char *argv[])
|
|||||||
ShowMessage("Cannot rename '" + old_name + "' to '" + new_name + "'!");
|
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;
|
string old_name = wCurrent == mPlaylistList ? mPlaylistList->GetOption() : mBrowser->Current().name;
|
||||||
LockStatusbar();
|
LockStatusbar();
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ void Scrollpad::Recreate()
|
|||||||
Write(itsContent.c_str());
|
Write(itsContent.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scrollpad::Refresh(bool stub)
|
void Scrollpad::Refresh(bool)
|
||||||
{
|
{
|
||||||
prefresh(itsWindow,itsBeginning,0,itsStartY,itsStartX,itsStartY+itsHeight-1,itsStartX+itsWidth);
|
prefresh(itsWindow,itsBeginning,0,itsStartY,itsStartX,itsStartY+itsHeight-1,itsStartX+itsWidth);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ namespace
|
|||||||
line = line.substr(i, line.length()-i);
|
line = line.substr(i, line.length()-i);
|
||||||
i = 0;
|
i = 0;
|
||||||
if (line[i] == ' ')
|
if (line[i] == ' ')
|
||||||
while (line[++i] == ' ');
|
while (line[++i] == ' ') { }
|
||||||
line = line.substr(i, line.length()-i);
|
line = line.substr(i, line.length()-i);
|
||||||
i = line.find(" ");
|
i = line.find(" ");
|
||||||
string one;
|
string one;
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ void DefineEmptyTags()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Song::Song(mpd_Song *s, bool copy_ptr) : itsSong(s),
|
Song::Song(mpd_Song *s, bool copy_ptr) : itsSong(s),
|
||||||
isStream(0),
|
|
||||||
itsHash(0),
|
itsHash(0),
|
||||||
copyPtr(copy_ptr),
|
copyPtr(copy_ptr),
|
||||||
|
isStream(0),
|
||||||
itsGetEmptyFields(0)
|
itsGetEmptyFields(0)
|
||||||
{
|
{
|
||||||
string itsFile = itsSong->file ? itsSong->file : "";
|
string itsFile = itsSong->file ? itsSong->file : "";
|
||||||
@@ -284,6 +284,7 @@ Song & Song::operator=(const Song &s)
|
|||||||
copyPtr = s.copyPtr;
|
copyPtr = s.copyPtr;
|
||||||
isStream = s.isStream;
|
isStream = s.isStream;
|
||||||
itsGetEmptyFields = s.itsGetEmptyFields;
|
itsGetEmptyFields = s.itsGetEmptyFields;
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Song::operator==(const Song &s) const
|
bool Song::operator==(const Song &s) const
|
||||||
|
|||||||
@@ -126,13 +126,15 @@ void TraceMpdStatus()
|
|||||||
case psPlay: case psPause:
|
case psPlay: case psPause:
|
||||||
changes.ElapsedTime = 1; // restore status
|
changes.ElapsedTime = 1; // restore status
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
NcmpcppStatusChanged(Mpd, changes, NULL);
|
NcmpcppStatusChanged(Mpd, changes, NULL);
|
||||||
}
|
}
|
||||||
//wHeader->WriteXY(0,1, IntoStr(now_playing), 1);
|
//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)
|
if (errorid == MPD_ACK_ERROR_PERMISSION)
|
||||||
{
|
{
|
||||||
@@ -148,7 +150,7 @@ void NcmpcppErrorCallback(MPDConnection *Mpd, int errorid, string msg, void *dat
|
|||||||
ShowMessage(msg);
|
ShowMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *data)
|
void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *)
|
||||||
{
|
{
|
||||||
int sx, sy;
|
int sx, sy;
|
||||||
wFooter->DisableBB();
|
wFooter->DisableBB();
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ string FindSharedDir(const SongList &v)
|
|||||||
return result;
|
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())
|
switch (static_cast<Menu<string> *>(data)->GetChoice())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -218,12 +218,12 @@ void Window::Display(bool stub)
|
|||||||
Refresh(stub);
|
Refresh(stub);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::Refresh(bool stub)
|
void Window::Refresh(bool)
|
||||||
{
|
{
|
||||||
wrefresh(itsWindow);
|
wrefresh(itsWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::Clear(bool stub)
|
void Window::Clear(bool)
|
||||||
{
|
{
|
||||||
werase(itsWindow);
|
werase(itsWindow);
|
||||||
wrefresh(itsWindow);
|
wrefresh(itsWindow);
|
||||||
|
|||||||
Reference in New Issue
Block a user