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

version» Context lines:

pike.git/src/modules/_Stdio/buffer.cmod:927:    *! filedescriptor unless it's set to be non-blocking.    */    PIKEFUN int(-1..) input_from( object f, int|void _nbytes, int|void _once )    {    Buffer *io = THIS;    size_t sz = io_len( io );    size_t bread = 0, nbytes = (size_t)-1;    struct my_file *fd;    int once = 0;    -  if( _nbytes && (SUBTYPEOF(*_nbytes) == NUMBER_NUMBER) ) { +  if( _nbytes ) {    nbytes = _nbytes->u.integer;    if (!nbytes) RETURN 0;    }       if( _once )    once = _once->u.integer;          if( (fd = get_storage( f, file_program )) )    {
pike.git/src/modules/_Stdio/buffer.cmod:1053:    Buffer *io = THIS;    ptrdiff_t written = 0;    ptrdiff_t sz = io_len( io );    int write_fun_num = -1;       if( !sz )    {    io_range_error(io, sz);    sz = io_len(io);    } -  if( nbytes && (SUBTYPEOF(*nbytes) == NUMBER_NUMBER) ) +  if( nbytes )    sz = MINIMUM(nbytes->u.integer, sz);       if( TYPEOF(*f) == PIKE_T_OBJECT ) {    struct program *p = f->u.object->prog;    if (LIKELY(p)) {    struct inherit *inh = p->inherits + SUBTYPEOF(*f);    p = inh->prog;    if ((write_fun_num = find_identifier("write", p)) == -1) {    Pike_error("Function \"write\" not available in object.\n");    }
pike.git/src/modules/_Stdio/buffer.cmod:2474:    *! @[sprintf] and similar) the old contents @b{will@} be copied.    *!    *! You can use @[read_only()] to avoid accidents.    */    PIKEFUN void create( int|void|string|object|array x )    flags ID_PROTECTED;    {    Buffer *this = THIS;    if( this->buffer )    Pike_error("Can not initialize twice.\n"); -  if( args == 0 ) +  if( !x )    {    this->buffer = xalloc(256-32);    this->allocated = 256-32;    this->malloced = 1;    }    else if( TYPEOF(*x) == PIKE_T_INT )    {    INT_TYPE len = x->u.integer;    if( len <= 0 )    this->buffer = xalloc(1);