     n-write port wait-to-write
     c-ptr n-write buffer buffer-write
 
-    n-remaining n-write - dup 0 > [
+    n-remaining n-write fixnum-fast dup 0 > [
         n-write c-ptr <displaced-alien> swap port port-write
     ] [ drop ] if ; inline recursive
 
 PRIVATE>
 
 M: output-port stream-write
-    dup check-disposed
-    [ binary-object integer>fixnum-strict ] [ port-write ] bi* ;
+    dup check-disposed [
+        binary-object
+        [ check-c-ptr ] [ integer>fixnum-strict ] bi*
+    ] [ port-write ] bi* ;
 
 HOOK: tell-handle os ( handle -- n )
 

PRIVATE>

M: input-port stream-read-partial-unsafe
    swapd prepare-read read-step
    [ swap [ memcpy ] keep ] [ 2drop 0 ] if* ;

M: input-port stream-read-unsafe
    swapd prepare-read 0 read-loop ;

<PRIVATE



HINTS: (decode-until)
    { string input-port object } ;
