[pypy-svn] r63236 - pypy/trunk/pypy/module/pyexpat

afa at codespeak.net afa at codespeak.net
Mon Mar 23 16:27:38 CET 2009


Author: afa
Date: Mon Mar 23 16:27:38 2009
New Revision: 63236

Modified:
   pypy/trunk/pypy/module/pyexpat/interp_pyexpat.py
Log:
Use the correct cast to lltype.Signed, instead of r_uint


Modified: pypy/trunk/pypy/module/pyexpat/interp_pyexpat.py
==============================================================================
--- pypy/trunk/pypy/module/pyexpat/interp_pyexpat.py	(original)
+++ pypy/trunk/pypy/module/pyexpat/interp_pyexpat.py	Mon Mar 23 16:27:38 2009
@@ -6,7 +6,6 @@
 from pypy.objspace.descroperation import object_setattr
 from pypy.rpython.lltypesystem import rffi, lltype
 from pypy.rlib.unroll import unrolling_iterable
-from pypy.rlib.rarithmetic import r_uint
 
 from pypy.rpython.tool import rffi_platform
 from pypy.translator.tool.cbuild import ExternalCompilationInfo
@@ -169,7 +168,7 @@
         result_error = "None"
 
     if name == 'CharacterDataHandler':
-        pre_code = 'if parser.buffer_string(space, w_arg0, r_uint(arg1)): return'
+        pre_code = 'if parser.buffer_string(space, w_arg0, arg1): return'
     else:
         pre_code = 'parser.flush_character_buffer(space)'
 
@@ -339,8 +338,9 @@
             return space.w_None
 
     def w_convert_charp_n(self, space, data, length):
+        ll_length = rffi.cast(lltype.Signed, length)
         if data:
-            return self.w_convert(space, rffi.charp2strn(data, r_uint(length)))
+            return self.w_convert(space, rffi.charp2strn(data, ll_length))
         else:
             return space.w_None
 
@@ -376,16 +376,17 @@
             space.newtuple(children)])
 
     def buffer_string(self, space, w_string, length):
+        ll_length = rffi.cast(lltype.Signed, length)
         if self.buffer_w is not None:
-            if self.buffer_used + length > self.buffer_size:
+            if self.buffer_used + ll_length > self.buffer_size:
                 self.flush_character_buffer(space)
                 # handler might have changed; drop the rest on the floor
                 # if there isn't a handler anymore
                 if self.w_character_data_handler is None:
                     return True
-            if length <= self.buffer_size:
+            if ll_length <= self.buffer_size:
                 self.buffer_w.append(w_string)
-                self.buffer_used += length
+                self.buffer_used += ll_length
                 return True
             else:
                 self.buffer_w = []



More information about the Pypy-commit mailing list