A whole bunch of changes to allow building for Windows.
[gnupg.git] / g10 / compress-bz2.c
index 7a8075a..90f8266 100644 (file)
@@ -24,8 +24,8 @@
 #include <stdio.h> /* Early versions of bzlib (1.0) require stdio.h */
 #include <bzlib.h>
 
+#include "gpg.h"
 #include "util.h"
-#include "memory.h"
 #include "packet.h"
 #include "filter.h"
 #include "main.h"
@@ -63,6 +63,7 @@ init_compress( compress_filter_context_t *zfx, bz_stream *bzs )
 static int
 do_compress(compress_filter_context_t *zfx, bz_stream *bzs, int flush, IOBUF a)
 {
+  int rc;
   int zrc;
   unsigned n;
 
@@ -86,10 +87,10 @@ do_compress(compress_filter_context_t *zfx, bz_stream *bzs, int flush, IOBUF a)
                  (unsigned)bzs->avail_in, (unsigned)bzs->avail_out,
                  (unsigned)n, zrc );
 
-      if( iobuf_write( a, zfx->outbuf, n ) )
+      if( (rc=iobuf_write( a, zfx->outbuf, n )) )
        {
          log_debug("bzCompress: iobuf_write failed\n");
-         return G10ERR_WRITE_FILE;
+         return rc;
        }
     }
   while( bzs->avail_in || (flush == BZ_FINISH && zrc != BZ_STREAM_END) );