@cryptotaxi247 / netdata-1 / commits / ecd5a88b7

Fix compilation warnings (libbnetdata) (#21961)

thiagoftsm committed Mar 18, 2026 at 11:56 UTC ecd5a88b7ebe9a6a316a058cec69fc4d250484ce
3 files changed +10 -17
src/libnetdata/log/nd_log-to-file.c
+2
@@ -26,6 +26,8 @@ void nd_log_chown_log_files(uid_t uid, gid_t gid) {
26 }
27
28 bool nd_logger_file(int fd, FILE *fp, netdata_mutex_t *mutex, ND_LOG_FORMAT format, struct log_field *fields, size_t fields_max) {
29 + (void)fp;
30 +
31 BUFFER *wb = buffer_create(1024, NULL);
32
33 if(format == NDLF_JSON)
src/libnetdata/yaml/yaml-unittest.c
+3 -2
@@ -178,7 +178,8 @@ static int test_yaml_parse_arrays(void) {
178 }
179
180 if (!json_object_is_type(json, json_type_array)) {
181 - fprintf(stderr, "FAILED: test_yaml_parse_arrays: expected array but got type %d\n", json_object_get_type(json));
181 + fprintf(stderr, "FAILED: test_yaml_parse_arrays: expected array but got type %u\n",
182 + (unsigned int)json_object_get_type(json));
183 failed++;
184 goto cleanup;
185 }
@@ -680,4 +681,4 @@ int yaml_unittest(void) {
681 failed += comprehensive_failed;
682
683 return failed;
683 -}
\ No newline at end of file
684 +}
src/libnetdata/yaml/yaml.c
+5 -15
@@ -148,7 +148,7 @@ static bool parse_number_with_underscores(const char *str, size_t len, long long
148 return false;
149 }
150
151 -static struct json_object *yaml_scalar_to_json(yaml_node_t *node, BUFFER *error, YAML2JSON_FLAGS flags) {
151 +static struct json_object *yaml_scalar_to_json(yaml_node_t *node, YAML2JSON_FLAGS flags) {
152 const char *value = (const char *)node->data.scalar.value;
153 size_t length = node->data.scalar.length;
154
@@ -271,7 +271,7 @@ static struct json_object *yaml_node_to_json(yaml_document_t *document, yaml_nod
271
272 switch (node->type) {
273 case YAML_SCALAR_NODE:
274 - return yaml_scalar_to_json(node, error, flags);
274 + return yaml_scalar_to_json(node, flags);
275
276 case YAML_SEQUENCE_NODE:
277 return yaml_sequence_to_json(document, node, error, flags, depth + 1);
@@ -280,21 +280,11 @@ static struct json_object *yaml_node_to_json(yaml_document_t *document, yaml_nod
280 return yaml_mapping_to_json(document, node, error, flags, depth + 1);
281
282 default:
283 - buffer_sprintf(error, "Unsupported YAML node type: %d", node->type);
283 + buffer_sprintf(error, "Unsupported YAML node type: %u", (unsigned int)node->type);
284 return NULL;
285 }
286 }
287
288 -static struct json_object *yaml_document_to_json(yaml_document_t *document, BUFFER *error) {
289 - yaml_node_t *root = yaml_document_get_root_node(document);
290 - if (!root) {
291 - // Empty document - this is valid YAML but we return NULL
292 - return NULL;
293 - }
294 -
295 - return yaml_node_to_json(document, root, error, YAML2JSON_DEFAULT, 0);
296 -}
297 -
288 static struct json_object *yaml_document_to_json_with_flags(yaml_document_t *document, BUFFER *error, YAML2JSON_FLAGS flags) {
289 yaml_node_t *root = yaml_document_get_root_node(document);
290 if (!root) {
@@ -579,7 +569,7 @@ static int yaml_add_json_to_document(yaml_document_t *document, struct json_obje
569 return yaml_add_object_to_document(document, json, error, depth + 1);
570
571 default:
582 - buffer_sprintf(error, "Unknown JSON type: %d", type);
572 + buffer_sprintf(error, "Unknown JSON type: %u", (unsigned int)type);
573 return 0;
574 }
575 }
@@ -714,4 +704,4 @@ bool yaml_generate_to_fd(int fd, struct json_object *json, BUFFER *error) {
704 bool result = yaml_generate_common(&emitter, json, error);
705 fclose(file);
706 return result;
717 -}
\ No newline at end of file
707 +}