-int bzReOpen(struct Input *ctx, int *error) {
- // for copying out the last unused part of the block which
- // has an EOS token in it. needed for re-initialising the
- // next stream.
- unsigned char unused[BZ_MAX_UNUSED];
- void *unused_tmp_ptr = NULL;
- int nUnused, i;
-
- BZ2_bzReadGetUnused(error, (BZFILE *)(ctx->fileHandle), &unused_tmp_ptr, &nUnused);
- if (*error != BZ_OK) return -1;
-
- // when bzReadClose is called the unused buffer is deallocated,
- // so it needs to be copied somewhere safe first.
- for (i = 0; i < nUnused; ++i)
- unused[i] = ((unsigned char *)unused_tmp_ptr)[i];
-
- BZ2_bzReadClose(error, (BZFILE *)(ctx->fileHandle));
- if (*error != BZ_OK) return -1;
-
- // reassign the file handle
- ctx->fileHandle = BZ2_bzReadOpen(error, ctx->systemHandle, 0, 0, unused, nUnused);
- if (ctx->fileHandle == NULL || *error != BZ_OK) return -1;
-
- return 0;
+int bzReOpen(struct Input *ctx, int *error)
+{
+ // for copying out the last unused part of the block which
+ // has an EOS token in it. needed for re-initialising the
+ // next stream.
+ unsigned char unused[BZ_MAX_UNUSED];
+ void *unused_tmp_ptr = NULL;
+ int nUnused, i;
+
+ BZ2_bzReadGetUnused(error, (BZFILE *)(ctx->fileHandle), &unused_tmp_ptr, &nUnused);
+ if (*error != BZ_OK) return -1;
+
+ // when bzReadClose is called the unused buffer is deallocated,
+ // so it needs to be copied somewhere safe first.
+ for (i = 0; i < nUnused; ++i)
+ unused[i] = ((unsigned char *)unused_tmp_ptr)[i];
+
+ BZ2_bzReadClose(error, (BZFILE *)(ctx->fileHandle));
+ if (*error != BZ_OK) return -1;
+
+ // reassign the file handle
+ ctx->fileHandle = BZ2_bzReadOpen(error, ctx->systemHandle, 0, 0, unused, nUnused);
+ if (ctx->fileHandle == NULL || *error != BZ_OK) return -1;
+
+ return 0;