]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
fix compile errors with gcc 4.1.x and 4.2.x 242/head
authorAndrew Martin <andrewcmartin@msn.com>
Sun, 10 Feb 2013 09:39:51 +0000 (02:39 -0700)
committerAndrew Martin <andrewcmartin@msn.com>
Sun, 10 Feb 2013 09:39:51 +0000 (02:39 -0700)
 - tested with gcc 4.1.2, 4.2.1, 4.4.6, 4.6.3 and 4.7.2
 - disable gcc ignore pragma for "-Warray-bounds" if gcc version < 4.3
   - when I took out the pragma tvheadend compiled fine in all the above compilers, but I assume some version of gcc is issuing a false-positive.
   - "-Warray-bounds" was added in gcc 4.3: http://gcc.gnu.org/gcc-4.3/changes.html
 - fixes typo in cmdline help for -C
 - clarify usage of -a in help description

src/capmt.c
src/main.c

index 562296040c8c45cedd88af9f607e85a95d3e4cfd..f7c3f894138677b154fc354a1925ffd8b2704435 100644 (file)
 #define CW_DUMP(buf, len, format, ...) \
   printf(format, __VA_ARGS__); int j; for (j = 0; j < len; ++j) printf("%02X ", buf[j]); printf("\n");
 
+#ifdef __GNUC__
+#include <features.h>
+#if __GNUC_PREREQ(4, 3)
 #pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+#endif
+
 #define MAX_CA  4
 #define MAX_INDEX 64
 #define KEY_SIZE  8
index a9a506513388285ebf3537811d1a035705ce98fd..88c4bd55111dde84091ace2b5545fed4df485030 100644 (file)
@@ -388,14 +388,14 @@ main(int argc, char **argv)
     { 'u', "user",      "Run as user",             OPT_STR,  &opt_user    },
     { 'g', "group",     "Run as group",            OPT_STR,  &opt_group   },
     { 'p', "pid",       "Alternate pid path",      OPT_STR,  &opt_pidpath },
-    { 'C', "firstrun",  "If no useraccount exist then create one with\n"
+    { 'C', "firstrun",  "If no user account exists then create one with\n"
                              "no username and no password. Use with care as\n"
                              "it will allow world-wide administrative access\n"
                              "to your Tvheadend installation until you edit\n"
                              "the access-control from within the Tvheadend UI",
       OPT_BOOL, &opt_firstrun },
 #if ENABLE_LINUXDVB
-    { 'a', "adapters",  "Use only specified DVB adapters",
+    { 'a', "adapters",  "Only use specified DVB adapters (comma separated)",
       OPT_STR, &opt_dvb_adapters },
 #endif
     {   0, NULL,         "Server Connectivity",    OPT_BOOL, NULL         },
@@ -474,13 +474,16 @@ main(int argc, char **argv)
   if (!opt_dvb_adapters) {
     adapter_mask = ~0;
   } else {
-    char *p, *r, *e;
+    char *p, *e;
+    char *r = NULL;
+    char *dvb_adapters = strdup(opt_dvb_adapters);
     adapter_mask = 0x0;
-    p = strtok_r((char*)opt_dvb_adapters, ",", &r);
+    p = strtok_r(dvb_adapters, ",", &r);
     while (p) {
       int a = strtol(p, &e, 10);
       if (*e != 0 || a < 0 || a > 31) {
         tvhlog(LOG_ERR, "START", "Invalid adapter number '%s'", p);
+        free(dvb_adapters);
         return 1;
       }
       adapter_mask |= (1 << a);
@@ -488,8 +491,10 @@ main(int argc, char **argv)
     }
     if (!adapter_mask) {
       tvhlog(LOG_ERR, "START", "No adapters specified!");
+      free(dvb_adapters);
       return 1;
     }
+    free(dvb_adapters);
   }
 #endif
   if (tvheadend_webroot) {