readline patches for broken plugins (vdr-1.3.36)

Message ID 436E8B2A.1050704@syphir.sytes.net
State New
Headers

Commit Message

C.Y.M Nov. 6, 2005, 11 p.m. UTC
  I noticed that several plugins that were using the MAXPARSEBUFFER macros have
broke for vdr-1.3.36. The following plugins have been affected:

autotimer-0.1.7
mplayercluster-0.0.1a (with Udo's latest patchset)
playlist-0.0.2
streamplayer-0.1.1
text2skin.cvs
undelete-0.0.3

Here is my attempt at fixing the compile. I'm not much of a programmer, so
please be gentle. :)  I would appreciate any criticism.  BTW, these patches are
not backwards compatible with older versions of vdr, so you have been warned. :)

Thanks.
  

Comments

Gunnar Roth Nov. 7, 2005, 1:15 a.m. UTC | #1
C.Y.M wrote:
> I noticed that several plugins that were using the MAXPARSEBUFFER macros have
> broke for vdr-1.3.36. The following plugins have been affected:
>
>   
Why not simply re-add this macro?
regards,
gunnar
  
C.Y.M Nov. 7, 2005, 1:34 a.m. UTC | #2
Gunnar Roth wrote:
> C.Y.M wrote:
> 
>> I noticed that several plugins that were using the MAXPARSEBUFFER
>> macros have
>> broke for vdr-1.3.36. The following plugins have been affected:
>>
>>   
> 
> Why not simply re-add this macro?

Sure, re-adding the macro is an option.  I thought the point though was to
deprecate that macro?  I dont really know what the proper fix should look like.
 I was just trying to make a quick hack so it would build again. :)  If anyone
has a better method, I would be happy to try it.

Best Regards,
  
Udo Richter Nov. 7, 2005, 1:49 p.m. UTC | #3
C.Y.M wrote:
> I noticed that several plugins that were using the MAXPARSEBUFFER macros have
> broke for vdr-1.3.36. The following plugins have been affected:
> 
> mplayercluster-0.0.1a (with Udo's latest patchset)
> streamplayer-0.1.1

Both are online in a new version. http://urichter.cjb.net/vdr/?l=en

The attached fixes return a locally allocated buffer, thus may crash 
deadly. Instead, use the updated versions.

Since the bug is in the forward compatibility emulation layer, I decided 
to chicken out and continue to use the static 10k buffer.

Cheers,

Udo
  
Sascha Volkenandt Nov. 7, 2005, 8:01 p.m. UTC | #4
On Monday 07 November 2005 00:00, C.Y.M wrote:
> I noticed that several plugins that were using the MAXPARSEBUFFER macros
> have broke for vdr-1.3.36. The following plugins have been affected:
>
> text2skin.cvs

A patch for text2skin has been committed to cvs already.

Greetings,
Sascha
  

Patch

diff -ru undelete-0.0.3.orig/undelete.c undelete-0.0.3/undelete.c
--- undelete-0.0.3.orig/undelete.c	2005-10-04 05:35:15.000000000 -0700
+++ undelete-0.0.3/undelete.c	2005-11-06 14:40:33.000000000 -0800
@@ -305,10 +305,11 @@ 
   asprintf(&p, "%s%s%s", q, *(q + strlen(q) - 1) == '/' ? "" : "/", undeleteconfigfile.u);
   if (!access(undeleteconfigfile.u, F_OK) && !access(undeleteconfigfile.u, R_OK) || !access(p, F_OK) && !access(p, R_OK))
   {
+    char *s;
     #define MAXARGS 100
     int fargc = 1;
     char *fargv[MAXARGS];
-    char buffer[MAXPARSEBUFFER];
+    cReadLine ReadLine;
     bool done;
     FILE *f;
 
@@ -332,9 +333,9 @@ 
       esyslog("%s: ERROR: cannot open config file: [%s]%s", plugin_name, ConfigDirectory(""), undeleteconfigfile.u);
       return false;
     }
-    while (fgets(buffer, sizeof(buffer), f) > 0)
+    while ((s = ReadLine.Read(f)) != NULL)
     {
-      p = skipspace(stripspace(buffer));
+      p = skipspace(stripspace(s));
       q = NULL;
       done = false;
       while (!done)