Fix types

This commit is contained in:
prpr 2024-04-01 22:41:05 +01:00
parent edf589944c
commit 09b1fc7466
4 changed files with 24 additions and 21 deletions

11
epg.c
View File

@ -236,8 +236,7 @@ parse(char *epgpath,
if ((filterflags &
(FILTER_TIMESTAMP | FILTER_TIMERANGE)))
{
time_t tm;
int dur;
time_t tm, dur;
tm = mjd(d->start_date, d->start_hour,
d->start_min, d->start_sec);
@ -248,7 +247,9 @@ parse(char *epgpath,
if ((filterflags & FILTER_TIMESTAMP))
{
if (!check_filter_range(filter,
FILTER_TIMESTAMP, tm, tm + dur))
FILTER_TIMESTAMP,
(unsigned long) tm,
(unsigned long) (tm + dur)))
{
/* Skip this event. */
epg->offset = dend;
@ -258,7 +259,9 @@ parse(char *epgpath,
if ((filterflags & FILTER_TIMERANGE))
{
if (!check_filter_timerange(filter,
FILTER_TIMERANGE, tm, tm + dur))
FILTER_TIMERANGE,
(unsigned long) tm,
(unsigned long) (tm + dur)))
{
/* Skip this event. */
epg->offset = dend;

2
lint.h
View File

@ -20,7 +20,7 @@ inline uint32_t read_uint32(uint8_t *, int);
void hexdump(uint8_t *, uint32_t, uint32_t);
char *hexstr(uint8_t *, uint32_t);
char *ctime_nl(time_t *);
time_t mjd(uint16_t, int, int, int);
time_t mjd(unsigned int, unsigned int, unsigned int, unsigned int);
void safeprintf(char *, ...);
void uncompress_epg(char **, unsigned int *);
void iso6937_convert(char **, unsigned int *);

24
main.c
View File

@ -314,9 +314,9 @@ sqlitedump(struct epg *epg __attribute__((unused)),
sqlite3_bind_int(stmt, 1, s->service_id);
sqlite3_bind_int(stmt, 2, d->event_id);
sqlite3_bind_int(stmt, 3, tm);
sqlite3_bind_int(stmt, 4, tm + dur);
sqlite3_bind_int(stmt, 5, dur);
sqlite3_bind_int64(stmt, 3, tm);
sqlite3_bind_int64(stmt, 4, tm + dur);
sqlite3_bind_int64(stmt, 5, dur);
if (ds[PARSER_SHORT_EVENT])
{
@ -390,7 +390,7 @@ sqlitedump(struct epg *epg __attribute__((unused)),
#endif /* HAVE_SQLITE3 */
static int json_service_id = 0;
static unsigned int json_service_id = 0;
void
jsonstart()
@ -741,7 +741,7 @@ dump(struct epg *epg __attribute__((unused)),
if (sysopts & SYSOPT_BRIEF)
{
safeprintf("%d/%d: %s+%d\n",
s->service_id, d->event_id, ctime_nl(&tm),
s->service_id, d->event_id, ctime_nl(&tm),
d->dur_hour * 3600 + d->dur_min * 60 + d->dur_sec);
if (ds[PARSER_SHORT_EVENT])
{
@ -921,7 +921,8 @@ main(int argc, char **argv)
case '/':
{
unsigned long dstart, dend, dat;
unsigned long dstart, dend;
time_t dat;
struct tm *tm;
GETOPT;
@ -929,14 +930,13 @@ main(int argc, char **argv)
/* If specified as number of days, then convert
* to timestamp. */
if (dat < 1000)
dat = (unsigned long)time(NULL) +
dat * 86400;
tm = localtime((time_t *)&dat);
dat = time(NULL) + dat * 86400;
tm = localtime(&dat);
tm->tm_hour = tm->tm_min = tm->tm_sec = 0;
dstart = mktime(tm);
dstart = (unsigned long) mktime(tm);
tm->tm_hour = 23;
tm->tm_min = tm->tm_sec = 59;
dend = mktime(tm);
dend = (unsigned long) mktime(tm);
add_epgfilter(&filter, FILTER_TIMESTAMP,
dstart, dend, NULL, FT_RANGE);
@ -1098,7 +1098,7 @@ nextopt:
time_t tm;
time(&tm);
add_epgfilter(&filter, FILTER_TIMESTAMP, tm, 0, NULL, FT_EQUAL);
add_epgfilter(&filter, FILTER_TIMESTAMP, (unsigned long) tm, 0, NULL, FT_EQUAL);
parse(epgpath, dump, NULL, filter);
}
else if (!strcmp(argv[0], "search") && argc > 1)

8
util.c
View File

@ -99,16 +99,16 @@ safeprintf(char *fmt, ...)
}
time_t
mjd(uint16_t day, int h, int m, int s)
mjd(unsigned int day, unsigned int h, unsigned int m, unsigned int s)
{
time_t tm;
struct tm *t;
tm = MJD_TO_UNIX(day);
t = gmtime(&tm);
t->tm_hour = h;
t->tm_min = m;
t->tm_sec = s;
t->tm_hour = (int) h;
t->tm_min = (int) m;
t->tm_sec = (int) s;
return mktime(t);
}