[pypy-svn] r47115 - pypy/dist/pypy/rpython/module

mwh at codespeak.net mwh at codespeak.net
Wed Oct 3 15:42:58 CEST 2007


Author: mwh
Date: Wed Oct  3 15:42:56 2007
New Revision: 47115

Modified:
   pypy/dist/pypy/rpython/module/ll_os.py
   pypy/dist/pypy/rpython/module/ll_time.py
Log:
more INT->LONG casting.
not sure how this approach will scale...


Modified: pypy/dist/pypy/rpython/module/ll_os.py
==============================================================================
--- pypy/dist/pypy/rpython/module/ll_os.py	(original)
+++ pypy/dist/pypy/rpython/module/ll_os.py	Wed Oct  3 15:42:56 2007
@@ -71,7 +71,7 @@
     def extdef_for_os_function_returning_int(self, name, **kwds):
         c_func = self.llexternal(name, [], rffi.INT, **kwds)
         def c_func_llimpl():
-            res = c_func()
+            res = rffi.cast(rffi.LONG, c_func())
             if res == -1:
                 raise OSError(rffi.get_errno(), "%s failed" % name)
             return res
@@ -355,7 +355,7 @@
                                   rffi.INT)
 
         def os_open_llimpl(path, flags, mode):
-            result = os_open(path, flags, mode)
+            result = rffi.cast(rffi.LONG, os_open(path, flags, mode))
             if result == -1:
                 raise OSError(rffi.get_errno(), "os_open failed")
             return result
@@ -488,8 +488,9 @@
                                        [rffi.INT, rffi.LONGLONG], rffi.INT)
 
         def ftruncate_llimpl(fd, length):
-            res = os_ftruncate(rffi.cast(rffi.INT, fd),
-                               rffi.cast(rffi.LONGLONG, length))
+            res = rffi.cast(rffi.LONG,
+                            os_ftruncate(rffi.cast(rffi.INT, fd),
+                                         rffi.cast(rffi.LONGLONG, length)))
             if res < 0:
                 raise OSError(rffi.get_errno(), "os_lseek failed")
 
@@ -781,7 +782,7 @@
         os_isatty = self.llexternal(underscore_on_windows+'isatty', [rffi.INT], rffi.INT)
 
         def isatty_llimpl(fd):
-            res = os_isatty(rffi.cast(rffi.INT, fd))
+            res = rffi.cast(rffi.LONG, os_isatty(rffi.cast(rffi.INT, fd)))
             return res != 0
 
         return extdef([int], bool, llimpl=isatty_llimpl,

Modified: pypy/dist/pypy/rpython/module/ll_time.py
==============================================================================
--- pypy/dist/pypy/rpython/module/ll_time.py	(original)
+++ pypy/dist/pypy/rpython/module/ll_time.py	Wed Oct  3 15:42:56 2007
@@ -82,11 +82,11 @@
                 t = lltype.malloc(self.TIMEVAL, flavor='raw')
 
                 if self.GETTIMEOFDAY_NO_TZ:
-                    if c_gettimeofday(t) == 0:
+                    if rffi.cast(rffi.LONG, c_gettimeofday(t)) == 0:
                         result = float(t.c_tv_sec) + \
                                  float(t.c_tv_usec) * 0.000001
                 else:
-                    if c_gettimeofday(t, void) == 0:
+                    if rffi.cast(rffi.LONG, c_gettimeofday(t, void)) == 0:
                         result = float(t.c_tv_sec) + \
                                  float(t.c_tv_usec) * 0.000001
                 lltype.free(t, flavor='raw')
@@ -162,7 +162,7 @@
                     frac = math.fmod(secs, 1.0)
                     t.c_tv_sec = int(secs)
                     t.c_tv_usec = int(frac*1000000.0)
-                    if c_select(0, void, void, void, t) != 0:
+                    if rffi.cast(rffi.LONG, c_select(0, void, void, void, t)) != 0:
                         errno = rffi.get_errno()
                         if errno != EINTR:
                             raise OSError(rffi.get_errno(), "Select failed")



More information about the Pypy-commit mailing list