struct json_object* pakfire_json_parse_from_file(struct pakfire_ctx* ctx, const char* path);
int pakfire_json_add_string(struct json_object* json, const char* name, const char* value);
int pakfire_json_add_int64(struct json_object* json, const char* name, int64_t value);
+int pakfire_json_add_uint64(struct json_object* json, const char* name, uint64_t value);
int pakfire_json_add_double(struct json_object* json, const char* name, double value);
int pakfire_json_add_string_array(struct json_object* json, const char* name, char** array);
// Installed package size
unsigned long long installsize = pakfire_package_get_num(pkg, PAKFIRE_PKG_INSTALLSIZE, 0);
- r = pakfire_json_add_int64(md, "size", (uint64_t)installsize);
+ r = pakfire_json_add_uint64(md, "size", installsize);
if (r)
goto ERROR;
return json_object_object_add(json, name, object);
}
+int pakfire_json_add_uint64(struct json_object* json, const char* name, uint64_t value) {
+ struct json_object* object = NULL;
+
+ // Convert the value to JSON
+ object = json_object_new_uint64(value);
+ if (!object)
+ return -errno;
+
+ // Add the object
+ return json_object_object_add(json, name, object);
+}
+
int pakfire_json_add_double(struct json_object* json, const char* name, double value) {
struct json_object* object = NULL;