]> git.notmuchmail.org Git - notmuch/blobdiff - util/zlib-extra.c
emacs: Add new option notmuch-search-hide-excluded
[notmuch] / util / zlib-extra.c
index 2e704457ebde863562419d2c7220b1aa69e3877b..1f5f9dbeec012cfc0211914d369bc6748d9eb6bb 100644 (file)
@@ -13,7 +13,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see http://www.gnu.org/licenses/ .
+ * along with this program.  If not, see https://www.gnu.org/licenses/ .
  *
  * Author: David Bremner <david@tethera.net>
  */
  *
  * Author: David Bremner <david@tethera.net>
  */
@@ -47,6 +47,7 @@ gz_getline (void *talloc_ctx, char **bufptr, ssize_t *bytes_read, gzFile stream)
            int zlib_status = 0;
            (void) gzerror (stream, &zlib_status);
            switch (zlib_status) {
            int zlib_status = 0;
            (void) gzerror (stream, &zlib_status);
            switch (zlib_status) {
+           case Z_STREAM_END:
            case Z_OK:
                /* no data read before EOF */
                if (offset == 0)
            case Z_OK:
                /* no data read before EOF */
                if (offset == 0)
@@ -70,16 +71,25 @@ gz_getline (void *talloc_ctx, char **bufptr, ssize_t *bytes_read, gzFile stream)
        if (buf == NULL)
            return UTIL_OUT_OF_MEMORY;
     }
        if (buf == NULL)
            return UTIL_OUT_OF_MEMORY;
     }
- SUCCESS:
 SUCCESS:
     *bufptr = buf;
     *bytes_read = offset;
     return UTIL_SUCCESS;
 }
 
     *bufptr = buf;
     *bytes_read = offset;
     return UTIL_SUCCESS;
 }
 
-const char *gz_error_string (util_status_t status, gzFile file)
+const char *
+gz_error_string (util_status_t status, gzFile file)
 {
     if (status == UTIL_GZERROR)
 {
     if (status == UTIL_GZERROR)
-       return gzerror (file, NULL);
+       return gzerror_str (file);
     else
        return util_error_string (status);
 }
     else
        return util_error_string (status);
 }
+
+const char *
+gzerror_str (gzFile file)
+{
+    int dummy;
+
+    return gzerror (file, &dummy);
+}