[pypy-svn] pypy real-rffi.INT: Fix types in _winreg module

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


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: real-rffi.INT
Changeset: r42392:850936b3345f
Date: 2011-03-02 16:23 +0100
http://bitbucket.org/pypy/pypy/changeset/850936b3345f/

Log:	Fix types in _winreg module

diff --git a/pypy/module/_winreg/interp_winreg.py b/pypy/module/_winreg/interp_winreg.py
--- a/pypy/module/_winreg/interp_winreg.py
+++ b/pypy/module/_winreg/interp_winreg.py
@@ -270,7 +270,7 @@
         if space.is_true(space.isinstance(w_value, space.w_int)):
             buflen = rffi.sizeof(rwin32.DWORD)
             buf1 = lltype.malloc(rffi.CArray(rwin32.DWORD), 1, flavor='raw')
-            buf1[0] = space.uint_w(w_value)
+            buf1[0] = rffi.cast(rwin32.DWORD, space.uint_w(w_value))
             buf = rffi.cast(rffi.CCHARP, buf1)
 
     elif typ == rwinreg.REG_SZ or typ == rwinreg.REG_EXPAND_SZ:
@@ -471,7 +471,7 @@
             raiseWindowsError(space, ret, 'CreateKey')
         return space.wrap(W_HKEY(rethkey[0]))
 
- at unwrap_spec(subkey=str, res=int, sam=rffi.r_uint)
+ at unwrap_spec(subkey=str, res=int, sam=r_uint)
 def CreateKeyEx(space, w_hkey, subkey, res=0, sam=rwinreg.KEY_WRITE):
     """key = CreateKey(key, sub_key) - Creates or opens the specified key.
 
@@ -521,7 +521,7 @@
     if ret != 0:
         raiseWindowsError(space, ret, 'RegDeleteValue')
 
- at unwrap_spec(subkey=str, res=int, sam=rffi.r_uint)
+ at unwrap_spec(subkey=str, res=int, sam=r_uint)
 def OpenKey(space, w_hkey, subkey, res=0, sam=rwinreg.KEY_READ):
     """key = OpenKey(key, sub_key, res = 0, sam = KEY_READ) - Opens the specified key.
 
@@ -624,7 +624,7 @@
     # retrieve such a key name.
     with lltype.scoped_alloc(rffi.CCHARP.TO, 257) as buf:
         with lltype.scoped_alloc(rwin32.LPDWORD.TO, 1) as retValueSize:
-            retValueSize[0] = r_uint(257) # includes NULL terminator
+            retValueSize[0] = rffi.cast(rwin32.DWORD, r_uint(257))
             ret = rwinreg.RegEnumKeyEx(hkey, index, buf, retValueSize,
                                        null_dword, None, null_dword,
                                        lltype.nullptr(rwin32.PFILETIME.TO))


More information about the Pypy-commit mailing list