X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fwrite_mongodb.c;h=a6b39d306470a7d92bf615fe08abe9466b5c64a2;hp=e1fb41fd9a500ee210bc3f91c630c05d0c8d79a3;hb=77ca1a45bab2f6adf9301723d0db68e5813a6d98;hpb=267bbc64779f9c7b32e063aac0df22be61bda6ae diff --git a/src/write_mongodb.c b/src/write_mongodb.c index e1fb41fd..a6b39d30 100644 --- a/src/write_mongodb.c +++ b/src/write_mongodb.c @@ -96,7 +96,7 @@ static bson_t *wm_create_bson(const data_set_t *ds, /* {{{ */ for (size_t i = 0; i < ds->ds_num; i++) { char key[16]; - ssnprintf(key, sizeof(key), "%zu", i); + snprintf(key, sizeof(key), "%" PRIsz, i); if (ds->ds[i].type == DS_TYPE_GAUGE) BSON_APPEND_DOUBLE(&subarray, key, vl->values[i].gauge); @@ -109,7 +109,7 @@ static bson_t *wm_create_bson(const data_set_t *ds, /* {{{ */ else if (ds->ds[i].type == DS_TYPE_ABSOLUTE) BSON_APPEND_INT64(&subarray, key, vl->values[i].absolute); else { - ERROR("write_mongodb plugin: Unknown ds_type %d for index %zu", + ERROR("write_mongodb plugin: Unknown ds_type %d for index %" PRIsz, ds->ds[i].type, i); bson_destroy(ret); return NULL; @@ -121,7 +121,7 @@ static bson_t *wm_create_bson(const data_set_t *ds, /* {{{ */ for (size_t i = 0; i < ds->ds_num; i++) { char key[16]; - ssnprintf(key, sizeof(key), "%zu", i); + snprintf(key, sizeof(key), "%" PRIsz, i); if (store_rates) BSON_APPEND_UTF8(&subarray, key, "gauge"); @@ -134,7 +134,7 @@ static bson_t *wm_create_bson(const data_set_t *ds, /* {{{ */ for (size_t i = 0; i < ds->ds_num; i++) { char key[16]; - ssnprintf(key, sizeof(key), "%zu", i); + snprintf(key, sizeof(key), "%" PRIsz, i); BSON_APPEND_UTF8(&subarray, key, ds->ds[i].name); } bson_append_array_end(ret, &subarray); /* }}} dsnames */ @@ -144,7 +144,7 @@ static bson_t *wm_create_bson(const data_set_t *ds, /* {{{ */ size_t error_location; if (!bson_validate(ret, BSON_VALIDATE_UTF8, &error_location)) { ERROR("write_mongodb plugin: Error in generated BSON document " - "at byte %zu", + "at byte %" PRIsz, error_location); bson_destroy(ret); return NULL; @@ -366,9 +366,9 @@ static int wm_config_node(oconfig_item_t *ci) /* {{{ */ } if (status == 0) { - char cb_name[DATA_MAX_NAME_LEN]; + char cb_name[sizeof("write_mongodb/") + DATA_MAX_NAME_LEN]; - ssnprintf(cb_name, sizeof(cb_name), "write_mongodb/%s", node->name); + snprintf(cb_name, sizeof(cb_name), "write_mongodb/%s", node->name); status = plugin_register_write(cb_name, wm_write,