aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/raw_ostream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/raw_ostream.cpp')
-rw-r--r--lib/Support/raw_ostream.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp
index 64d9205..230d9a8 100644
--- a/lib/Support/raw_ostream.cpp
+++ b/lib/Support/raw_ostream.cpp
@@ -304,11 +304,12 @@ raw_ostream &raw_ostream::indent(unsigned NumSpaces) {
" ";
// Usually the indentation is small, handle it with a fastpath.
- if (NumSpaces <= array_lengthof(Spaces))
+ if (NumSpaces < array_lengthof(Spaces))
return write(Spaces, NumSpaces);
while (NumSpaces) {
- unsigned NumToWrite = std::min(NumSpaces, (unsigned)array_lengthof(Spaces));
+ unsigned NumToWrite = std::min(NumSpaces,
+ (unsigned)array_lengthof(Spaces)-1);
write(Spaces, NumToWrite);
NumSpaces -= NumToWrite;
}