pike.git / lib / modules / ADT.pmod / module.pmod

version» Context lines:

pike.git/lib/modules/ADT.pmod/module.pmod:111:    //! Appends an array of unsigned integers of width @[item_size]    //! to the buffer, preceded with an unsigned integer @[len] declaring    //! the size of the array in bytes.    this_program put_var_uint_array(array(int) data, int(0..) item_size, int(0..) len)    {    put_uint(sizeof(data)*item_size, len);    put_fix_uint_array(data, item_size);    return this;    }    +  this_program put_var_string_array(array(string(8bit)) data, int(0..) item_size, int(0..) len) +  { +  string(8bit) temp = buffer; +  buffer = ""; +  foreach(data, string(8bit) s) +  put_var_string(s, item_size); +  string(8bit) arr = buffer; +  buffer = temp; +  put_var_string(arr, len); +  return this; +  } +     //! Reads an unsigned integer from the buffer.    int(0..) get_uint(int len)    {    int(0..) i;    if ( (sizeof(buffer) - index) < len)    throw(structError("No data.\n"));    sscanf(buffer, "%*" + (string) index +"s%" + (string) len + "c", i);    index += len;    return i;    }