diff --git a/asc2log.c b/asc2log.c index 40a1c13..2da2e38 100644 --- a/asc2log.c +++ b/asc2log.c @@ -192,7 +192,7 @@ static void eval_can(char* buf, struct timeval *date_tvp, char timestamps, struct canfd_frame cf = { 0 }; struct can_frame *ccf = (struct can_frame *)&cf; /* for len8_dlc */ char rtr; - int dlc = 0; + unsigned int dlc = 0; int len = 0; int data[8]; char idstr[21]; @@ -300,7 +300,7 @@ static void eval_canfd(char* buf, struct timeval *date_tvp, char timestamps, struct canfd_frame cf = { 0 }; unsigned char brs, esi; unsigned int flags; - int dlc, dlen = 0; + unsigned int dlc, dlen = 0; char idstr[21]; char dir[5]; /* 'Rx'/'Tx'/'TxRq' plus terminating zero */ char *ptr; @@ -319,12 +319,12 @@ static void eval_canfd(char* buf, struct timeval *date_tvp, char timestamps, */ /* check for valid line without symbolic name */ - if (sscanf(buf, "%llu.%llu %*s %d %4s %20s %hhx %hhx %x %d %n", + if (sscanf(buf, "%llu.%llu %*s %d %4s %20s %hhx %hhx %x %u %n", &sec, &usec, &interface, dir, idstr, &brs, &esi, &dlc, &dlen, &n) != 9) { /* check for valid line with a symbolic name */ - if (sscanf(buf, "%llu.%llu %*s %d %4s %20s %*s %hhx %hhx %x %d %n", + if (sscanf(buf, "%llu.%llu %*s %d %4s %20s %*s %hhx %hhx %x %u %n", &sec, &usec, &interface, dir, idstr, &brs, &esi, &dlc, &dlen, &n) != 9) { @@ -412,7 +412,7 @@ static void eval_canxl_cc(char* buf, struct timeval *date_tvp, char timestamps, static struct timeval read_tv; /* frame timestamp from ASC file */ struct can_frame cf = { 0 }; unsigned int flags; - int dlc, dlen = 0; + unsigned int dlc, dlen = 0; char idstr[21]; char dir[5]; /* 'Rx'/'Tx'/'TxRq' plus terminating zero */ char *ptr; @@ -430,7 +430,7 @@ static void eval_canxl_cc(char* buf, struct timeval *date_tvp, char timestamps, if (sscanf(buf, "%llu.%llu %*s %d %4s " /* time, CANXL, channel, direction */ "%*s %*s %*s %20s " /* frame format, msg dur, bit count, ID */ - "%x %d %n", /* DLC, Datalen */ + "%x %u %n", /* DLC, Datalen */ &sec, &usec, &interface, dir, idstr, &dlc, &dlen, &n) != 7) { @@ -438,7 +438,7 @@ static void eval_canxl_cc(char* buf, struct timeval *date_tvp, char timestamps, if (sscanf(buf, "%llu.%llu %*s %d %4s " /* time, CANXL, channel, direction */ "%*s %*s %*s %20s " /* frame format, msg dur, bit count, ID */ - "%*s %x %d %n", /* sym name, DLC, Datalen */ + "%*s %x %u %n", /* sym name, DLC, Datalen */ &sec, &usec, &interface, dir, idstr, &dlc, &dlen, &n) != 7) { @@ -509,7 +509,7 @@ static void eval_canxl_fd(char* buf, struct timeval *date_tvp, char timestamps, static struct timeval read_tv; /* frame timestamp from ASC file */ struct canfd_frame cf = { 0 }; unsigned int flags; - int dlc, dlen = 0; + unsigned int dlc, dlen = 0; char idstr[21]; char dir[5]; /* 'Rx'/'Tx'/'TxRq' plus terminating zero */ char *ptr; @@ -527,7 +527,7 @@ static void eval_canxl_fd(char* buf, struct timeval *date_tvp, char timestamps, if (sscanf(buf, "%llu.%llu %*s %d %4s " /* time, CANXL, channel, direction */ "%*s %*s %*s %20s " /* frame format, msg dur, bit count, ID */ - "%x %d %n", /* DLC, Datalen */ + "%x %u %n", /* DLC, Datalen */ &sec, &usec, &interface, dir, idstr, &dlc, &dlen, &n) != 7) { @@ -535,7 +535,7 @@ static void eval_canxl_fd(char* buf, struct timeval *date_tvp, char timestamps, if (sscanf(buf, "%llu.%llu %*s %d %4s " /* time, CANXL, channel, direction */ "%*s %*s %*s %20s " /* frame format, msg dur, bit count, ID */ - "%*s %x %d %n", /* sym name, DLC, Datalen */ + "%*s %x %u %n", /* sym name, DLC, Datalen */ &sec, &usec, &interface, dir, idstr, &dlc, &dlen, &n) != 7) { @@ -603,7 +603,7 @@ static void eval_canxl_xl(char* buf, struct timeval *date_tvp, char timestamps, struct canxl_frame cf = { 0 }; unsigned char sdt, vcid, secbit; unsigned int af, flags; - int dlc, dlen = 0; + unsigned int dlc, dlen = 0; char idstr[21]; char dir[5]; /* 'Rx'/'Tx'/'TxRq' plus terminating zero */ char *ptr; @@ -622,7 +622,7 @@ static void eval_canxl_xl(char* buf, struct timeval *date_tvp, char timestamps, if (sscanf(buf, "%llu.%llu %*s %d %4s " /* time, CANXL, channel, direction */ "%*s %*s %*s %20s " /* frame format, msg dur, bit count, ID */ - "%hhx %hhx %x %d " /* SDT, SEC, DLC, Datalen */ + "%hhx %hhx %x %u " /* SDT, SEC, DLC, Datalen */ "%*s %*s %hhx %x %n", /* stuff bit count, crc, VCID, AF */ &sec, &usec, &interface, dir, idstr, @@ -632,7 +632,7 @@ static void eval_canxl_xl(char* buf, struct timeval *date_tvp, char timestamps, if (sscanf(buf, "%llu.%llu %*s %d %4s " /* time, CANXL, channel, direction */ "%*s %*s %*s %20s " /* frame format, msg dur, bit count, ID */ - "%*s %hhx %hhx %x %d " /* sym name, SDT, SEC, DLC, Datalen */ + "%*s %hhx %hhx %x %u " /* sym name, SDT, SEC, DLC, Datalen */ "%*s %*s %hhx %x %n", /* stuff bit count, crc, VCID, AF */ &sec, &usec, &interface, dir, idstr,