python: properly initialize string length on 64bit systems.
authorEthan Jackson <ethan@nicira.com>
Mon, 3 Jan 2011 20:27:50 +0000 (12:27 -0800)
committerEthan Jackson <ethan@nicira.com>
Tue, 4 Jan 2011 18:30:37 +0000 (10:30 -0800)
types.py was initializing max string length to 2^64 - 1 instead of
UINT_MAX on 64 bit systems.  This commit fixes that problem.

python/ovs/db/types.py

index d42ac7f..a3b6ba7 100644 (file)
@@ -358,7 +358,7 @@ class BaseType(object):
         elif self.type == StringType:
             if self.min_length is not None:
                 stmts.append('%s.u.string.minLen = %d;' % (var, self.min_length))            
-            if self.max_length is not None:
+            if self.max_length != sys.maxint:
                 stmts.append('%s.u.string.maxLen = %d;' % (var, self.max_length))
         elif self.type == UuidType:
             if self.ref_table is not None: