[pypy-svn] r54617 - pypy/branch/io-improvements/pypy/rpython/lltypesystem

fijal at codespeak.net fijal at codespeak.net
Sat May 10 13:20:02 CEST 2008


Author: fijal
Date: Sat May 10 13:20:02 2008
New Revision: 54617

Modified:
   pypy/branch/io-improvements/pypy/rpython/lltypesystem/rstr.py
Log:
Make sure that we're talking about unsigned here.


Modified: pypy/branch/io-improvements/pypy/rpython/lltypesystem/rstr.py
==============================================================================
--- pypy/branch/io-improvements/pypy/rpython/lltypesystem/rstr.py	(original)
+++ pypy/branch/io-improvements/pypy/rpython/lltypesystem/rstr.py	Sat May 10 13:20:02 2008
@@ -56,6 +56,9 @@
                 llmemory.sizeof(CHAR_TP) * item)
     
     def copy_string_contents(s1, s2, s1start, s2start, lgt):
+        assert s1start >= 0
+        assert s2start >= 0
+        assert lgt >= 0
         src = llmemory.cast_ptr_to_adr(s1) + _str_ofs(s1start)
         dest = llmemory.cast_ptr_to_adr(s2) + _str_ofs(s2start)
         llmemory.raw_memcopy(src, dest, llmemory.sizeof(CHAR_TP) * lgt)
@@ -629,7 +632,10 @@
     def ll_stringslice_startonly(s1, start):
         len1 = len(s1.chars)
         newstr = s1.malloc(len1 - start)
-        s1.copy_contents(s1, newstr, start, 0, len1 - start)
+        lgt = len1 - start
+        assert lgt >= 0
+        assert start >= 0
+        s1.copy_contents(s1, newstr, start, 0, lgt)
         return newstr
 
     def ll_stringslice(s1, slice):
@@ -640,7 +646,10 @@
                 return s1
             stop = len(s1.chars)
         newstr = s1.malloc(stop - start)
-        s1.copy_contents(s1, newstr, start, 0, stop - start)
+        assert start >= 0
+        lgt = stop - start
+        assert lgt >= 0
+        s1.copy_contents(s1, newstr, start, 0, lgt)
         return newstr
 
     def ll_stringslice_minusone(s1):



More information about the Pypy-commit mailing list