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

version» Context lines:

pike.git/src/modules/_Stdio/buffer.cmod:1190:    if( tmp->str[0]&0x80 )    o_xor();    free_string( tmp );    }       PIKEFUN int(0..) _size_object( )    {    RETURN THIS->malloced ? THIS->allocated : THIS->stash.len;    }    -  /*! @decl Buffer add_padding( int nbytes, int(0..255)|void byte ) +  /*! @decl Buffer add_padding( int(0..) nbytes, int(0..255)|void byte )    *!    *! Add @[nbytes] bytes of padding, if @[byte] is not specified the    *! area will be filled with 0's, otherwise the specified byte will    *! be repeated.    */ -  PIKEFUN Buffer add_padding( int nbytes, int|void _byte ) +  PIKEFUN Buffer add_padding( int(0..) nbytes, int|void _byte )    {    Buffer *io = THIS;    int byte = 0;    if( _byte ) byte = _byte->u.integer; -  +  +  if( nbytes < 0 ) +  Pike_error("Cannot add negative padding.\n"); +     memset( io_add_space( io, nbytes,0), byte, nbytes );    io->len += nbytes;    Pike_sp -= args;    ref_push_object( io->this );    }       /*! @decl Buffer add( AddArgument ... data )    *! @code    *! private typedef @[System.Memory]|@[Stdio.Buffer]|@[String.Buffer] BufferObject;    *! private typedef BufferObject|string(8bit)|int(8bit)|array(AddArgument) AddArgument;