summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/common.h3
-rw-r--r--include/sqfs/compressor.h14
2 files changed, 12 insertions, 5 deletions
diff --git a/include/common.h b/include/common.h
index bbdf81d..2ecea42 100644
--- a/include/common.h
+++ b/include/common.h
@@ -148,7 +148,8 @@ void print_version(const char *progname);
XXX: This must be in libcommon instead of libsquashfs for legal reasons.
*/
-sqfs_compressor_t *lzo_compressor_create(const sqfs_compressor_config_t *cfg);
+int lzo_compressor_create(const sqfs_compressor_config_t *cfg,
+ sqfs_compressor_t **out);
/*
Parse a number optionally followed by a KMG suffix (case insensitive). Prints
diff --git a/include/sqfs/compressor.h b/include/sqfs/compressor.h
index fd5d7e8..1a36c82 100644
--- a/include/sqfs/compressor.h
+++ b/include/sqfs/compressor.h
@@ -351,13 +351,19 @@ SQFS_API bool sqfs_compressor_exists(SQFS_COMPRESSOR id);
/**
* @brief Create an instance of a compressor implementation.
*
+ * If this function returns @ref SQFS_ERROR_UNSUPPORTED, it can mean that
+ * either the compressor is not supported at all by the version of libsquashfs
+ * you are using, or that the specific configuration that has been requested
+ * is not supported (e.g. unknown flags, or the local version can only
+ * uncompress, but not compress).
+ *
* @param cfg A pointer to a compressor configuration.
+ * @param out Returns a pointer to the compressor on success.
*
- * @return A pointer to a compressor object on success, NULL on allocation
- * failure or if initializing the compressor failed.
+ * @return Zero on success, an SQFS_ERROR code on failure.
*/
-SQFS_API
-sqfs_compressor_t *sqfs_compressor_create(const sqfs_compressor_config_t *cfg);
+SQFS_API int sqfs_compressor_create(const sqfs_compressor_config_t *cfg,
+ sqfs_compressor_t **out);
/**
* @brief Get the name of a compressor backend from its ID.