summaryrefslogtreecommitdiffstats
path: root/src/deps_log.cc
diff options
context:
space:
mode:
authorScott Graham <scottmg@chromium.org>2014-11-11 01:18:16 (GMT)
committerScott Graham <scottmg@chromium.org>2014-11-11 01:18:16 (GMT)
commitd77fea08b70f1ab1b7a981e6a0614fbf029724ed (patch)
tree195ba9908a2748914ac647f22509cd2d9ab66d97 /src/deps_log.cc
parentb6e6564a603b184ebb077ccb7b7a89976ef97a5b (diff)
downloadNinja-d77fea08b70f1ab1b7a981e6a0614fbf029724ed.zip
Ninja-d77fea08b70f1ab1b7a981e6a0614fbf029724ed.tar.gz
Ninja-d77fea08b70f1ab1b7a981e6a0614fbf029724ed.tar.bz2
save slash_bits in depslog
Diffstat (limited to 'src/deps_log.cc')
-rw-r--r--src/deps_log.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/deps_log.cc b/src/deps_log.cc
index d889dfd..9514446 100644
--- a/src/deps_log.cc
+++ b/src/deps_log.cc
@@ -30,7 +30,7 @@
// The version is stored as 4 bytes after the signature and also serves as a
// byte order mark. Signature and version combined are 16 bytes long.
const char kFileSignature[] = "# ninjadeps\n";
-const int kCurrentVersion = 3;
+const int kCurrentVersion = 4;
// Record size is currently limited to less than the full 32 bit, due to
// internal buffers having to have this size.
@@ -233,19 +233,15 @@ bool DepsLog::Load(const string& path, State* state, string* err) {
if (!UpdateDeps(out_id, deps))
++unique_dep_record_count;
} else {
- size_t path_size = size - 4;
+ int path_size = size - 8;
assert(path_size > 0); // CanonicalizePath() rejects empty paths.
// There can be up to 3 bytes of padding.
if (buf[path_size - 1] == '\0') --path_size;
if (buf[path_size - 1] == '\0') --path_size;
if (buf[path_size - 1] == '\0') --path_size;
- unsigned int slash_bits;
- string err;
- if (!CanonicalizePath(&buf[0], &path_size, &slash_bits, &err)) {
- read_failed = true;
- break;
- }
StringPiece path(buf, path_size);
+ unsigned int slash_bits =
+ *reinterpret_cast<unsigned int*>(buf + size - 8);
Node* node = state->GetNode(path, slash_bits);
// Check that the expected index matches the actual index. This can only
@@ -386,7 +382,7 @@ bool DepsLog::RecordId(Node* node) {
int path_size = node->path().size();
int padding = (4 - path_size % 4) % 4; // Pad path to 4 byte boundary.
- unsigned size = path_size + padding + 4;
+ unsigned size = path_size + padding + 4 + 4;
if (size > kMaxRecordSize) {
errno = ERANGE;
return false;
@@ -399,6 +395,9 @@ bool DepsLog::RecordId(Node* node) {
}
if (padding && fwrite("\0\0", padding, 1, file_) < 1)
return false;
+ unsigned int slash_bits = node->slash_bits();
+ if (fwrite(&slash_bits, 4, 1, file_) < 1)
+ return false;
int id = nodes_.size();
unsigned checksum = ~(unsigned)id;
if (fwrite(&checksum, 4, 1, file_) < 1)