fix compile errors with gcc 4.1.x and 4.2.x

- 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
This commit is contained in:
Andrew Martin 2013-02-10 02:39:51 -07:00
parent 79c134f9c4
commit eaec34220b
2 changed files with 15 additions and 4 deletions

View file

@ -75,7 +75,13 @@
#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

View 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) {