This patch is against dvb-apps 1281. Following is what has been done:
1. atsc_epg bug fix: when ETM message gets longer than 256 characters, the last
character was chopped, due to incorrect calling to snprintf().
2. atsc_epg code cleanup:
- white space added after keywords;
- hard wrap around column 80 removed;
- one-line conditional statement now w/o brackets.
3. scan Makefile workaround for building in gcc4.4/kernel 2.6.30 was not picked
up in 1279, include again.
Regards,
Signed-off-by: Yufei Yuan yfy...@gmail.com
diff -upr dvb-apps/util/atsc_epg/atsc_epg.c
dvb-apps_local/util/atsc_epg/atsc_epg.c
--- dvb-apps/util/atsc_epg/atsc_epg.c 2009-06-20 11:54:20.393986790 -0500
+++ dvb-apps_local/util/atsc_epg/atsc_epg.c 2009-06-20 12:09:08.0
-0500
@@ -168,9 +168,8 @@ void *(*table_callback[16])(struct atsc_
static void int_handler(int sig_num)
{
- if(SIGINT != sig_num) {
+ if (SIGINT != sig_num)
return;
- }
ctrl_c = 1;
}
@@ -219,8 +218,9 @@ static void help(void)
static int close_frontend(struct dvbfe_handle *fe)
{
- if(NULL == fe) {
+ if (NULL == fe) {
fprintf(stderr, %s(): NULL pointer detected\n, __FUNCTION__);
+ return -1;
}
dvbfe_close(fe);
@@ -232,22 +232,20 @@ static int open_frontend(struct dvbfe_ha
{
struct dvbfe_info fe_info;
- if(NULL == (*fe = dvbfe_open(adapter, 0, 0))) {
- fprintf(stderr, %s(): error calling dvbfe_open()\n,
- __FUNCTION__);
+ if (NULL == (*fe = dvbfe_open(adapter, 0, 0))) {
+ fprintf(stderr, %s(): error calling dvbfe_open()\n,
__FUNCTION__);
return -1;
}
dvbfe_get_info(*fe, 0, fe_info, DVBFE_INFO_QUERYTYPE_IMMEDIATE, 0);
- if(DVBFE_TYPE_ATSC != fe_info.type) {
- fprintf(stderr, %s(): only ATSC frontend supported
currently\n,
- __FUNCTION__);
+ if (DVBFE_TYPE_ATSC != fe_info.type) {
+ fprintf(stderr, %s(): only ATSC frontend supported
currently\n, __FUNCTION__);
return -1;
}
fe_info.feparams.frequency = frequency;
fe_info.feparams.inversion = DVBFE_INVERSION_AUTO;
fe_info.feparams.u.atsc.modulation = DVBFE_ATSC_MOD_VSB_8;
fprintf(stdout, tuning to %d Hz, please wait...\n, frequency);
- if(dvbfe_set(*fe, fe_info.feparams, TIMEOUT * 1000)) {
+ if (dvbfe_set(*fe, fe_info.feparams, TIMEOUT * 1000)) {
fprintf(stderr, %s(): cannot lock to %d Hz in %d seconds\n,
__FUNCTION__, frequency, TIMEOUT);
return -1;
@@ -257,7 +255,7 @@ static int open_frontend(struct dvbfe_ha
return 0;
}
-#if ENABLE_RRT
+#ifdef ENABLE_RRT
/* this is untested as since this part of the library is broken */
static int parse_rrt(int dmxfd)
{
@@ -270,20 +268,18 @@ static int parse_rrt(int dmxfd)
i = 0;
fprintf(stdout, waiting for RRT: );
fflush(stdout);
- while(i RRT_TIMEOUT) {
+ while (i RRT_TIMEOUT) {
ret = atsc_scan_table(dmxfd, ATSC_BASE_PID, tag, (void **)rrt);
- if(0 ret) {
- fprintf(stderr, %s(): error calling
atsc_scan_table()\n,
- __FUNCTION__);
+ if (0 ret) {
+ fprintf(stderr, %s(): error calling
atsc_scan_table()\n, __FUNCTION__);
return -1;
}
- if(0 == ret) {
- if(RRT_TIMEOUT i) {
+ if (0 == ret) {
+ if (RRT_TIMEOUT i) {
fprintf(stdout, .);
fflush(stdout);
} else {
- fprintf(stdout, \nno RRT in %d seconds\n,
- RRT_TIMEOUT);
+ fprintf(stdout, \nno RRT in %d seconds\n,
RRT_TIMEOUT);
return 0;
}
i += TIMEOUT;
@@ -301,14 +297,13 @@ static int parse_rrt(int dmxfd)
atsc_text_string_segments_for_each(atsc_str, seg, j) {
const char *c;
int k;
- if(seg-mode 0x3E) {
- fprintf(stderr, %s(): text mode of 0x%02X
- not supported yet\n,
- __FUNCTION__, seg-mode);
+
+ if (seg-mode 0x3E) {
+ fprintf(stderr, %s(): text mode of 0x%02X not
supported yet\n, __FUNCTION__, seg-mode);
return -1;
}
c = (const char *)atsc_text_string_segment_bytes(seg);
- for(k = 0; k seg-number_bytes; k++) {
+