]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Make sure hash functions always return non-negative. (CVS 969)
authordrh <drh@noemail.net>
Mon, 12 May 2003 23:06:52 +0000 (23:06 +0000)
committerdrh <drh@noemail.net>
Mon, 12 May 2003 23:06:52 +0000 (23:06 +0000)
FossilOrigin-Name: 39a3e403f0440acb2f85a064ec23d404f9cdfbc4

manifest
manifest.uuid
src/hash.c
src/util.c

index 5d5c9b626f347d44bdc05028dd558b85c957e32b..16953c91394a6b16546aa49213313d6c998b9b3c 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Changed\sPRAGMA\sdatabase_list\sto\sshow\sthe\sfilename.\s(CVS\s968)
-D 2003-05-11T20:09:20
+C Make\ssure\shash\sfunctions\salways\sreturn\snon-negative.\s(CVS\s969)
+D 2003-05-12T23:06:53
 F Makefile.in 004acec253ecdde985c8ecd5b7c9accdb210378f
 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -30,7 +30,7 @@ F src/delete.c f9536a75b444a21f11b7a1bc0fb8c876f691b013
 F src/encode.c ed720e54ec4ef4d4de651592f1dd1c74d422bbd2
 F src/expr.c a666ef5220ca90ebcf40c8ccc783966a345a7616
 F src/func.c 882c3ed5a02be18cd904715c7ec62947a34a3605
-F src/hash.c 4fc39feb7b7711f6495ee9f2159559bedb043e1f
+F src/hash.c 058f077c1f36f266581aa16f907a3903abf64aa3
 F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
 F src/insert.c c230a8c216f6788095d46f0e270406a93aae45af
 F src/main.c 16e68905793b118552a9cf43a9f77ca1d9e395a9
@@ -57,7 +57,7 @@ F src/threadtest.c d641a5219e718e18a1a80a50eb9bb549f451f42e
 F src/tokenize.c 2ba93fe10d5f57f0cc20b07417c3244a30c324b3
 F src/trigger.c 8ee811986080de60d9d883ad96daffea82014f27
 F src/update.c dc3b680b4cf2cb6d839950b68d632850746639b9
-F src/util.c 87635cfdfffa056a8d3147719357aa442374f78c
+F src/util.c 8065b78806a5132119452d9e0417cf071e6f02f9
 F src/vacuum.c 14ac3073203fa021e01ffe33db56968ad79a8344
 F src/vdbe.c e9e560b0c568fb4ffb189d3e0d91628a33d2a367
 F src/vdbe.h 985c24f312d10f9ef8f9a8b8ea62fcdf68e82f21
@@ -165,7 +165,7 @@ F www/speed.tcl cb4c10a722614aea76d2c51f32ee43400d5951be
 F www/sqlite.tcl 4bd1729e320f5fa9125f0022b281fbe839192125
 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P bad2065337d8dcaacd519b8f1730a90f1c933c3e
-R 2f3baa72d19786b03a0300d43892d103
-U jplyon
-Z 6c3c744be243d2916c4a968c6f03228a
+P 3da10d2d02e331f136fcf857dc4c435c67ee7196
+R 4e32f2787678262cce8381eeed283f3f
+U drh
+Z 9359b7aa0886849f400e188f1dbf3d43
index 8376da04b63900af46b4b89473a3699971b2d9ad..74c66123148a9d639b89281693fda68bbec64de7 100644 (file)
@@ -1 +1 @@
-3da10d2d02e331f136fcf857dc4c435c67ee7196
\ No newline at end of file
+39a3e403f0440acb2f85a064ec23d404f9cdfbc4
\ No newline at end of file
index 5b176be0dfa53dc84d4fc83eb21d0d7daeb3b284..bb2291c6f3c45e31fb1071acdb7cf6656645188c 100644 (file)
@@ -12,7 +12,7 @@
 ** This is the implementation of generic hash-tables
 ** used in SQLite.
 **
-** $Id: hash.c,v 1.9 2003/01/02 14:43:57 drh Exp $
+** $Id: hash.c,v 1.10 2003/05/12 23:06:53 drh Exp $
 */
 #include "sqliteInt.h"
 #include <assert.h>
@@ -108,8 +108,7 @@ static int binHash(const void *pKey, int nKey){
   while( nKey-- > 0 ){
     h = (h<<3) ^ h ^ *(z++);
   }
-  if( h<0 ) h = -h;
-  return h;
+  return h & 0x7fffffff;
 }
 static int binCompare(const void *pKey1, int n1, const void *pKey2, int n2){
   if( n1!=n2 ) return n2-n1;
index 979fd5e2fbcacf85390b876254f772f24d0b8bd1..b4e6d240a9b7c5363b41ecbff29020fd7fc8351a 100644 (file)
@@ -14,7 +14,7 @@
 ** This file contains functions for allocating memory, comparing
 ** strings, and stuff like that.
 **
-** $Id: util.c,v 1.62 2003/04/18 17:45:14 drh Exp $
+** $Id: util.c,v 1.63 2003/05/12 23:06:53 drh Exp $
 */
 #include "sqliteInt.h"
 #include <stdarg.h>
@@ -588,8 +588,7 @@ int sqliteHashNoCase(const char *z, int n){
     h = (h<<3) ^ h ^ UpperToLower[(unsigned char)*z++];
     n--;
   }
-  if( h<0 ) h = -h;
-  return h;
+  return h & 0x7fffffff;
 }
 
 /*