Index: src/OFHashes.m ================================================================== --- src/OFHashes.m +++ src/OFHashes.m @@ -13,10 +13,11 @@ #include #import "OFHashes.h" #import "OFAutoreleasePool.h" +#import "OFExceptions.h" #import "OFMacros.h" int _OFHashing_reference; /******* @@ -138,15 +139,17 @@ - updateWithBuffer: (const char*)buffer ofSize: (size_t)size { uint32_t t; - if (calculated) - return self; if (size == 0) return self; + if (calculated) + /* FIXME: Maybe a new exception would be better */ + @throw [OFInvalidArgumentException newWithClass: isa]; + /* Update bitcount */ t = bits[0]; if ((bits[0] = t + ((uint32_t)size << 3)) < t) /* Carry from low to high */ bits[1]++; @@ -375,15 +378,17 @@ } - updateWithBuffer: (const char*)buf ofSize: (size_t)size { - if (calculated) - return self; if (size == 0) return self; + if (calculated) + /* FIXME: Maybe a new exception would be better */ + @throw [OFInvalidArgumentException newWithClass: isa]; + sha1_update(state, &count, buffer, buf, size); return self; }