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

version» Context lines:

pike.git/src/modules/_Stdio/buffer.cmod:1830:    *! If there is not enough data available this returns 0.    *!    *! This is basically equivalent to (string)buffer, but it also    *! removes the data from the buffer.    *!    *! @seealso    *! @[try_read()]    */    PIKEFUN string(0..255) read()    { -  struct pike_string * s = io_read_string(THIS, io_len(THIS)); -  if( s ) -  push_string( s ); -  else -  push_undefined(); /* FIXME: Is this ever reached? */ +  push_string( io_read_string(THIS, io_len(THIS)) );    }       /*! @decl string(8bit) try_read(int len)    *!    *! Attempt to read some data from the buffer.    *!    *! @param len    *! Read at most @[len] bytes from the buffer.    *!    *! @returns
pike.git/src/modules/_Stdio/buffer.cmod:1856:    *! of data, the entire buffer contents are returned.    *! Otherwise the first @[len] bytes are returned.    *!    *! @seealso    *! @[read()]    */    PIKEFUN string(0..255) try_read( int bytes )    {    struct pike_string *s;    Pike_sp--; -  +     if (bytes > io_len(THIS))    bytes = io_len(THIS); -  s = io_read_string(THIS, bytes ); -  if( s ) -  push_string( s ); -  else -  push_undefined(); /* FIXME: Is this ever reached? */ +  push_string( io_read_string(THIS, bytes ));    }       /*! @decl int(8bit) read_int8()    */    PIKEFUN int(8bit) read_int8( )    {    IOBuffer *io = THIS;    if( LIKELY(io_avail( io, 1 )) )    push_int( io_read_byte_uc(io) );    else