Windows: Do not need _snprintf anymore

This commit is contained in:
Shahram Najm 2022-11-10 21:51:06 +00:00
parent 8d4db21c89
commit 044cb17e11
4 changed files with 7 additions and 10 deletions

View File

@ -65,7 +65,6 @@ extern "C" {
#include <dirent.h>
#include <unistd.h>
#include <inttypes.h>
#define ecc_snprintf snprintf
#else
#define strtok_r strtok_s
#include <direct.h>
@ -102,8 +101,6 @@ extern "C" {
#define strdup(str) _strdup(str)
#endif
#define ecc_snprintf _snprintf
#endif /* ifndef ECCODES_ON_WINDOWS */

View File

@ -494,7 +494,7 @@ grib_context* grib_context_get_default()
const char* defs_extra = getenv("ECCODES_EXTRA_DEFINITION_PATH");
if (defs_extra) {
char buffer[ECC_PATH_MAXLEN]= {0,};
ecc_snprintf(buffer, ECC_PATH_MAXLEN, "%s%c%s", defs_extra, ECC_PATH_DELIMITER_CHAR, default_grib_context.grib_definition_files_path);
snprintf(buffer, ECC_PATH_MAXLEN, "%s%c%s", defs_extra, ECC_PATH_DELIMITER_CHAR, default_grib_context.grib_definition_files_path);
free(default_grib_context.grib_definition_files_path);
default_grib_context.grib_definition_files_path = strdup(buffer);
}
@ -504,7 +504,7 @@ grib_context* grib_context_get_default()
/* ECC-1088 */
if (strstr(default_grib_context.grib_definition_files_path, ECCODES_DEFINITION_PATH) == NULL) {
char buffer[ECC_PATH_MAXLEN]= {0,};
ecc_snprintf(buffer, ECC_PATH_MAXLEN, "%s%c%s", default_grib_context.grib_definition_files_path,
snprintf(buffer, ECC_PATH_MAXLEN, "%s%c%s", default_grib_context.grib_definition_files_path,
ECC_PATH_DELIMITER_CHAR, ECCODES_DEFINITION_PATH);
free(default_grib_context.grib_definition_files_path);
default_grib_context.grib_definition_files_path = strdup(buffer);
@ -517,7 +517,7 @@ grib_context* grib_context_get_default()
const char* samples_extra = getenv("ECCODES_EXTRA_SAMPLES_PATH");
if (samples_extra) {
char buffer[ECC_PATH_MAXLEN];
ecc_snprintf(buffer, ECC_PATH_MAXLEN, "%s%c%s", samples_extra, ECC_PATH_DELIMITER_CHAR, default_grib_context.grib_samples_path);
snprintf(buffer, ECC_PATH_MAXLEN, "%s%c%s", samples_extra, ECC_PATH_DELIMITER_CHAR, default_grib_context.grib_samples_path);
default_grib_context.grib_samples_path = strdup(buffer);
}
}
@ -525,7 +525,7 @@ grib_context* grib_context_get_default()
{
if (strstr(default_grib_context.grib_samples_path, ECCODES_SAMPLES_PATH) == NULL) {
char buffer[ECC_PATH_MAXLEN];
ecc_snprintf(buffer, ECC_PATH_MAXLEN, "%s%c%s", default_grib_context.grib_samples_path,
snprintf(buffer, ECC_PATH_MAXLEN, "%s%c%s", default_grib_context.grib_samples_path,
ECC_PATH_DELIMITER_CHAR, ECCODES_SAMPLES_PATH);
default_grib_context.grib_samples_path = strdup(buffer);
}

View File

@ -216,7 +216,7 @@ int grib_jasper_encode(grib_context* c, j2k_encode_helper* helper)
if (helper->compression != 0) {
/* Lossy */
ecc_snprintf(opts, MAXOPTSSIZE, "mode=real\nrate=%f", 1.0 / helper->compression);
snprintf(opts, MAXOPTSSIZE, "mode=real\nrate=%f", 1.0 / helper->compression);
}
Assert(cmpt.width_ * cmpt.height_ * cmpt.cps_ == buflen);

View File

@ -4315,7 +4315,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
stat = nc_create(options->outfile->name, creation_mode, &ncid);
if (stat != NC_NOERR) {
char msg[1024];
ecc_snprintf(msg, sizeof(msg), "nc_create: '%s'", options->outfile->name);
snprintf(msg, sizeof(msg), "nc_create: '%s'", options->outfile->name);
check_err(msg, stat, __LINE__);
}
@ -4341,7 +4341,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
for (i = 0; i < count; ++i) {
if (subsets[i].fset) {
char dataset[100];
ecc_snprintf(dataset, sizeof(dataset), subsets[i].att.name, i + 1);
snprintf(dataset, sizeof(dataset), subsets[i].att.name, i + 1);
put_data(dims, ncid, dataset, &subsets[i]);
}
else {