Re: [vdr] Build failures with gcc 4.4
Klaus Schmidinger wrote: On 04.06.2009 09:12, Ludwig Nussel wrote: ... So gcc 4.4 finally hit openSUSE as well. I use the attached patch to make vdr compile. Seems to work fine too. The code that requires those const casts is really ugly though. How about the attached change? Should apply to VDR 1.6 just as well. Looks better indeed. I've added it to the vdr package in the build service now. cu Ludwig -- (o_ Ludwig Nussel //\ V_/_ http://www.suse.de/ SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] Build failures with gcc 4.4
On 04.06.2009 09:12, Ludwig Nussel wrote: ... So gcc 4.4 finally hit openSUSE as well. I use the attached patch to make vdr compile. Seems to work fine too. The code that requires those const casts is really ugly though. How about the attached change? Should apply to VDR 1.6 just as well. Klaus --- svdrp.c 2009/06/06 13:42:52 2.4 +++ svdrp.c 2009/06/06 14:03:55 @@ -798,16 +798,17 @@ char RealFileName[PATH_MAX]; if (FileName) { if (grabImageDir) { - cString s; - char *slash = strrchr(FileName, '/'); + cString s(FileName); + FileName = s; + const char *slash = strrchr(FileName, '/'); if (!slash) { s = AddDirectory(grabImageDir, FileName); FileName = s; } slash = strrchr(FileName, '/'); // there definitely is one - *slash = 0; - char *r = realpath(FileName, RealFileName); - *slash = '/'; + cString t(s); + t.Truncate(slash - FileName); + char *r = realpath(t, RealFileName); if (!r) { LOG_ERROR_STR(FileName); Reply(501, Invalid file name \%s\, FileName); ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] Build failures with gcc 4.4
Ville Skyttä wrote: On Friday 27 February 2009, Ville Skyttä wrote: I'm trying to build VDR 1.6.0-2 for the upcoming Fedora 11 release which has gcc 4.4. There are a bunch of compilation errors as gcc has again become less forgiving for C++ than it used to be. One very common source of problems is explained here: http://markmail.org/message/e5y6atneqztuvpw6#query: +page:1+mid:hdkehz7bgl5b6vgc+state:results There are quite a few of these problems in VDR 1.6.0-2 (error: invalid conversion from 'const char*' to 'char*'). I started patching but quickly realized that this is a job for someone who actually knows what he's doing. [...] ...but until there's a real fix available, the attached ugly patch at least makes the build succeed with gcc 4.4. So gcc 4.4 finally hit openSUSE as well. I use the attached patch to make vdr compile. Seems to work fine too. The code that requires those const casts is really ugly though. cu Ludwig -- (o_ Ludwig Nussel //\ V_/_ http://www.suse.de/ SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) Index: vdr-1.6.0/recording.c === --- vdr-1.6.0.orig/recording.c +++ vdr-1.6.0/recording.c @@ -509,8 +509,8 @@ cRecording::cRecording(cTimer *Timer, co Utf8Strn0Cpy(SubtitleBuffer, Subtitle, MAX_SUBTITLE_LENGTH); Subtitle = SubtitleBuffer; } - char *macroTITLE = strstr(Timer-File(), TIMERMACRO_TITLE); - char *macroEPISODE = strstr(Timer-File(), TIMERMACRO_EPISODE); + const char *macroTITLE = strstr(Timer-File(), TIMERMACRO_TITLE); + const char *macroEPISODE = strstr(Timer-File(), TIMERMACRO_EPISODE); if (macroTITLE || macroEPISODE) { name = strdup(Timer-File()); name = strreplace(name, TIMERMACRO_TITLE, Title); @@ -551,7 +551,7 @@ cRecording::cRecording(const char *FileN sortBuffer = NULL; fileName = strdup(FileName); FileName += strlen(VideoDirectory) + 1; - char *p = strrchr(FileName, '/'); + const char *p = strrchr(FileName, '/'); name = NULL; info = new cRecordingInfo; @@ -1022,7 +1022,8 @@ void cRecordings::DelByName(const char * if (recording) { cThreadLock DeletedRecordingsLock(DeletedRecordings); Del(recording, false); - char *ext = strrchr(recording-FileName(), '.'); + // wtf? + char *ext = strrchr(const_castchar*(recording-FileName()), '.'); if (ext) { strncpy(ext, DELEXT, strlen(ext)); recording-fileSizeMB = DirSizeMB(recording-FileName()); Index: vdr-1.6.0/svdrp.c === --- vdr-1.6.0.orig/svdrp.c +++ vdr-1.6.0/svdrp.c @@ -736,7 +736,7 @@ void cSVDRP::CmdGRAB(const char *Option) char *strtok_next; FileName = strtok_r(p, delim, strtok_next); // image type: - char *Extension = strrchr(FileName, '.'); + const char *Extension = strrchr(FileName, '.'); if (Extension) { if (strcasecmp(Extension, .jpg) == 0 || strcasecmp(Extension, .jpeg) == 0) Jpeg = true; @@ -796,12 +796,12 @@ void cSVDRP::CmdGRAB(const char *Option) if (FileName) { if (grabImageDir) { cString s; - char *slash = strrchr(FileName, '/'); + char *slash = strrchr(const_castchar*(FileName), '/'); if (!slash) { s = AddDirectory(grabImageDir, FileName); FileName = s; } - slash = strrchr(FileName, '/'); // there definitely is one + slash = strrchr(const_castchar*(FileName), '/'); // there definitely is one *slash = 0; char *r = realpath(FileName, RealFileName); *slash = '/'; ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] Build failures with gcc 4.4
On Friday 27 February 2009, Ville Skyttä wrote: Hello, I'm trying to build VDR 1.6.0-2 for the upcoming Fedora 11 release which has gcc 4.4. There are a bunch of compilation errors as gcc has again become less forgiving for C++ than it used to be. One very common source of problems is explained here: http://markmail.org/message/e5y6atneqztuvpw6#query: +page:1+mid:hdkehz7bgl5b6vgc+state:results There are quite a few of these problems in VDR 1.6.0-2 (error: invalid conversion from 'const char*' to 'char*'). I started patching but quickly realized that this is a job for someone who actually knows what he's doing. [...] ...but until there's a real fix available, the attached ugly patch at least makes the build succeed with gcc 4.4. diff -up vdr-1.6.0/Makefile~ vdr-1.6.0/Makefile --- vdr-1.6.0/Makefile~ 2008-02-29 23:43:03.0 +0200 +++ vdr-1.6.0/Makefile 2009-04-14 19:10:22.0 +0300 @@ -82,6 +82,10 @@ all: vdr i18n %.o: %.c $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $ +recording.o: CXXFLAGS += -fpermissive +svdrp.o: CXXFLAGS += -fpermissive +videodir.o: CXXFLAGS += -fpermissive + # Dependencies: MAKEDEP = $(CXX) -MM -MG ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
[vdr] Build failures with gcc 4.4
Hello, I'm trying to build VDR 1.6.0-2 for the upcoming Fedora 11 release which has gcc 4.4. There are a bunch of compilation errors as gcc has again become less forgiving for C++ than it used to be. One very common source of problems is explained here: http://markmail.org/message/e5y6atneqztuvpw6#query: +page:1+mid:hdkehz7bgl5b6vgc+state:results There are quite a few of these problems in VDR 1.6.0-2 (error: invalid conversion from 'const char*' to 'char*'). I started patching but quickly realized that this is a job for someone who actually knows what he's doing. Anyway, attached is a patch against VDR 1.6.0-2 that fixes the first few of these errors. Approach with caution: I'm fairly confident that for example the changes to cRecordings::DelByName are not the right thing to do but then again I might not understand what it's doing anyway (changing the extension of the filename to .del but not actually renaming the file accordingly?). In addition to these errors, similar ones exist at least in StatNearestDir (videodir.c) cSVDRP::CmdGRAB. Help appreciated! By the way, in case someone runs into it, some recent changes in DVB headers (as in current Fedora devel) have caused other unrelated compilation issues, -D__KERNEL_STRICT_NAMES appears to be needed to get compilation past dvbdevice.c. See https://bugzilla.redhat.com/show_bug.cgi?id=483644 diff -up vdr-1.6.0/recording.c~ vdr-1.6.0/recording.c --- vdr-1.6.0/recording.c~ 2008-02-24 12:28:53.0 +0200 +++ vdr-1.6.0/recording.c 2009-02-27 21:18:55.0 +0200 @@ -509,8 +509,8 @@ cRecording::cRecording(cTimer *Timer, co Utf8Strn0Cpy(SubtitleBuffer, Subtitle, MAX_SUBTITLE_LENGTH); Subtitle = SubtitleBuffer; } - char *macroTITLE = strstr(Timer-File(), TIMERMACRO_TITLE); - char *macroEPISODE = strstr(Timer-File(), TIMERMACRO_EPISODE); + const char *macroTITLE = strstr(Timer-File(), TIMERMACRO_TITLE); + const char *macroEPISODE = strstr(Timer-File(), TIMERMACRO_EPISODE); if (macroTITLE || macroEPISODE) { name = strdup(Timer-File()); name = strreplace(name, TIMERMACRO_TITLE, Title); @@ -551,7 +551,7 @@ cRecording::cRecording(const char *FileN sortBuffer = NULL; fileName = strdup(FileName); FileName += strlen(VideoDirectory) + 1; - char *p = strrchr(FileName, '/'); + const char *p = strrchr(FileName, '/'); name = NULL; info = new cRecordingInfo; @@ -1022,15 +1022,17 @@ void cRecordings::DelByName(const char * if (recording) { cThreadLock DeletedRecordingsLock(DeletedRecordings); Del(recording, false); - char *ext = strrchr(recording-FileName(), '.'); + char *NewName = strdup(recording-FileName()); + char *ext = strrchr(NewName, '.'); if (ext) { strncpy(ext, DELEXT, strlen(ext)); -recording-fileSizeMB = DirSizeMB(recording-FileName()); +recording-fileSizeMB = DirSizeMB(NewName); recording-deleted = time(NULL); DeletedRecordings.Add(recording); } else delete recording; + free(NewName); ChangeState(); TouchUpdate(); } ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr