6 #define RZ_PROJECT_KEY_TYPE "type"
7 #define RZ_PROJECT_KEY_VERSION "version"
9 #define RZ_PROJECT_TYPE "rizin rz-db project"
16 return "file access error";
18 return "invalid file type";
20 return "invalid project version";
22 return "newer project version";
24 return "invalid content encountered";
26 return "migration failed";
28 return "project file compression failed";
32 return "unknown error";
43 char *tmp_file =
NULL;
47 if (mkstemp_fd == -1 || !tmp_file) {
98 if (mkstemp_fd == -1 || !tmp_file) {
103 const char *load_file = tmp_file;
143 unsigned long version = strtoul(version_str,
NULL, 0);
154 Sdb *core_db =
sdb_ns(prj,
"core",
false);
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
RZ_API RzConfigNode * rz_config_set(RzConfig *cfg, RZ_NONNULL const char *name, const char *value)
static static fork const void static count close
RZ_API char * sdb_fmt(const char *fmt,...)
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API Sdb * sdb_ns(Sdb *s, const char *name, int create)
#define RZ_PROJECT_KEY_VERSION
RZ_API RzProjectErr rz_project_save(RzCore *core, RzProject *prj, const char *file)
RZ_API void rz_project_free(RzProject *prj)
#define RZ_PROJECT_KEY_TYPE
RZ_API RzProjectErr rz_project_load(RzCore *core, RzProject *prj, bool load_bin_io, RZ_NULLABLE const char *file, RzSerializeResultInfo *res)
RZ_API RZ_NONNULL const char * rz_project_err_message(RzProjectErr err)
RZ_API RzProjectErr rz_project_load_file(RzCore *core, const char *file, bool load_bin_io, RzSerializeResultInfo *res)
RZ_API RzProjectErr rz_project_save_file(RzCore *core, const char *file, bool compress)
RZ_API RzProject * rz_project_load_file_raw(const char *file)
Load a file into an RzProject but don't actually migrate anything or load it into an RzCore.
RZ_API bool rz_project_migrate(RzProject *prj, unsigned long version, RzSerializeResultInfo *res)
Migrate the given project to the current version in-place.
#define rz_return_val_if_fail(expr, val)
RZ_API bool rz_file_exists(const char *str)
RZ_API bool rz_file_is_deflated(RZ_NONNULL const char *src)
check whether a file is a deflated (gzip) file
RZ_API bool rz_file_inflate(RZ_NONNULL const char *src, RZ_NONNULL const char *dst)
unzip the contents of src and store in dst
RZ_API bool rz_file_deflate(RZ_NONNULL const char *src, RZ_NONNULL const char *dst)
zip the contents of src and store in dst
RZ_API int rz_file_mkstemp(RZ_NULLABLE const char *prefix, char **oname)
RZ_API bool rz_file_rm(const char *file)
@ RZ_PROJECT_ERR_MIGRATION_FAILED
@ RZ_PROJECT_ERR_COMPRESSION_FAILED
@ RZ_PROJECT_ERR_NEWER_VERSION
@ RZ_PROJECT_ERR_INVALID_CONTENTS
@ RZ_PROJECT_ERR_INVALID_TYPE
@ RZ_PROJECT_ERR_INVALID_VERSION
#define RZ_PROJECT_VERSION
enum rz_project_err RzProjectErr
#define RZ_SERIALIZE_ERR(res,...)
Push an error to the local RzSerializeResultInfo \res RzSerializeInfoResult *.
RZ_API int sdb_set(Sdb *s, const char *key, const char *val, ut32 cas)
RZ_API Sdb * sdb_new0(void)
RZ_API bool sdb_free(Sdb *s)
RZ_API const char * sdb_const_get(Sdb *s, const char *key, ut32 *cas)
RZ_API bool sdb_text_save(Sdb *s, const char *file, bool sort)
RZ_API bool sdb_text_load(Sdb *s, const char *file)
RZ_API bool rz_serialize_core_load(RZ_NONNULL Sdb *db, RZ_NONNULL RzCore *core, bool load_bin_io, RZ_NULLABLE const char *prj_file, RZ_NULLABLE RzSerializeResultInfo *res)
RZ_API void rz_serialize_core_save(RZ_NONNULL Sdb *db, RZ_NONNULL RzCore *core, RZ_NULLABLE const char *prj_file)