diff options
author | Evan Martin <martine@danga.com> | 2012-12-30 20:48:44 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2013-04-08 21:45:07 (GMT) |
commit | 2f2bacc39ee47b648d6b0aea4c60cb64c41393df (patch) | |
tree | 3b41cd8dea016730843118f8da68e986fd283899 /src/deps_log.cc | |
parent | 70fd0f590c3a46a4a9ff9a160f455c5c30f5b90a (diff) | |
download | Ninja-2f2bacc39ee47b648d6b0aea4c60cb64c41393df.zip Ninja-2f2bacc39ee47b648d6b0aea4c60cb64c41393df.tar.gz Ninja-2f2bacc39ee47b648d6b0aea4c60cb64c41393df.tar.bz2 |
expand DepsLog test, fix two bugs it revealed
Diffstat (limited to 'src/deps_log.cc')
-rw-r--r-- | src/deps_log.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/deps_log.cc b/src/deps_log.cc index 23c9820..5732b6d 100644 --- a/src/deps_log.cc +++ b/src/deps_log.cc @@ -63,11 +63,11 @@ bool DepsLog::RecordDeps(Node* node, TimeStamp mtime, fwrite(&size, 2, 1, file_); int id = node->id(); fwrite(&id, 4, 1, file_); - int timestamp = node->mtime(); + int timestamp = mtime; fwrite(×tamp, 4, 1, file_); for (vector<Node*>::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { - id = node->id(); + id = (*i)->id(); fwrite(&id, 4, 1, file_); } @@ -89,7 +89,6 @@ bool DepsLog::Load(const string& path, State* state, string* err) { return false; } - int id = 0; for (;;) { uint16_t size; if (fread(&size, 2, 1, f) < 1) @@ -127,8 +126,8 @@ bool DepsLog::Load(const string& path, State* state, string* err) { StringPiece path(buf, size); Node* node = state->GetNode(path); assert(node->id() < 0); - node->set_id(id); - ++id; + node->set_id(nodes_.size()); + nodes_.push_back(node); } } if (ferror(f)) { |