summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/package.h
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-06-11 13:43:23 +0200
committerAdam Borowski <kilobyte@angband.pl>2012-06-12 01:27:32 +0200
commit03b63e86588bae439a96d58c875e8c385468e405 (patch)
treeae65cfaa31a7bf4f3dbfd1c8d43d6a8ca6cb3675 /crawl-ref/source/package.h
parent2162151f39eea9d0ff81978901798c83b875e5dc (diff)
downloadcrawl-ref-03b63e86588bae439a96d58c875e8c385468e405.tar.gz
crawl-ref-03b63e86588bae439a96d58c875e8c385468e405.zip
Allow deleting/overwriting save chunks while they're being read.
Crawl itself doesn't ever read and write at the same time (I doubt it ever does more than one operation at once, too), but it just feels wrong to have a known data-loss bug in code that's separable from the rest of Crawl. By reusing already instantiated STL templates, this actually reduces binary size somewhat. This reverts commit ed9508da27c3ef0803bfd1e600465a5eb6566441.
Diffstat (limited to 'crawl-ref/source/package.h')
-rw-r--r--crawl-ref/source/package.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/crawl-ref/source/package.h b/crawl-ref/source/package.h
index a6e471dffd..c59f646509 100644
--- a/crawl-ref/source/package.h
+++ b/crawl-ref/source/package.h
@@ -6,7 +6,6 @@
#include <string>
#include <map>
#include <vector>
-#include <stack>
#ifdef USE_ZLIB
#include <zlib.h>
@@ -45,7 +44,7 @@ private:
chunk_reader(package *parent, len_t start);
void init(len_t start);
package *pkg;
- len_t next_block;
+ len_t first_block, next_block;
len_t off, block_left;
#ifdef USE_ZLIB
bool eof;
@@ -90,9 +89,10 @@ private:
bool aborted;
std::map<std::string, len_t> directory;
std::map<len_t, len_t> free_blocks;
- std::stack<len_t> unlinked_blocks;
+ std::vector<len_t> unlinked_blocks;
std::map<len_t, std::pair<len_t, len_t> > block_map;
std::set<len_t> new_chunks;
+ std::map<len_t, uint32_t> reader_count;
len_t extend_block(len_t at, len_t size, len_t by);
len_t alloc_block(len_t &size);
void finish_chunk(const std::string name, len_t at);