get rid of C style casts
This commit is contained in:
@@ -416,7 +416,7 @@ void Browser::GetDirectory(string dir, string subdir)
|
|||||||
{
|
{
|
||||||
Item parent;
|
Item parent;
|
||||||
size_t slash = dir.rfind("/");
|
size_t slash = dir.rfind("/");
|
||||||
parent.song = (Song *) 1; // in that way we assume that's really parent dir
|
parent.song = reinterpret_cast<Song *>(1); // in that way we assume that's really parent dir
|
||||||
parent.name = slash != string::npos ? dir.substr(0, slash) : "/";
|
parent.name = slash != string::npos ? dir.substr(0, slash) : "/";
|
||||||
parent.type = itDirectory;
|
parent.type = itDirectory;
|
||||||
utf_to_locale(parent.name);
|
utf_to_locale(parent.name);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace
|
|||||||
|
|
||||||
iconv_t cd = iconv_open(to, from);
|
iconv_t cd = iconv_open(to, from);
|
||||||
|
|
||||||
if (cd == (iconv_t)-1)
|
if (cd == iconv_t(-1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!len)
|
if (!len)
|
||||||
@@ -72,7 +72,7 @@ namespace
|
|||||||
char *outstart = outbuf;
|
char *outstart = outbuf;
|
||||||
char *instart = inbuf;
|
char *instart = inbuf;
|
||||||
|
|
||||||
if (iconv(cd, const_cast<ICONV_CONST char **>(&inbuf), &len, &outbuf, &buflen) == (size_t)-1)
|
if (iconv(cd, const_cast<ICONV_CONST char **>(&inbuf), &len, &outbuf, &buflen) == size_t(-1))
|
||||||
{
|
{
|
||||||
delete [] outstart;
|
delete [] outstart;
|
||||||
iconv_close(cd);
|
iconv_close(cd);
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ namespace MPD
|
|||||||
void Shuffle() const;
|
void Shuffle() const;
|
||||||
void ClearPlaylist() const;
|
void ClearPlaylist() const;
|
||||||
|
|
||||||
PlayerState GetState() const { return isConnected && itsCurrentStatus ? (PlayerState)itsCurrentStatus->state : psUnknown; }
|
PlayerState GetState() const { return isConnected && itsCurrentStatus ? PlayerState(itsCurrentStatus->state) : psUnknown; }
|
||||||
bool GetRepeat() const { return isConnected && itsCurrentStatus ? itsCurrentStatus->repeat : 0; }
|
bool GetRepeat() const { return isConnected && itsCurrentStatus ? itsCurrentStatus->repeat : 0; }
|
||||||
bool GetRandom() const { return isConnected && itsCurrentStatus ? itsCurrentStatus->random : 0; }
|
bool GetRandom() const { return isConnected && itsCurrentStatus ? itsCurrentStatus->random : 0; }
|
||||||
bool GetSingle() const { return isConnected && itsCurrentStatus ? itsCurrentStatus->single : 0; }
|
bool GetSingle() const { return isConnected && itsCurrentStatus ? itsCurrentStatus->single : 0; }
|
||||||
|
|||||||
@@ -223,17 +223,17 @@ int main(int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
*wHeader << XY(0, 0)
|
*wHeader << XY(0, 0)
|
||||||
<< fmtBold << (char)Key.Help[0] << fmtBoldEnd << ":Help "
|
<< fmtBold << char(Key.Help[0]) << fmtBoldEnd << ":Help "
|
||||||
<< fmtBold << (char)Key.Playlist[0] << fmtBoldEnd << ":Playlist "
|
<< fmtBold << char(Key.Playlist[0]) << fmtBoldEnd << ":Playlist "
|
||||||
<< fmtBold << (char)Key.Browser[0] << fmtBoldEnd << ":Browse "
|
<< fmtBold << char(Key.Browser[0]) << fmtBoldEnd << ":Browse "
|
||||||
<< fmtBold << (char)Key.SearchEngine[0] << fmtBoldEnd << ":Search "
|
<< fmtBold << char(Key.SearchEngine[0]) << fmtBoldEnd << ":Search "
|
||||||
<< fmtBold << (char)Key.MediaLibrary[0] << fmtBoldEnd << ":Library "
|
<< fmtBold << char(Key.MediaLibrary[0]) << fmtBoldEnd << ":Library "
|
||||||
<< fmtBold << (char)Key.PlaylistEditor[0] << fmtBoldEnd << ":Playlist editor";
|
<< fmtBold << char(Key.PlaylistEditor[0]) << fmtBoldEnd << ":Playlist editor";
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
*wHeader << " " << fmtBold << (char)Key.TagEditor[0] << fmtBoldEnd << ":Tag editor";
|
*wHeader << " " << fmtBold << char(Key.TagEditor[0]) << fmtBoldEnd << ":Tag editor";
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
# ifdef ENABLE_CLOCK
|
# ifdef ENABLE_CLOCK
|
||||||
*wHeader << " " << fmtBold << (char)Key.Clock[0] << fmtBoldEnd << ":Clock";
|
*wHeader << " " << fmtBold << char(Key.Clock[0]) << fmtBoldEnd << ":Clock";
|
||||||
# endif // ENABLE_CLOCK
|
# endif // ENABLE_CLOCK
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -985,7 +985,7 @@ int main(int argc, char *argv[])
|
|||||||
wFooter->Bold(1);
|
wFooter->Bold(1);
|
||||||
string tracklength = "[" + Song::ShowTime(songpos) + "/" + s->GetLength() + "]";
|
string tracklength = "[" + Song::ShowTime(songpos) + "/" + s->GetLength() + "]";
|
||||||
*wFooter << XY(wFooter->GetWidth()-tracklength.length(), 1) << tracklength;
|
*wFooter << XY(wFooter->GetWidth()-tracklength.length(), 1) << tracklength;
|
||||||
double progressbar_size = (double)songpos/(s->GetTotalLength());
|
double progressbar_size = songpos/double(s->GetTotalLength());
|
||||||
int howlong = wFooter->GetWidth()*progressbar_size;
|
int howlong = wFooter->GetWidth()*progressbar_size;
|
||||||
|
|
||||||
mvwhline(wFooter->Raw(), 0, 0, 0, wFooter->GetWidth());
|
mvwhline(wFooter->Raw(), 0, 0, 0, wFooter->GetWidth());
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ void SearchEngine::EnterPressed()
|
|||||||
size_t found = w->Size()-SearchEngine::StaticOptions;
|
size_t found = w->Size()-SearchEngine::StaticOptions;
|
||||||
found += 3; // don't count options inserted below
|
found += 3; // don't count options inserted below
|
||||||
w->InsertSeparator(ResetButton+1);
|
w->InsertSeparator(ResetButton+1);
|
||||||
w->InsertOption(ResetButton+2, std::make_pair((Buffer *)0, (Song *)0), 1, 1);
|
w->InsertOption(ResetButton+2, std::make_pair(static_cast<Buffer *>(0), static_cast<Song *>(0)), 1, 1);
|
||||||
w->at(ResetButton+2).first = new Buffer();
|
w->at(ResetButton+2).first = new Buffer();
|
||||||
*w->at(ResetButton+2).first << Config.color1 << "Search results: " << Config.color2 << "Found " << found << (found > 1 ? " songs" : " song") << clDefault;
|
*w->at(ResetButton+2).first << Config.color1 << "Search results: " << Config.color2 << "Found " << found << (found > 1 ? " songs" : " song") << clDefault;
|
||||||
w->InsertSeparator(ResetButton+3);
|
w->InsertSeparator(ResetButton+3);
|
||||||
@@ -599,7 +599,7 @@ void SearchEngine::Search()
|
|||||||
if (found && any_found)
|
if (found && any_found)
|
||||||
{
|
{
|
||||||
Song *ss = Config.search_in_db ? *it : new Song(**it);
|
Song *ss = Config.search_in_db ? *it : new Song(**it);
|
||||||
w->AddOption(std::make_pair((Buffer *)0, ss));
|
w->AddOption(std::make_pair(static_cast<Buffer *>(0), ss));
|
||||||
list[it-list.begin()] = 0;
|
list[it-list.begin()] = 0;
|
||||||
}
|
}
|
||||||
found = 1;
|
found = 1;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace
|
|||||||
|
|
||||||
Border IntoBorder(const string &color)
|
Border IntoBorder(const string &color)
|
||||||
{
|
{
|
||||||
return (Border) IntoColor(color);
|
return Border(IntoColor(color));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *)
|
|||||||
}
|
}
|
||||||
if (!block_progressbar_update)
|
if (!block_progressbar_update)
|
||||||
{
|
{
|
||||||
double progressbar_size = (double)elapsed/(np.GetTotalLength());
|
double progressbar_size = elapsed/double(np.GetTotalLength());
|
||||||
int howlong = wFooter->GetWidth()*progressbar_size;
|
int howlong = wFooter->GetWidth()*progressbar_size;
|
||||||
wFooter->SetColor(Config.progressbar_color);
|
wFooter->SetColor(Config.progressbar_color);
|
||||||
mvwhline(wFooter->Raw(), 0, 0, 0, wFooter->GetWidth());
|
mvwhline(wFooter->Raw(), 0, 0, 0, wFooter->GetWidth());
|
||||||
|
|||||||
@@ -558,7 +558,7 @@ string Window::GetString(const string &base, size_t length, size_t width, bool e
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
tmp_in += input;
|
tmp_in += input;
|
||||||
if ((int)mbrtowc(&wc_in, tmp_in.c_str(), MB_CUR_MAX, 0) < 0)
|
if (int(mbrtowc(&wc_in, tmp_in.c_str(), MB_CUR_MAX, 0)) < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (wcwidth(wc_in) > 1)
|
if (wcwidth(wc_in) > 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user