From af7d26ebda4246b1cb61fb5775c811a768fe2bbd Mon Sep 17 00:00:00 2001 From: dhfelix Date: Thu, 23 Apr 2020 17:07:01 -0500 Subject: [PATCH] Fix GCC 10 warnings Fix #32 --- src/asn1/asn1c/INTEGER.c | 9 +++++++-- src/config/str.c | 1 + src/rrdp/db/db_rrdp_uris.c | 9 +++++++++ src/slurm/db_slurm.c | 2 +- src/uri.c | 6 ++++-- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/asn1/asn1c/INTEGER.c b/src/asn1/asn1c/INTEGER.c index 3b5b8caf..254e78fb 100644 --- a/src/asn1/asn1c/INTEGER.c +++ b/src/asn1/asn1c/INTEGER.c @@ -974,8 +974,13 @@ asn_imax2INTEGER(INTEGER_t *st, intmax_t value) { break; } /* Copy the integer body */ - for(bp = buf, pend1 += add; p != pend1; p += add) - *bp++ = *p; + if(*(char *)&littleEndian) { + for(bp = buf; p >= pend1; p--) + *bp++ = *p; + } else { + for(bp = buf; p <= pend1; p++) + *bp++ = *p; + } if(st->buf) FREEMEM(st->buf); st->buf = buf; diff --git a/src/config/str.c b/src/config/str.c index 63cd4994..a9400ba7 100644 --- a/src/config/str.c +++ b/src/config/str.c @@ -43,6 +43,7 @@ string_parse_json(struct option_field const *opt, json_t *json, void *result) char const *string; int error; + string = NULL; error = parse_json_string(json, opt->name, &string); return error ? error : string_parse_argv(opt, string, result); } diff --git a/src/rrdp/db/db_rrdp_uris.c b/src/rrdp/db/db_rrdp_uris.c index 53f09275..e7ef8fce 100644 --- a/src/rrdp/db/db_rrdp_uris.c +++ b/src/rrdp/db/db_rrdp_uris.c @@ -150,6 +150,7 @@ db_rrdp_uris_cmp(char const *uri, char const *session_id, unsigned long serial, struct uris_table *found; int error; + uris = NULL; error = get_thread_rrdp_uris(&uris); if (error) return error; @@ -183,6 +184,7 @@ db_rrdp_uris_update(char const *uri, char const *session_id, struct uris_table *db_uri; int error; + uris = NULL; error = get_thread_rrdp_uris(&uris); if (error) return error; @@ -207,6 +209,7 @@ db_rrdp_uris_get_serial(char const *uri, unsigned long *serial) struct uris_table *found; int error; + uris = NULL; error = get_thread_rrdp_uris(&uris); if (error) return error; @@ -223,6 +226,7 @@ db_rrdp_uris_get_last_update(char const *uri, long *date) struct uris_table *found; int error; + uris = NULL; error = get_thread_rrdp_uris(&uris); if (error) return error; @@ -253,6 +257,7 @@ db_rrdp_uris_set_last_update(char const *uri) struct uris_table *found; int error; + uris = NULL; error = get_thread_rrdp_uris(&uris); if (error) return error; @@ -268,6 +273,7 @@ db_rrdp_uris_get_request_status(char const *uri, rrdp_req_status_t *result) struct uris_table *found; int error; + uris = NULL; error = get_thread_rrdp_uris(&uris); if (error) return error; @@ -284,6 +290,7 @@ db_rrdp_uris_set_request_status(char const *uri, rrdp_req_status_t value) struct uris_table *found; int error; + uris = NULL; error = get_thread_rrdp_uris(&uris); if (error) return error; @@ -300,6 +307,7 @@ db_rrdp_uris_set_all_unvisited(void) struct uris_table *uri_node, *uri_tmp; int error; + uris = NULL; error = get_thread_rrdp_uris(&uris); if (error) return error; @@ -321,6 +329,7 @@ db_rrdp_uris_get_visited_uris(char const *uri, struct visited_uris **result) struct uris_table *found; int error; + uris = NULL; error = get_thread_rrdp_uris(&uris); if (error) return error; diff --git a/src/slurm/db_slurm.c b/src/slurm/db_slurm.c index 2cb6a7e4..b50f8990 100644 --- a/src/slurm/db_slurm.c +++ b/src/slurm/db_slurm.c @@ -211,7 +211,7 @@ bgpsec_filtered_by(struct slurm_bgpsec_wrap *filter_wrap, /* Both have a SKI */ if ((bgpsec->data_flag & SLURM_BGPS_FLAG_SKI) > 0 && (filter->data_flag & SLURM_BGPS_FLAG_SKI) > 0) - return memcmp(bgpsec->ski, filter->ski, RK_SPKI_LEN) + return memcmp(bgpsec->ski, filter->ski, RK_SKI_LEN) == 0; return false; diff --git a/src/uri.c b/src/uri.c index bf96af34..e9ac2466 100644 --- a/src/uri.c +++ b/src/uri.c @@ -289,8 +289,10 @@ g2l(char const *global, size_t global_len, uint8_t flags, char **result, offset = 0; strcpy(local + offset, repository); offset += repository_len; - strncpy(local + offset, "/", extra_slash); - offset += extra_slash; + if (extra_slash) { + strcpy(local + offset, "/"); + offset += extra_slash; + } strncpy(local + offset, global, global_len); offset += global_len; local[offset] = '\0'; -- 2.47.2