Skip to content

Commit

Permalink
Fix again
Browse files Browse the repository at this point in the history
  • Loading branch information
nawendt committed Apr 3, 2023
1 parent 9089269 commit e5af452
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/grib_api_version.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ SEXP gribr_api_version(void) {
long major;
long minor;
long revision;
size_t slen = 15;
int err;
size_t slen = 20;
char string[slen];
SEXP gribr_version;

version = codes_get_api_version();
major = version / 10000;
minor = (version - major * 10000) / 100;
revision = (version - major * 10000) - (minor * 100);
snprintf(string, slen, "%ld.%ld.%ld\0", major, minor, revision);
err = snprintf(string, slen, "%ld.%ld.%ld", major, minor, revision);
if (err) {
error("Problem getting ecCodes version.");
}

gribr_version = PROTECT(mkString(string));

Expand Down

0 comments on commit e5af452

Please sign in to comment.