summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2013-07-18 00:55:36 (GMT)
committerNico Weber <thakis@chromium.org>2013-07-18 00:55:36 (GMT)
commitcce4807703a0595fd8db8c57db61184b0d00a187 (patch)
treef67699c705c65c38a7c909d68a70970f074d75ca /src
parent4c7802baf8ddead0cbfddefb1f9fa3587c6dd089 (diff)
downloadNinja-cce4807703a0595fd8db8c57db61184b0d00a187.zip
Ninja-cce4807703a0595fd8db8c57db61184b0d00a187.tar.gz
Ninja-cce4807703a0595fd8db8c57db61184b0d00a187.tar.bz2
Add back contents.resize(), but with a comment and just 1 instead of 10.
Diffstat (limited to 'src')
-rw-r--r--src/manifest_parser.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/manifest_parser.cc b/src/manifest_parser.cc
index f5e7eac..a1bb904 100644
--- a/src/manifest_parser.cc
+++ b/src/manifest_parser.cc
@@ -37,6 +37,14 @@ bool ManifestParser::Load(const string& filename, string* err) {
*err = "loading '" + filename + "': " + read_err;
return false;
}
+
+ // The lexer needs a nul byte at the end of its input, to know when it's done.
+ // It takes a StringPiece, and StringPiece's string constructor uses
+ // string::data(). data()'s return value isn't guaranteed to be
+ // null-terminated (although in practice - libc++, libstdc++, msvc's stl --
+ // it is, and C++11 demands that too), so add an explicit nul byte.
+ contents.resize(contents.size() + 1);
+
return Parse(filename, contents, err);
}