movieplayer: reindent callInfoViewer()

make the callInfoViewer() function more readable by reindenting
it, additionally fix a theoretically possible buffer overflow in
the filename copying code

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@892 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
seife
2010-11-27 14:15:43 +00:00
parent 65b1e20a83
commit 3a4fffc4ce

View File

@@ -1266,28 +1266,35 @@ printf("CMoviePlayerGui::PlayFile: exit, isMovieBrowser %d p_movie_info %x\n", i
if (g_settings.mode_clock) if (g_settings.mode_clock)
InfoClock->StartClock(); InfoClock->StartClock();
} }
void CMoviePlayerGui::callInfoViewer(const std::string & epg_title, const std::string & epg_info1, const std::string & epg_channel, const int duration, const int curr_pos)
void CMoviePlayerGui::callInfoViewer(const std::string & epg_title, const std::string & epg_info1,
const std::string & epg_channel, const int duration, const int curr_pos)
{ {
if (isMovieBrowser) { if (isMovieBrowser) {
g_InfoViewer->showMovieTitle(playstate, epg_channel.c_str(), epg_title, epg_info1, duration, curr_pos); g_InfoViewer->showMovieTitle(playstate, epg_channel.c_str(), epg_title, epg_info1,
} else { duration, curr_pos);
char temp_name[255]; return;
const char *slash = strrchr(filename, '/'); }
if (slash) {
slash++; /* not moviebrowser => use the filename as title */
int len = strlen(slash); char temp_name[255] = { 0 };
for (int i = 0; i < len; i++) { const char *slash = strrchr(filename, '/');
if (slash[i] == '_') if (slash) {
temp_name[i] = ' '; slash++;
else int len = strlen(slash);
temp_name[i] = slash[i]; if (len > 254)
} len = 254;
temp_name[len] = 0; for (int i = 0; i < len; i++) {
} if (slash[i] == '_')
// g_InfoViewer->showTitle(0, temp_name, 0, 0); // UTF-8 temp_name[i] = ' ';
g_InfoViewer->showMovieTitle(playstate, temp_name, "", "", duration, curr_pos); else
} temp_name[i] = slash[i];
}
temp_name[len] = 0;
}
g_InfoViewer->showMovieTitle(playstate, temp_name, "", "", duration, curr_pos);
} }
void CMoviePlayerGui::showHelpTS() void CMoviePlayerGui::showHelpTS()
{ {
Helpbox helpbox; Helpbox helpbox;