summaryrefslogtreecommitdiffstats
path: root/src/util.cc
diff options
context:
space:
mode:
authorDaniel Weber <daniel.weber.dev@gmail.com>2016-08-22 22:26:38 (GMT)
committerDaniel Weber <daniel.weber.dev@gmail.com>2016-08-22 22:26:38 (GMT)
commitc4b09e1e7e1d531a818601be33e0ec8ee18c3cde (patch)
tree53765aa88182d29c3156fd2bea822e660e814127 /src/util.cc
parent94fc14314501a78b1742e910f7c920188b2753da (diff)
downloadNinja-c4b09e1e7e1d531a818601be33e0ec8ee18c3cde.zip
Ninja-c4b09e1e7e1d531a818601be33e0ec8ee18c3cde.tar.gz
Ninja-c4b09e1e7e1d531a818601be33e0ec8ee18c3cde.tar.bz2
Allow more path components
- 60 instead of 30 path components - 64 instead of 32 backslashes in a path (windows only) Issue: 1161
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/util.cc b/src/util.cc
index e31fd1f..fb57cec 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -90,7 +90,7 @@ void Error(const char* msg, ...) {
fprintf(stderr, "\n");
}
-bool CanonicalizePath(string* path, unsigned int* slash_bits, string* err) {
+bool CanonicalizePath(string* path, uint64_t* slash_bits, string* err) {
METRIC_RECORD("canonicalize str");
size_t len = path->size();
char* str = 0;
@@ -103,19 +103,19 @@ bool CanonicalizePath(string* path, unsigned int* slash_bits, string* err) {
}
#ifdef _WIN32
-static unsigned int ShiftOverBit(int offset, unsigned int bits) {
+static uint64_t ShiftOverBit(int offset, uint64_t bits) {
// e.g. for |offset| == 2:
// | ... 9 8 7 6 5 4 3 2 1 0 |
// \_________________/ \_/
// above below
// So we drop the bit at offset and move above "down" into its place.
- unsigned int above = bits & ~((1 << (offset + 1)) - 1);
- unsigned int below = bits & ((1 << offset) - 1);
+ uint64_t above = bits & ~((1 << (offset + 1)) - 1);
+ uint64_t below = bits & ((1 << offset) - 1);
return (above >> 1) | below;
}
#endif
-bool CanonicalizePath(char* path, size_t* len, unsigned int* slash_bits,
+bool CanonicalizePath(char* path, size_t* len, uint64_t* slash_bits,
string* err) {
// WARNING: this function is performance-critical; please benchmark
// any changes you make to it.
@@ -125,7 +125,7 @@ bool CanonicalizePath(char* path, size_t* len, unsigned int* slash_bits,
return false;
}
- const int kMaxPathComponents = 30;
+ const int kMaxPathComponents = 60;
char* components[kMaxPathComponents];
int component_count = 0;
@@ -135,8 +135,8 @@ bool CanonicalizePath(char* path, size_t* len, unsigned int* slash_bits,
const char* end = start + *len;
#ifdef _WIN32
- unsigned int bits = 0;
- unsigned int bits_mask = 1;
+ uint64_t bits = 0;
+ uint64_t bits_mask = 1;
int bits_offset = 0;
// Convert \ to /, setting a bit in |bits| for each \ encountered.
for (char* c = path; c < end; ++c) {
@@ -150,7 +150,7 @@ bool CanonicalizePath(char* path, size_t* len, unsigned int* slash_bits,
bits_offset++;
}
}
- if (bits_offset > 32) {
+ if (bits_offset > 64) {
*err = "too many path components";
return false;
}