diff -r 48b0c2edb0df -r d8379f5d5a1d src/HashTable.h --- a/src/HashTable.h Sun Jul 29 18:02:13 2012 -0700 +++ b/src/HashTable.h Sun Jul 29 18:19:12 2012 -0700 @@ -1,19 +1,20 @@ -/* +/* vim: set ts=4 sw=4 tw=99 et: + * * Copyright (C) 2012 David Anderson * - * This file is part of JITCraft. + * This file is part of SourcePawn. * - * JITCraft is free software: you can redistribute it and/or modify it under + * SourcePawn is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) * any later version. * - * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY + * SourcePawn is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with - * JITCraft. If not, see http://www.gnu.org/licenses/. + * SourcePawn. If not, see http://www.gnu.org/licenses/. */ #ifndef _INCLUDE_KEIMA_HASHTABLE_H_ #define _INCLUDE_KEIMA_HASHTABLE_H_ @@ -191,7 +192,6 @@ } bool grow() { - assert(IsPowerOfTwo(kMaxCapacity)); if (capacity_ >= kMaxCapacity) { this->reportAllocationOverflow(); return false; @@ -339,10 +339,12 @@ } bool init(uint32 capacity = 0) { - if (capacity < kMinCapacity) + if (capacity < kMinCapacity) { capacity = kMinCapacity; - else if (capacity > kMaxCapacity) - capacity = kMaxCapacity; + } else if (capacity > kMaxCapacity) { + this->reportAllocationOverflow(); + return false; + } minCapacity_ = capacity;