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

version» Context lines:

pike.git/src/modules/_Stdio/buffer.cmod:248:       /*    * It is actually not certain that checking this is a good idea.    *    * The reason being that if the current buffer size is very small    * (io_len(io)) and the bytes added is large and there is an    * offset, it makes sense to move now when we do not have to copy    * as much.    *    */ -  if( UNLIKELY(force && io->offset -  || io_len(io) && io->offset > io->allocated / 2) ) +  if( UNLIKELY((force && io->offset) || +  (io_len(io) && io->offset > io->allocated / 2)) )    {    /* more than 50% of the buffer is available before the read pointer,    * and we can discard that data. Move the data to the beginning, making    * room for more data.    */    io_discard_bufstart(io);    }       if( UNLIKELY(io->len + bytes > io->allocated) )    {
pike.git/src/modules/_Stdio/buffer.cmod:643:    }       static INT_TYPE io_read_signed_number_uc( Buffer *io, size_t len )    {    size_t i;    INT_TYPE res = 0;    if( !len ) return 0;    len--;    res = io_read_byte_uc(io);    if( res & 0x80 ) -  res = (-1<<8)|res; +  res |= ~(INT_TYPE)0xff;    for( i=0; i<len; i++ )    {    res <<= 8;    res |= io_read_byte_uc(io);    }    return res;    }       static LONGEST io_read_number( Buffer *io, size_t len )    {
pike.git/src/modules/_Stdio/buffer.cmod:1783:    *!    *! Note that pike string can not be longer than 0x7fffffff bytes (~2Gb).    */    PIKEFUN string(0..255) read_cstring()    {    Buffer *io = THIS;       do    if ( LIKELY(io_len(THIS)) )    { -  const char * start = io_read_pointer(io); -  const char * end = memchr(start, 0, io_len(io)); +  const unsigned char * start = io_read_pointer(io); +  const unsigned char * end = memchr(start, 0, io_len(io));    if ( LIKELY(end) )    {    push_string(io_read_string(io, end - start));    io_read_byte_uc(io); /* consume the terminating \0 byte */    return;    }    }    while ( UNLIKELY(io_range_error(THIS, 0)) );       push_undefined();