pike.git / src / modules / _Stdio / buffer.cmod

version» Context lines:

pike.git/src/modules/_Stdio/buffer.cmod:428:    io->output_triggered = 1;    push_string( s );    apply( o, "write", 1 );    l = Pike_sp[-1].u.integer;    pop_stack();    if( l < 0 )    {    io_rewind( io, bytes );    return -1;    } -  if( bytes > (unsigned)l ) +  if( bytes > l )    io_rewind( io, bytes-l );    }    return l;    }    return -1;    }       static void io_actually_trigger_output( Buffer *io )    ATTRIBUTE((noclone,noinline));   
pike.git/src/modules/_Stdio/buffer.cmod:1309:    *! Errors can occur if one of the elements in @[integers] is not    *! actually an integer, if sizeof(integers)*len is bigger than can    *! be represented in a size_t, or if the buffer cannot grow due to    *! an out of memory condition.    */    PIKEFUN Buffer add_ints( array(int) a, int bpi )    {    int i,l = a->size;    struct svalue *it = a->item;    unsigned char *ptr; -  ptrdiff_t n; +  ptrdiff_t n=0;    ONERROR e;    Buffer *io = THIS;       io_unwrite_on_error(io, &e);       if( bpi < 0 )    Pike_error("Illegal int width\n");    - #if SIZEOF_SIZE_T == 4 + #if SIZEOF_LONG == 4    if( DO_INT32_MUL_OVERFLOW( l, bpi, &n ) )   #else    if( DO_INT64_MUL_OVERFLOW( l, bpi, &n ) )   #endif    Pike_error("Result size exceeds ptrdiff_t size\n");       io_add_space( io, n, 0 );    switch( bpi )    {    case 1:
pike.git/src/modules/_Stdio/buffer.cmod:2066:    if( LIKELY(io_avail( io, 3 )) )    push_int( io_read_number_uc(io,3) );    else    push_int(-1);    }       /*! @decl int(32bit) read_int32()    */    PIKEFUN int(0..4294967295) read_int32( )    { - #if SIZEOF_INT_TYPE > 4 +     Buffer *io = THIS;    if( LIKELY(io_avail( io, 4 )) ) -  +  {    push_int( io_read_number_uc(io,4) ); -  + #if SIZEOF_INT_TYPE < 5 +  if( UNLIKELY(Pike_sp[-1].u.integer < 0) ) +  { +  io_rewind( io, 4 ); +  pop_stack(); +  push_object( io_read_bignum(io, 4) ); +  } + #endif +  }    else    push_int(-1); - #else -  push_int( io_read_number( 4 ) ); - #endif +     }       /*! @decl int read_int( int n )    *!    *! Read a network byte order unsigned number of size n*8 bits, then    *! return it.    *!    *! Will return -1 if there is not enough buffer space available    *! unless error mode is set to throw errors.    */