[Zodb-checkins] CVS: ZODB3/ZODB - TimeStamp.c:1.16

Guido van Rossum guido@python.org
Mon, 7 Oct 2002 13:54:28 -0400


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv16280

Modified Files:
	TimeStamp.c 
Log Message:
TimeStamp_compare should clip its return value to the range [-1, 1].


=== ZODB3/ZODB/TimeStamp.c 1.15 => 1.16 ===
--- ZODB3/ZODB/TimeStamp.c:1.15	Fri Mar  8 13:36:13 2002
+++ ZODB3/ZODB/TimeStamp.c	Mon Oct  7 13:54:27 2002
@@ -344,7 +344,10 @@
 static int
 TimeStamp_compare(TimeStamp *v, TimeStamp *w)
 {
-  return memcmp(v->data, w->data, 8);
+  int cmp = memcmp(v->data, w->data, 8);
+  if (cmp < 0) return -1;
+  if (cmp > 0) return 1;
+  return 0;
 }
 
 static long