aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-10-29 08:27:07 +0000
committerJim Laskey <jlaskey@mac.com>2006-10-29 08:27:07 +0000
commitd8cb446aa2790a3a7386533a931566bb2e450b38 (patch)
tree92e8a6684784a441c59bbba62ba06c4876f44c0b /lib/Support
parentba726ab3ec88b3b149b4caa34dec5ade5a3a7f89 (diff)
downloadexternal_llvm-d8cb446aa2790a3a7386533a931566bb2e450b38.zip
external_llvm-d8cb446aa2790a3a7386533a931566bb2e450b38.tar.gz
external_llvm-d8cb446aa2790a3a7386533a931566bb2e450b38.tar.bz2
Not handling zero length strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31277 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/FoldingSet.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Support/FoldingSet.cpp b/lib/Support/FoldingSet.cpp
index 2ae9876..4fe67d7 100644
--- a/lib/Support/FoldingSet.cpp
+++ b/lib/Support/FoldingSet.cpp
@@ -61,7 +61,7 @@ void FoldingSetImpl::NodeID::AddString(const std::string &String) {
Pos = Units * sizeof(unsigned);
} else {
// Otherwise do it the hard way.
- for ( Pos += 4; Pos < Size; Pos += 4) {
+ for ( Pos += 4; Pos <= Size; Pos += 4) {
unsigned V = ((unsigned char)String[Pos - 4] << 24) |
((unsigned char)String[Pos - 3] << 16) |
((unsigned char)String[Pos - 2] << 8) |
@@ -77,7 +77,7 @@ void FoldingSetImpl::NodeID::AddString(const std::string &String) {
case 1: V = (V << 8) | (unsigned char)String[Size - 3]; // Fall thru.
case 2: V = (V << 8) | (unsigned char)String[Size - 2]; // Fall thru.
case 3: V = (V << 8) | (unsigned char)String[Size - 1]; break;
- case 0: return; // Nothing left.
+ default: return; // Nothing left.
}
Bits.push_back(V);