[pypy-svn] r53665 - pypy/branch/io-improvements/pypy/rpython/module

docgok at codespeak.net docgok at codespeak.net
Thu Apr 10 18:27:03 CEST 2008


Author: docgok
Date: Thu Apr 10 18:27:00 2008
New Revision: 53665

Modified:
   pypy/branch/io-improvements/pypy/rpython/module/ll_os.py
Log:
Updated pointer arithmetic.



Modified: pypy/branch/io-improvements/pypy/rpython/module/ll_os.py
==============================================================================
--- pypy/branch/io-improvements/pypy/rpython/module/ll_os.py	(original)
+++ pypy/branch/io-improvements/pypy/rpython/module/ll_os.py	Thu Apr 10 18:27:00 2008
@@ -526,7 +526,9 @@
                 finally:
                     lltype.free(outbuf, flavor='raw')
             else:
-                outbuf = rffi.cast(rffi.VOIDP, data)
+                data_start = cast_ptr_to_adr(llstr(data)) + \
+                    fieldoffsetof(STR, 'chars') + itemoffsetof(STR.chars, 0)
+                outbuf = rffi.cast(rffi.VOIDP, data_start)
                 written = rffi.cast(lltype.Signed, os_write(
                     rffi.cast(rffi.INT, fd),
                     outbuf, rffi.cast(rffi.SIZE_T, count)))



More information about the Pypy-commit mailing list