[pypy-svn] pypy real-rffi.INT: More fixes, found when attempting to translate.

amauryfa commits-noreply at bitbucket.org
Wed Mar 2 20:23:14 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: real-rffi.INT
Changeset: r42395:511f2c681827
Date: 2011-03-02 20:17 +0100
http://bitbucket.org/pypy/pypy/changeset/511f2c681827/

Log:	More fixes, found when attempting to translate.

diff --git a/pypy/rlib/rarithmetic.py b/pypy/rlib/rarithmetic.py
--- a/pypy/rlib/rarithmetic.py
+++ b/pypy/rlib/rarithmetic.py
@@ -437,7 +437,9 @@
 _predefined_ints = {
     (True, 64): r_longlong,
     (False, 64): r_ulonglong,
-    }
+    (True, 32): build_int('r_int32', True, 32),
+    (False, 32): build_int('r_uint32', True, 32),
+}
 
 # the 'float' C type
 

diff --git a/pypy/module/_socket/interp_socket.py b/pypy/module/_socket/interp_socket.py
--- a/pypy/module/_socket/interp_socket.py
+++ b/pypy/module/_socket/interp_socket.py
@@ -345,7 +345,7 @@
             try:
                 if cmd == _c.SIO_RCVALL:
                     option_ptr = rffi.cast(rffi.INTP, value_ptr)
-                    option_ptr[0] = space.int_w(w_option)
+                    option_ptr[0] = rffi.cast(rffi.INT, space.int_w(w_option))
                 elif cmd == _c.SIO_KEEPALIVE_VALS:
                     w_onoff, w_time, w_interval = space.unpackiterable(w_option)
                     option_ptr = rffi.cast(lltype.Ptr(_c.tcp_keepalive), value_ptr)

diff --git a/pypy/module/_multiprocessing/interp_win32.py b/pypy/module/_multiprocessing/interp_win32.py
--- a/pypy/module/_multiprocessing/interp_win32.py
+++ b/pypy/module/_multiprocessing/interp_win32.py
@@ -136,13 +136,13 @@
     statep = lltype.malloc(rffi.CArrayPtr(rffi.UINTP).TO, 3, flavor='raw', zero=True)
     try:
         if not space.is_w(w_pipemode, space.w_None):
-            state[0] = space.uint_w(w_pipemode)
+            state[0] = rffi.cast(rffi.UINT, space.uint_w(w_pipemode))
             statep[0] = rffi.ptradd(state, 0)
         if not space.is_w(w_maxinstances, space.w_None):
-            state[1] = space.uint_w(w_maxinstances)
+            state[1] = rffi.cast(rffi.UINT, space.uint_w(w_maxinstances))
             statep[1] = rffi.ptradd(state, 1)
         if not space.is_w(w_timeout, space.w_None):
-            state[2] = space.uint_w(w_timeout)
+            state[2] = rffi.cast(rffi.UINT, space.uint_w(w_timeout))
             statep[2] = rffi.ptradd(state, 2)
         if not _SetNamedPipeHandleState(handle, statep[0], statep[1], statep[2]):
             raise wrap_windowserror(space, rwin32.lastWindowsError())

diff --git a/pypy/rlib/clibffi.py b/pypy/rlib/clibffi.py
--- a/pypy/rlib/clibffi.py
+++ b/pypy/rlib/clibffi.py
@@ -134,10 +134,9 @@
 
     FFI_TYPE_STRUCT = rffi_platform.ConstantInteger('FFI_TYPE_STRUCT')
 
-    size_t = rffi_platform.SimpleType("size_t", rffi.ULONG)
     ffi_abi = rffi_platform.SimpleType("ffi_abi", rffi.USHORT)
 
-    ffi_type = rffi_platform.Struct('ffi_type', [('size', rffi.ULONG),
+    ffi_type = rffi_platform.Struct('ffi_type', [('size', rffi.SIZE_T),
                                                  ('alignment', rffi.USHORT),
                                                  ('type', rffi.USHORT),
                                                  ('elements', FFI_TYPE_PP)])
@@ -151,7 +150,7 @@
 
 def configure_simple_type(type_name):
     l = lltype.malloc(FFI_TYPE_P.TO, flavor='raw', immortal=True)
-    for tp, name in [(size_t, 'size'),
+    for tp, name in [(rffi.SIZE_T, 'size'),
                      (rffi.USHORT, 'alignment'),
                      (rffi.USHORT, 'type')]:
         value = getattr(cConfig, '%s_%s' % (type_name, name))
@@ -178,7 +177,6 @@
     setattr(cConfig, k, v)
 
 FFI_TYPE_P.TO.become(cConfig.ffi_type)
-size_t = cConfig.size_t
 ffi_abi = cConfig.ffi_abi
 
 for name in type_names:


More information about the Pypy-commit mailing list