Message ID | 20200612100354.3591-3-sde@unmatched.eu |
---|---|
State | Changes Requested |
Headers | show |
Series | [v2,1/6] Add semver library | expand |
Hi Stjin, On 12.06.20 12:03, Stijn Devriendt wrote: > Signed-off-by: Stijn Devriendt <sde@unmatched.eu> > --- > core/semver.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/core/semver.c b/core/semver.c > index 77a11ba..95df3fa 100644 > --- a/core/semver.c > +++ b/core/semver.c > @@ -152,9 +152,6 @@ semver_parse (const char *str, semver_t *ver) { > > res = semver_parse_version(buf, ver); > free(buf); > -#if DEBUG > 0 > - printf("[debug] semver.c %s = %d.%d.%d, %s %s\n", str, ver->major, ver->minor, ver->patch, ver->prerelease, ver->metadata); > -#endif > return res; > } > > @@ -499,7 +496,7 @@ semver_free (semver_t *x) { > */ > > static void > -concat_num (char * str, int x, char * sep) { > +concat_num (char * str, int x, const char * sep) { > char buf[SLICE_SIZE] = {0}; > if (sep == NULL) sprintf(buf, "%d", x); > else sprintf(buf, "%s%d", sep, x); > @@ -507,7 +504,7 @@ concat_num (char * str, int x, char * sep) { > } > > static void > -concat_char (char * str, char * x, char * sep) { > +concat_char (char * str, const char * x, const char * sep) { > char buf[SLICE_SIZE] = {0}; > sprintf(buf, "%s%s", sep, x); > strcat(str, buf); > Coverity has found two additional (IMHO minor) issues, that can be easy solved. Can you fix them and repost ? Thanks ! Hi, Please find the latest report on new defect(s) introduced to sbabic/swupdate found with Coverity Scan. 2 new defect(s) introduced to sbabic/swupdate found with Coverity Scan. New defect(s) Reported-by: Coverity Scan Showing 2 of 2 defect(s) ** CID 304621: Integer handling issues (CONSTANT_EXPRESSION_RESULT) /core/semver.c: 96 in parse_int()
diff --git a/core/semver.c b/core/semver.c index 77a11ba..95df3fa 100644 --- a/core/semver.c +++ b/core/semver.c @@ -152,9 +152,6 @@ semver_parse (const char *str, semver_t *ver) { res = semver_parse_version(buf, ver); free(buf); -#if DEBUG > 0 - printf("[debug] semver.c %s = %d.%d.%d, %s %s\n", str, ver->major, ver->minor, ver->patch, ver->prerelease, ver->metadata); -#endif return res; } @@ -499,7 +496,7 @@ semver_free (semver_t *x) { */ static void -concat_num (char * str, int x, char * sep) { +concat_num (char * str, int x, const char * sep) { char buf[SLICE_SIZE] = {0}; if (sep == NULL) sprintf(buf, "%d", x); else sprintf(buf, "%s%d", sep, x); @@ -507,7 +504,7 @@ concat_num (char * str, int x, char * sep) { } static void -concat_char (char * str, char * x, char * sep) { +concat_char (char * str, const char * x, const char * sep) { char buf[SLICE_SIZE] = {0}; sprintf(buf, "%s%s", sep, x); strcat(str, buf);
Signed-off-by: Stijn Devriendt <sde@unmatched.eu> --- core/semver.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)