const char* buffer, const size_t length);
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_integer(struct json_object* json, const char* name, int64_t value);
+int pakfire_json_add_int64(struct json_object* json, const char* name, int64_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);
// Write build host
time_t build_time = pakfire_package_get_num(pkg, PAKFIRE_PKG_BUILD_TIME, 0);
if (build_time) {
- r = pakfire_json_add_integer(object, "time", build_time);
+ r = pakfire_json_add_int64(object, "time", build_time);
if (r)
goto ERROR;
}
// Installed package size
unsigned long long installsize = pakfire_package_get_num(pkg, PAKFIRE_PKG_INSTALLSIZE, 0);
- r = pakfire_json_add_integer(md, "size", (uint64_t)installsize);
+ r = pakfire_json_add_int64(md, "size", (uint64_t)installsize);
if (r)
goto ERROR;
return r;
}
-int pakfire_json_add_integer(struct json_object* json,
- const char* name, int64_t value) {
+int pakfire_json_add_int64(struct json_object* json, const char* name, int64_t value) {
// Convert integer to JSON object
struct json_object* object = json_object_new_int64(value);
if (!object)
- return 1;
+ return -errno;
// Add the object
return json_object_object_add(json, name, object);