From d7eae0664fb4cf7f3411c8d3b47cef32ad2346fc Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sun, 12 Sep 2021 13:29:10 -0700 Subject: [PATCH] [gz_open] Use compress and write consistent with calling functions. --- libgnucash/backend/xml/io-gncxml-v2.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/libgnucash/backend/xml/io-gncxml-v2.cpp b/libgnucash/backend/xml/io-gncxml-v2.cpp index 955a490022..e26bc6269b 100644 --- a/libgnucash/backend/xml/io-gncxml-v2.cpp +++ b/libgnucash/backend/xml/io-gncxml-v2.cpp @@ -95,7 +95,7 @@ typedef struct gint fd; gchar* filename; gchar* perms; - gboolean compress; + gboolean write; } gz_thread_params_t; /* Callback structure */ @@ -125,8 +125,8 @@ gnc_v2_book_version_string; /* see gnc-book-xml-v2 */ /* Forward declarations */ static FILE* try_gz_open (const char* filename, const char* perms, - gboolean use_gzip, - gboolean compress); + gboolean compress, + gboolean write); static gboolean is_gzipped_file (const gchar* name); static gboolean wait_for_gzip (FILE* file); @@ -1433,7 +1433,7 @@ gz_thread_func (gz_thread_params_t* params) goto cleanup_gz_thread_func; } - if (params->compress) + if (params->write) { while (success) { @@ -1514,13 +1514,13 @@ cleanup_gz_thread_func: } static FILE* -try_gz_open (const char* filename, const char* perms, gboolean use_gzip, - gboolean compress) +try_gz_open (const char* filename, const char* perms, gboolean compress, + gboolean write) { if (strstr (filename, ".gz.") != NULL) /* its got a temp extension */ - use_gzip = TRUE; + compress = TRUE; - if (!use_gzip) + if (!compress) return g_fopen (filename, perms); { @@ -1554,10 +1554,10 @@ try_gz_open (const char* filename, const char* perms, gboolean use_gzip, } params = g_new (gz_thread_params_t, 1); - params->fd = filedes[compress ? 0 : 1]; + params->fd = filedes[write ? 0 : 1]; params->filename = g_strdup (filename); params->perms = g_strdup (perms); - params->compress = compress; + params->write = write; thread = g_thread_new ("xml_thread", (GThreadFunc) gz_thread_func, params); @@ -1573,7 +1573,7 @@ try_gz_open (const char* filename, const char* perms, gboolean use_gzip, return g_fopen (filename, perms); } - if (compress) + if (write) file = fdopen (filedes[1], "w"); else file = fdopen (filedes[0], "r");