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

version» Context lines:

pike.git/src/modules/_Stdio/buffer.cmod:50:   /* Remap to not clash with String.Buffer. */   #define PROG_BUFFER_ID PROG_STDIO_BUFFER_ID   #define tObjImpl_BUFFER tObjImpl_STDIO_BUFFER   #define tObjIs_BUFFER tObjIs_STDIO_BUFFER      /*! @class Buffer    *!    *! A buffer to use as input or buffering when doing I/O. It is    *! similar to @[String.Buffer], but can only contain 8bit data and is    *! designed for protocol parsing. It is optimized for reading from -  *! the beginning and adding to the end, and will try to minimize the +  *! the beginning and adding to the end, and will try to minimise the    *! amount of data copying that is done.    *!    *! The class maintains two separate offsets, one for reading and one    *! for writing. The functions that add data all do so at the write    *! offset (the end of the buffer), and reading is done from the read    *! offset (the start of the buffer).    *!    *! The class can also be used to directly read from and write to    *! filedescriptors if so desired. This eliminates at least one memory    *! copy.
pike.git/src/modules/_Stdio/buffer.cmod:115:    static void io_lock( Buffer *io )    {    io->locked++;    }       static void io_was_locked( )    ATTRIBUTE((noclone,noinline));       static void io_was_locked( )    { -  Pike_error("Can not modify the buffer right now, " +  Pike_error("Cannot modify the buffer right now, "    " there are active subbuffers.\n");    }       static void io_ensure_unlocked(Buffer *io)    {    if( io->locked )    io_was_locked( );    }       PMOD_EXPORT void io_trim( Buffer *io )
pike.git/src/modules/_Stdio/buffer.cmod:949:    else    {    /* Some other object. Just call read(). */    while( nbytes )    {    push_int( MINIMUM(READ_CHUNKSIZE, nbytes) );    safe_apply( f, "read", 1 );    if( TYPEOF(Pike_sp[-1]) != PIKE_T_STRING || Pike_sp[-1].u.string->len == 0 )    break;    if( Pike_sp[-1].u.string->size_shift ) -  Pike_error("Can not handle non-8bit data.\n"); +  Pike_error("Cannot handle non-8bit data.\n");    io_append( io, Pike_sp[-1].u.string->str, Pike_sp[-1].u.string->len );    nbytes -= Pike_sp[-1].u.string->len;    bread += Pike_sp[-1].u.string->len;    pop_stack();    }    }       if (!bread) RETURN -1;       io_trigger_output( io );
pike.git/src/modules/_Stdio/buffer.cmod:1382:    int size_size, void|int offset )    {    Buffer *io = THIS;    size_t len = io_svalue_len(io, str);       if( offset )    len += offset->u.integer;       if( size_size < (int)sizeof(size_t) &&    len > (((size_t)1)<<(8*size_size))-1 ) -  Pike_error("Too long string, need larger size field.\n"); +  Pike_error("String too long, need larger size field.\n");       io_add_int( io, len, size_size );    io_append_svalue( io, str );    pop_n_elems(args);    ref_push_object(io->this);    }       /*! @decl Buffer add_int( int i, int(0..) width )    *!    *! Adds a generic integer to the buffer as an (width*8)bit
pike.git/src/modules/_Stdio/buffer.cmod:2668:    */    PIKEFUN string _encode()    {    push_string(io_read_string(THIS, io_len(THIS)));    }       PIKEFUN void _decode(string(8bit) x)    {    Buffer *this = THIS;    if( this->buffer ) -  Pike_error("Can not initialize twice.\n"); +  Pike_error("Cannot initialise twice.\n");    if( x->size_shift ) -  Pike_error("Can not handle non-8bit data.\n"); +  Pike_error("Cannot handle non-8bit data.\n");    this->buffer = (unsigned char*)x->str;    this->len = x->len;    this->malloced = 0;    this->str = x;    add_ref(x);    }       /*! @decl void read_only()    *!    *! Make the buffer permanently read only.
pike.git/src/modules/_Stdio/buffer.cmod:2793:    *! try to modify the buffer using one of the @[add] functions (or    *! @[sprintf] and similar) the old contents @b{will@} be copied.    *!    *! You can use @[read_only()] to avoid accidents.    */    PIKEFUN void create( int|void|string(8bit)|object|array x )    flags ID_PROTECTED;    {    Buffer *this = THIS;    if( this->buffer ) -  Pike_error("Can not initialize twice.\n"); +  Pike_error("Cannot initialise twice.\n");    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 )