File xineliboutput-1.0.4-const.diff of Package vdr-plugin-xineliboutput
Index: xineliboutput-1.0.4/config.c
===================================================================
--- xineliboutput-1.0.4.orig/config.c
+++ xineliboutput-1.0.4/config.c
@@ -253,7 +253,7 @@ static char *strcatrealloc(char *dest, c
bool config_t::IsPlaylistFile(const char *fname)
{
if(fname) {
- char *pos = strrchr(fname,'.');
+ const char *pos = strrchr(fname,'.');
if(pos) {
pos++;
if(!strcasecmp(pos, "pls") ||
@@ -269,7 +269,7 @@ bool config_t::IsPlaylistFile(const char
bool config_t::IsAudioFile(const char *fname)
{
if(fname) {
- char *pos = strrchr(fname,'.');
+ const char *pos = strrchr(fname,'.');
if(pos) {
pos++;
if(!strcasecmp(pos, "mpa") ||
@@ -298,7 +298,7 @@ bool config_t::IsAudioFile(const char *f
bool config_t::IsVideoFile(const char *fname)
{
if(fname) {
- char *pos = strrchr(fname,'.');
+ const char *pos = strrchr(fname,'.');
if(pos) {
pos++;
if(!strcasecmp(pos, "avi") ||
@@ -334,7 +334,7 @@ bool config_t::IsVideoFile(const char *f
bool config_t::IsImageFile(const char *fname)
{
if(fname) {
- char *pos = strrchr(fname,'.');
+ const char *pos = strrchr(fname,'.');
if(pos) {
pos++;
if(!strcasecmp(pos, "jpg") ||
@@ -660,7 +660,7 @@ bool config_t::ProcessArgs(int argc, cha
bool config_t::SetupParse(const char *Name, const char *Value)
{
- char *pt;
+ const char *pt;
if(*m_ProcessedArgs && NULL != (pt=strstr(m_ProcessedArgs+1, Name)) &&
*(pt-1) == ' ' && *(pt+strlen(Name)) == ' ') {
LOGDBG("Skipping configuration entry %s=%s (overridden in command line)", Name, Value);
Index: xineliboutput-1.0.4/frontend.c
===================================================================
--- xineliboutput-1.0.4.orig/frontend.c
+++ xineliboutput-1.0.4/frontend.c
@@ -621,12 +621,13 @@ bool cXinelibThread::LogoDisplay(void)
int fd = -1;
if(Setup.FileName()) {
- cString SetupPath = Setup.FileName();
+ char* SetupPath = strdup(Setup.FileName());
char *end = strrchr(SetupPath, '/');
if(end) {
*end = 0;
fd = open(Path=cString::sprintf("%s/plugins/xineliboutput/logo.mpv", *SetupPath), O_RDONLY);
}
+ free(SetupPath);
}
if(fd<0)
Index: xineliboutput-1.0.4/frontend_svr.c
===================================================================
--- xineliboutput-1.0.4.orig/frontend_svr.c
+++ xineliboutput-1.0.4/frontend_svr.c
@@ -1332,7 +1332,7 @@ void cXinelibServer::Handle_Control_HTTP
else if(!strncmp(m_State[cli]->Uri(), "/PLAYFILE", 9)) {
if( *m_FileName && m_bPlayingFile) {
- char *pos = strstr(m_FileName, "#subtitle:");
+ char *pos = strstr(const_cast<char*>(*m_FileName), "#subtitle:");
if(pos) *pos = 0;
bool Allow = ( !strcmp_escaped(m_FileName, m_State[cli]->Uri() + 9)
|| (pos && !strcmp_escaped(pos + 10, m_State[cli]->Uri() + 9)));
Index: xineliboutput-1.0.4/menu.c
===================================================================
--- xineliboutput-1.0.4.orig/menu.c
+++ xineliboutput-1.0.4/menu.c
@@ -92,7 +92,7 @@ static char *ParentDir(const char *dir)
static char *LastDir(const char *dir)
{
- char *pt = strrchr(dir, '/');
+ const char *pt = strrchr(dir, '/');
if(pt && pt[0] && pt[1])
return strdup(pt+1);
return NULL;
@@ -399,7 +399,7 @@ bool cMenuBrowseFiles::ScanDir(const cha
// separate subtitles ?
subfile = cString::sprintf("%s/%s____", DirName, e->d_name);
- char *p = strrchr(subfile, '.');
+ char *p = strrchr(const_cast<char*>(*subfile), '.');
if( p ) {
int i;
for(i=0; xc.s_subExts[i] && !subs; i++) {
Index: xineliboutput-1.0.4/menuitems.c
===================================================================
--- xineliboutput-1.0.4.orig/menuitems.c
+++ xineliboutput-1.0.4/menuitems.c
@@ -174,7 +174,7 @@ void cFileListItem::Set(void)
txt = cString::sprintf("\t\t[%s] ", *m_Name); // text2skin requires space at end of string to display item correctly ...
} else {
txt = cString::sprintf("%c\t%c\t%s", m_HasResume ? ' ' : '*', *m_SubFile ? 'S' : m_IsDvd ? 'D' : ' ', *m_Name);
- if(NULL != (pt = strrchr(txt,'.')))
+ if(NULL != (pt = strrchr(const_cast<char*>(*txt),'.')))
*pt = 0;
}
} else {
@@ -182,7 +182,7 @@ void cFileListItem::Set(void)
txt = cString::sprintf("[%s] ", *m_Name); // text2skin requires space at end of string to display item correctly ...
} else {
txt = m_Name;
- if(NULL != (pt = strrchr(txt,'.')))
+ if(NULL != (pt = strrchr(const_cast<char*>(*txt),'.')))
*pt = 0;
}
}
Index: xineliboutput-1.0.4/setup_menu.c
===================================================================
--- xineliboutput-1.0.4.orig/setup_menu.c
+++ xineliboutput-1.0.4/setup_menu.c
@@ -456,7 +456,7 @@ struct tvtime_s {
judder_correction = strstr(str, "judder_correction=0") ? 0 : 1;
use_progressive_frame_flag = strstr(str, "use_progressive_frame_flag=0") ? 0 : 1;
method=1;
- char *m = strstr(str, "method=");
+ const char *m = strstr(str, "method=");
if(m) {
char *tmp = strdup(m + 7);
if(strchr(tmp, ','))
Index: xineliboutput-1.0.4/tools/http.c
===================================================================
--- xineliboutput-1.0.4.orig/tools/http.c
+++ xineliboutput-1.0.4/tools/http.c
@@ -297,7 +297,7 @@ bool cHttpStreamer::Seek(void)
}
/* content type */
- char *ext = strrchr(m_Filename, '.');
+ char *ext = strrchr(const_cast<char*>(*m_Filename), '.');
if(ext) {
const char *mime = mimetype(ext+1);
if(mime)
Index: xineliboutput-1.0.4/tools/playlist.c
===================================================================
--- xineliboutput-1.0.4.orig/tools/playlist.c
+++ xineliboutput-1.0.4/tools/playlist.c
@@ -48,12 +48,12 @@ cPlaylistItem::cPlaylistItem(const char
Filename = filename;
Position = -1;
- if(NULL != (pt = strrchr(filename, '/')))
+ if(NULL != (pt = strrchr(const_cast<char*>(filename), '/')))
Title = pt + 1;
else
Title = filename;
- if(NULL != (pt = strrchr(Title, '.')))
+ if(NULL != (pt = strrchr(const_cast<char*>(*Title), '.')))
*pt = 0;
}
@@ -71,7 +71,7 @@ cPlaylistItem::cPlaylistItem(const char
Position = position;
Title = title ?: filename;
- if(!title && (pt = strrchr(Title, '.')))
+ if(!title && (pt = strrchr(const_cast<char*>(*Title), '.')))
*pt = 0;
}
@@ -762,7 +762,7 @@ int cPlaylist::ReadPlaylist(const char *
if(f) {
LOGDBG("cPlaylist: parsing %s", file);
- char *pt = strrchr(file, '.');
+ char *pt = strrchr(const_cast<char*>(file), '.');
if(!strcasecmp(pt, ".pls"))
parser = new cPlsReader(*this);
else if(!strcasecmp(pt, ".asx"))
@@ -771,7 +771,7 @@ int cPlaylist::ReadPlaylist(const char *
parser = new cM3uReader(*this); /* parses plain lists (.ram, ...) too ...*/
cString Base(file);
- if(NULL != (pt=strrchr(Base,'/')))
+ if(NULL != (pt=strrchr(const_cast<char*>(*Base),'/')))
pt[1]=0;
int n = 0;
@@ -837,10 +837,10 @@ int cPlaylist::ReadPlaylist(const char *
static cString LastDir(cString& path)
{
cString tmp = strdup(path);
- char *pt = strrchr(tmp, '/');
+ char *pt = strrchr(const_cast<char*>(*tmp), '/');
if(pt && pt > *tmp) {
*pt = 0;
- pt = strrchr(tmp, '/');
+ pt = strrchr(const_cast<char*>(*tmp), '/');
if(pt)
return cString(pt+1);
}
@@ -856,7 +856,7 @@ bool cPlaylist::Read(const char *Playlis
if(!*m_Folder) {
m_Folder = PlaylistFile;
if(strrchr(m_Folder, '/'))
- *(strrchr(m_Folder, '/') + 1) = 0;
+ *(strrchr(const_cast<char*>(*m_Folder), '/') + 1) = 0;
}
if(xc.IsPlaylistFile(PlaylistFile)) {
@@ -865,7 +865,7 @@ bool cPlaylist::Read(const char *Playlis
m_Origin = ePlaylist;
cString dir = LastDir(m_Folder);
- char *name = strrchr(PlaylistFile, '/');
+ char *name = strrchr(const_cast<char*>(PlaylistFile), '/');
name = name ? name+1 : NULL;
if(*dir && name)
m_Name = cString::sprintf("%s - %s", *dir, name);
@@ -873,7 +873,7 @@ bool cPlaylist::Read(const char *Playlis
m_Name = name ?: "";
if(strrchr(m_Name, '.'))
- *(strrchr(m_Name, '.')) = 0;
+ *(strrchr(const_cast<char*>(*m_Name), '.')) = 0;
} else if(PlaylistFile[ 0] == '/' &&
PlaylistFile[strlen(PlaylistFile)-1] == '/') {
@@ -884,7 +884,7 @@ bool cPlaylist::Read(const char *Playlis
if(!*m_Name) {
m_Name = PlaylistFile;
- *(strrchr(m_Name, '/')) = 0;
+ *(strrchr(const_cast<char*>(*m_Name), '/')) = 0;
if(strrchr(m_Name, '/')) {
cString dir = LastDir(m_Name);
if(*dir)