--- This is a convenience patch to silence gcc warnings if compiled with '-Wsign-compare' option. It does not change the runtime behavior of the binaries (or even harm them) in any way.
Signed-off-by: Henry Jesuiter <[email protected]> --- diff -rwbBu a/clock.c b/clock.c --- a/clock.c 2015-09-19 16:25:11.000000000 +0200 +++ b/clock.c 2016-07-08 12:13:34.432060911 +0200 @@ -1453,7 +1453,7 @@ shift = c->freq_est_interval - n; if (shift < 0) shift = 0; - else if (shift >= sizeof(int) * 8) { + else if (shift >= (int) sizeof(int) * 8) { shift = sizeof(int) * 8 - 1; pr_warning("freq_est_interval is too long"); } @@ -1462,7 +1462,7 @@ shift = c->stats_interval - n; if (shift < 0) shift = 0; - else if (shift >= sizeof(int) * 8) { + else if (shift >= (int) sizeof(int) * 8) { shift = sizeof(int) * 8 - 1; pr_warning("summary_interval is too long"); } diff -rwbBu a/config.c b/config.c --- a/config.c 2016-07-07 13:13:44.465579808 +0200 +++ b/config.c 2016-07-08 12:12:08.290888481 +0200 @@ -622,7 +622,7 @@ char buf[CONFIG_LABEL_SIZE + 8]; struct config_item *ci; struct config *cfg; - int i; + size_t i; cfg = calloc(1, sizeof(*cfg)); if (!cfg) { diff -rwbBu a/msg.c b/msg.c --- a/msg.c 2015-09-19 16:25:11.000000000 +0200 +++ b/msg.c 2016-07-08 12:15:09.729147448 +0200 @@ -126,7 +126,7 @@ if (!ptr) return 0; - for (cnt = 0; len > sizeof(struct TLV); cnt++) { + for (cnt = 0; len > (int) sizeof(struct TLV); cnt++) { tlv = (struct TLV *) ptr; tlv->type = ntohs(tlv->type); tlv->length = ntohs(tlv->length); @@ -228,7 +228,7 @@ int pdulen, type, err; uint8_t *suffix = NULL; - if (cnt < sizeof(struct ptp_header)) + if (cnt < (int) sizeof(struct ptp_header)) return -EBADMSG; err = hdr_post_recv(&m->header); diff -rwbBu a/phc2sys.c b/phc2sys.c --- a/phc2sys.c 2015-09-19 16:25:11.000000000 +0200 +++ b/phc2sys.c 2016-07-08 12:12:08.290888481 +0200 @@ -1026,7 +1026,7 @@ struct port *port; struct clock *clock; int number_ports, res; - unsigned int i; + int i; int state, timestamping; char iface[IFNAMSIZ]; diff -rwbBu a/pmc.c b/pmc.c --- a/pmc.c 2015-09-19 16:25:11.000000000 +0200 +++ b/pmc.c 2016-07-08 12:12:08.290888481 +0200 @@ -621,7 +621,8 @@ static int parse_id(char *s) { - int i, index = BAD_ID, len = strlen(s); + size_t i; + int index = BAD_ID, len = strlen(s); /* check for exact match */ for (i = 0; i < ARRAY_SIZE(idtab); i++) { if (strcasecmp(s, idtab[i].name) == 0) { @@ -655,7 +656,7 @@ static void print_help(FILE *fp) { - int i; + size_t i; fprintf(fp, "\n"); for (i = 0; i < ARRAY_SIZE(idtab); i++) { if (idtab[i].func != not_supported) diff -rwbBu a/port.c b/port.c --- a/port.c 2015-09-19 16:25:11.000000000 +0200 +++ b/port.c 2016-07-08 12:17:02.314195642 +0200 @@ -475,7 +475,7 @@ struct parent_ds *dad) { struct path_trace_tlv *ptt; - int length = 1 + dad->path_length; + size_t length = 1 + dad->path_length; if (length > PATH_TRACE_MAX) { return 0; @@ -939,7 +939,7 @@ if (shift < 0) shift = 0; - else if (shift >= sizeof(int) * 8) { + else if (shift >= (int) sizeof(int) * 8) { shift = sizeof(int) * 8 - 1; pr_warning("freq_est_interval is too long"); } diff -rwbBu a/ptp4l.c b/ptp4l.c --- a/ptp4l.c 2015-09-19 16:25:11.000000000 +0200 +++ b/ptp4l.c 2016-07-08 12:22:29.412206966 +0200 @@ -298,7 +298,7 @@ STAILQ_FOREACH(iface, &cfg->interfaces, list) { config_init_interface(iface, cfg); if (iface->ts_info.valid && - ((iface->ts_info.so_timestamping & required_modes) != required_modes)) { + ((iface->ts_info.so_timestamping & required_modes) != (unsigned int) required_modes)) { fprintf(stderr, "interface '%s' does not support " "requested timestamping mode.\n", iface->name); diff -rwbBu a/timemaster.c b/timemaster.c --- a/timemaster.c 2015-09-19 16:25:11.000000000 +0200 +++ b/timemaster.c 2016-07-08 12:23:06.032362145 +0200 @@ -679,7 +679,7 @@ } if (!ts_info.valid || - ((ts_info.so_timestamping & hw_ts) != hw_ts)) { + ((ts_info.so_timestamping & hw_ts) != (unsigned int) hw_ts)) { pr_debug("interface %s: no PHC", source->interfaces[i]); continue; } diff -rwbBu a/util.c b/util.c --- a/util.c 2016-07-08 11:33:09.843328724 +0200 +++ b/util.c 2016-07-08 12:17:36.478470709 +0200 @@ -161,7 +161,7 @@ int static_ptp_text_copy(struct static_ptp_text *dst, const struct PTPText *src) { int len = src->length; - if (dst->max_symbols > 0 && strlen_utf8(src->text) > dst->max_symbols) + if (dst->max_symbols > 0 && strlen_utf8(src->text) > (size_t) dst->max_symbols) return -1; dst->length = len; memcpy(dst->text, src->text, len); @@ -195,7 +195,7 @@ int len = strlen(src); if (len > MAX_PTP_OCTETS) return -1; - if (dst->max_symbols > 0 && strlen_utf8((Octet *) src) > dst->max_symbols) + if (dst->max_symbols > 0 && strlen_utf8((Octet *) src) > (size_t) dst->max_symbols) return -1; dst->length = len; memcpy(dst->text, src, len); --- Best regards Henry Jesuiter ------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape _______________________________________________ Linuxptp-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
