[llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp

Jim Laskey jlaskey at apple.com
Sun Oct 29 01:27:30 PDT 2006



Changes in directory llvm/lib/Support:

FoldingSet.cpp updated: 1.6 -> 1.7
---
Log message:

Not handling zero length strings.

---
Diffs of the changes:  (+2 -2)

 FoldingSet.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/lib/Support/FoldingSet.cpp
diff -u llvm/lib/Support/FoldingSet.cpp:1.6 llvm/lib/Support/FoldingSet.cpp:1.7
--- llvm/lib/Support/FoldingSet.cpp:1.6	Fri Oct 27 14:38:32 2006
+++ llvm/lib/Support/FoldingSet.cpp	Sun Oct 29 02:27:07 2006
@@ -61,7 +61,7 @@
     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 @@
   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);






More information about the llvm-commits mailing list