diff options
author | Dan Gohman <gohman@apple.com> | 2009-08-24 04:43:38 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-08-24 04:43:38 +0000 |
commit | 7787fe2cbe875e938020252bdbbd35e6952a9099 (patch) | |
tree | cd552311987ce12e59937ca3688b6211b4e98ed4 | |
parent | 06c1ecc957521a115c8b24064de9178fbde682b4 (diff) | |
download | external_llvm-7787fe2cbe875e938020252bdbbd35e6952a9099.zip external_llvm-7787fe2cbe875e938020252bdbbd35e6952a9099.tar.gz external_llvm-7787fe2cbe875e938020252bdbbd35e6952a9099.tar.bz2 |
Correctly account for the Spaces array nul terminator. Thanks Chris!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79894 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Support/raw_ostream.cpp | 5 |
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; } |