CR_FILE *
-cr_open_with_stat(const char *filename,
- cr_OpenMode mode,
- cr_CompressionType comtype,
- cr_ContentStat *stat,
- GError **err)
+cr_sopen(const char *filename,
+ cr_OpenMode mode,
+ cr_CompressionType comtype,
+ cr_ContentStat *stat,
+ GError **err)
{
CR_FILE *file = NULL;
cr_CompressionType type = comtype;
* @return pointer to a CR_FILE or NULL
*/
#define cr_open(FILENAME, MODE, COMTYPE, ERR) \
- cr_open_with_stat(FILENAME, MODE, COMTYPE, NULL, ERR)
+ cr_sopen(FILENAME, MODE, COMTYPE, NULL, ERR)
-/** Open/Create the specified file. For writting is possible pass
+/** Open/Create the specified file. If opened for writting, you can pass
* a cr_ContentStat object and after cr_close() get stats of
* an open content (stats of uncompressed content).
* @param filename filename
* @param err GError **
* @return pointer to a CR_FILE or NULL
*/
-CR_FILE *cr_open_with_stat(const char *filename,
- cr_OpenMode mode,
- cr_CompressionType comtype,
- cr_ContentStat *stat,
- GError **err);
+CR_FILE *cr_sopen(const char *filename,
+ cr_OpenMode mode,
+ cr_CompressionType comtype,
+ cr_ContentStat *stat,
+ GError **err);
/** Reads an array of len bytes from the CR_FILE.
* @param cr_file CR_FILE pointer
goto compress_file_cleanup;
}
- new = cr_open_with_stat(dst, CR_CW_MODE_WRITE, compression, stat, &tmp_err);
+ new = cr_sopen(dst, CR_CW_MODE_WRITE, compression, stat, &tmp_err);
if (tmp_err) {
g_debug("%s: Cannot open destination file %s", __func__, dst);
g_propagate_prefixed_error(err, tmp_err, "Cannot open %s: ", dst);
}
/* Init */
- self->f = cr_open_with_stat(path, mode, comtype, stat, &err);
+ self->f = cr_sopen(path, mode, comtype, stat, &err);
if (err) {
PyErr_Format(CrErr_Exception, "CrFile initialization failed: %s", err->message);
g_clear_error(&err);
return NULL;
}
- CR_FILE *cr_f = cr_open_with_stat(filename,
- CR_CW_MODE_WRITE,
- comtype,
- stat,
- &tmp_err);
+ CR_FILE *cr_f = cr_sopen(filename,
+ CR_CW_MODE_WRITE,
+ comtype,
+ stat,
+ &tmp_err);
if (tmp_err) {
g_propagate_prefixed_error(err, tmp_err, "Cannot open %s: ", filename);
return NULL;
g_assert(stat);
g_assert(!tmp_err);
- f = cr_open_with_stat(outputtest->tmp_filename,
- CR_CW_MODE_WRITE,
- CR_CW_NO_COMPRESSION,
- stat,
- &tmp_err);
+ f = cr_sopen(outputtest->tmp_filename,
+ CR_CW_MODE_WRITE,
+ CR_CW_NO_COMPRESSION,
+ stat,
+ &tmp_err);
g_assert(f);
g_assert(!tmp_err);
g_assert(stat);
g_assert(!tmp_err);
- f = cr_open_with_stat(outputtest->tmp_filename,
- CR_CW_MODE_WRITE,
- CR_CW_GZ_COMPRESSION,
- stat,
- &tmp_err);
+ f = cr_sopen(outputtest->tmp_filename,
+ CR_CW_MODE_WRITE,
+ CR_CW_GZ_COMPRESSION,
+ stat,
+ &tmp_err);
g_assert(f);
g_assert(!tmp_err);
g_assert(stat);
g_assert(!tmp_err);
- f = cr_open_with_stat(outputtest->tmp_filename,
- CR_CW_MODE_WRITE,
- CR_CW_BZ2_COMPRESSION,
- stat,
- &tmp_err);
+ f = cr_sopen(outputtest->tmp_filename,
+ CR_CW_MODE_WRITE,
+ CR_CW_BZ2_COMPRESSION,
+ stat,
+ &tmp_err);
g_assert(f);
g_assert(!tmp_err);
g_assert(stat);
g_assert(!tmp_err);
- f = cr_open_with_stat(outputtest->tmp_filename,
- CR_CW_MODE_WRITE,
- CR_CW_XZ_COMPRESSION,
- stat,
- &tmp_err);
+ f = cr_sopen(outputtest->tmp_filename,
+ CR_CW_MODE_WRITE,
+ CR_CW_XZ_COMPRESSION,
+ stat,
+ &tmp_err);
g_assert(f);
g_assert(!tmp_err);
g_assert(stat);
g_assert(!tmp_err);
- f = cr_open_with_stat(outputtest->tmp_filename,
- CR_CW_MODE_WRITE,
- CR_CW_GZ_COMPRESSION,
- stat,
- &tmp_err);
+ f = cr_sopen(outputtest->tmp_filename,
+ CR_CW_MODE_WRITE,
+ CR_CW_GZ_COMPRESSION,
+ stat,
+ &tmp_err);
g_assert(f);
g_assert(!tmp_err);