[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23103 - Extractor/src/main
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23103 - Extractor/src/main |
Date: |
Sat, 4 Aug 2012 21:57:47 +0200 |
Author: grothoff
Date: 2012-08-04 21:57:47 +0200 (Sat, 04 Aug 2012)
New Revision: 23103
Modified:
Extractor/src/main/extractor_datasource.c
Log:
fix EOF logic
Modified: Extractor/src/main/extractor_datasource.c
===================================================================
--- Extractor/src/main/extractor_datasource.c 2012-08-04 19:46:03 UTC (rev
23102)
+++ Extractor/src/main/extractor_datasource.c 2012-08-04 19:57:47 UTC (rev
23103)
@@ -59,8 +59,7 @@
* Data is read from the source and shoved into decompressor
* in chunks this big.
*/
-#define COM_CHUNK_SIZE (12345)
-// #define COM_CHUNK_SIZE (10 * 1024)
+#define COM_CHUNK_SIZE (16 * 1024)
/**
@@ -849,14 +848,23 @@
/* copy decompressed bytes to target buffer */
in = COM_CHUNK_SIZE - cfs->strm.avail_out;
if (in > size - rc)
- in = size - rc;
+ {
+ if (Z_STREAM_END == ret)
+ {
+ cfs->uncompressed_size = cfs->fpos + in;
+ ret = Z_OK;
+ }
+ in = size - rc;
+ }
memcpy (&dst[rc], &cfs->result[cfs->result_pos], in);
cfs->fpos += in;
cfs->result_pos += in;
rc += in;
}
if (Z_STREAM_END == ret)
- cfs->uncompressed_size = cfs->fpos;
+ {
+ cfs->uncompressed_size = cfs->fpos;
+ }
return rc;
}
#endif
@@ -937,14 +945,23 @@
/* copy decompressed bytes to target buffer */
in = COM_CHUNK_SIZE - cfs->bstrm.avail_out;
if (in > size - rc)
- in = size - rc;
+ {
+ if (BZ_STREAM_END == ret)
+ {
+ cfs->uncompressed_size = cfs->fpos + in;
+ ret = BZ_OK;
+ }
+ in = size - rc;
+ }
memcpy (&dst[rc], &cfs->result[cfs->result_pos], in);
cfs->fpos += in;
cfs->result_pos += in;
rc += in;
}
if (BZ_STREAM_END == ret)
- cfs->uncompressed_size = cfs->fpos;
+ {
+ cfs->uncompressed_size = cfs->fpos;
+ }
return rc;
}
#endif
@@ -1082,7 +1099,10 @@
}
if (0 == ret)
{
- LOG ("Reached unexpected end of stream during seek operation\n");
+ LOG ("Reached unexpected end of stream at %llu during seek operation
to %llu (%d left)\n",
+ (unsigned long long) cfs->fpos,
+ (unsigned long long) nposition,
+ delta);
return -1;
}
ASSERT (ret <= delta);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23103 - Extractor/src/main,
gnunet <=