compression_wrapper: cr_open_with_stat renamed to cr_sopen.
authorTomas Mlcoch <tmlcoch@redhat.com>
Thu, 13 Jun 2013 11:55:32 +0000 (13:55 +0200)
committerTomas Mlcoch <tmlcoch@redhat.com>
Thu, 13 Jun 2013 11:55:32 +0000 (13:55 +0200)
src/compression_wrapper.c
src/compression_wrapper.h
src/misc.c
src/python/compression_wrapper-py.c
src/xml_file.c
tests/test_compression_wrapper.c

index 990c80c..95cf12f 100644 (file)
@@ -264,11 +264,11 @@ cr_gz_strerror(gzFile f)
 
 
 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;
index 8dfc577..992dcbb 100644 (file)
@@ -106,9 +106,9 @@ cr_CompressionType cr_detect_compression(const char* filename, GError **err);
  * @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
@@ -118,11 +118,11 @@ cr_CompressionType cr_detect_compression(const char* filename, GError **err);
  * @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
index 6210dd5..4ea08fc 100644 (file)
@@ -468,7 +468,7 @@ cr_compress_file_with_stat(const char *src,
         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);
index 4a8a823..6a47f03 100644 (file)
@@ -151,7 +151,7 @@ crfile_init(_CrFileObject *self, PyObject *args, PyObject *kwds)
     }
 
     /* 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);
index af945d4..ff55b67 100644 (file)
@@ -61,11 +61,11 @@ cr_xmlfile_sopen(const char *filename,
         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;
index 3879c05..e625a73 100644 (file)
@@ -553,11 +553,11 @@ test_contentstating_singlewrite(Outputtest *outputtest, gconstpointer test_data)
     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);
 
@@ -579,11 +579,11 @@ test_contentstating_singlewrite(Outputtest *outputtest, gconstpointer test_data)
     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);
 
@@ -605,11 +605,11 @@ test_contentstating_singlewrite(Outputtest *outputtest, gconstpointer test_data)
     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);
 
@@ -631,11 +631,11 @@ test_contentstating_singlewrite(Outputtest *outputtest, gconstpointer test_data)
     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);
 
@@ -673,11 +673,11 @@ test_contentstating_multiwrite(Outputtest *outputtest, gconstpointer test_data)
     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);