[mythtv] [PATCH] Strange vbi error messages

Mikael Magnusson 6e0qv4o102 at sneakemail.com
Sat Aug 2 20:17:47 EDT 2003


I have fixed a problem in libvbitext.

Problem the patch will fix:
If mythbackend can't open the vbi device when changing to WathingLiveTV, 
a strange error message is printed and then it exits.

With the patch applied, a correct error message is printed and the 
program doesn't exit.


Regards

Mikael Magnusson

-------------- next part --------------
Index: lang.c
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libvbitext/lang.c,v
retrieving revision 1.1
diff -u -r1.1 lang.c
--- lang.c	31 Jan 2003 14:35:48 -0000	1.1
+++ lang.c	2 Aug 2003 14:49:56 -0000
@@ -202,11 +202,12 @@
                switch (mode)
                {
                    case 15: // char from G2 set
-                       if (adr < VT_WIDTH && row < VT_HEIGHT)
+		       if (adr < VT_WIDTH && row < VT_HEIGHT) {
                            if (latin1)
                                vtp->data[row][adr] = g2map_latin1[data-32];
                            else
                                vtp->data[row][adr] = g2map_latin2[data-32];
+		       }
                        break;
                    case 16 ... 31: // char from G0 set with diacritical mark
                        if (adr < VT_WIDTH && row < VT_HEIGHT)
@@ -214,11 +215,12 @@
                            struct mark *mark = marks + (mode - 16);
                            unsigned char *x;
 
-                           if (x = strchr(mark->g0, data))
+                           if ( (x = strchr(mark->g0, data)) ) {
                                if (latin1)
                                    data = mark->latin1[x - mark->g0];
                                else
                                    data = mark->latin2[x - mark->g0];
+			   }
                            vtp->data[row][adr] = data;
                        }
                        break;
Index: libvbitext.pro
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libvbitext/libvbitext.pro,v
retrieving revision 1.3
diff -u -r1.3 libvbitext.pro
--- libvbitext.pro	15 Apr 2003 18:10:36 -0000	1.3
+++ libvbitext.pro	2 Aug 2003 14:49:56 -0000
@@ -1,7 +1,7 @@
 
 TEMPLATE = lib
 TARGET = vbitext
-CONFIG += thread staticlib warn_off
+CONFIG += thread staticlib
 
 include ( ../../settings.pro )
 include ( ../../config.mak )
Index: vbi.c
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libvbitext/vbi.c,v
retrieving revision 1.2
diff -u -r1.2 vbi.c
--- vbi.c	31 Jul 2003 17:25:46 -0000	1.2
+++ vbi.c	2 Aug 2003 14:49:56 -0000
@@ -4,6 +4,7 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <sys/ioctl.h>
+#include <stdarg.h>
 //#include "os.h"
 #include "vt.h"
 #include "vbi.h"
@@ -62,6 +63,16 @@
 
 /***** end of api definitions *****/
 
+static void
+error(char *str, ...)
+{
+    va_list ap;
+
+    va_start(ap, str);
+    vfprintf(stderr, str, ap);
+    fprintf(stderr, "\n");
+    va_end(ap);
+}
 
 
 static void
@@ -90,7 +101,8 @@
     ev->i3 = i3;
     ev->p1 = p1;
 
-    for (cl = (void*) vbi->clients->first; cln = (void*) cl->node->next; cl = cln)
+    for (cl = (void*) vbi->clients->first; (cln = (void*) cl->node->next);
+	 cl = cln)
        cl->handler(cl->data, ev);
 }
 
@@ -396,11 +408,12 @@
            if (data[0] != 0x27)        // really 11100100? (rev order!)
                return -1;
 
-           if (i = vt_line(vbi, data+1))
+           if ( (i = vt_line(vbi, data+1)) ) {
                if (i < 0)
                    pll_add(vbi, 2, -i);
                else
                    pll_add(vbi, 1, i);
+	   }
            return 0;
        }
     return -1;


More information about the mythtv-dev mailing list