Branch: Tag:

2014-05-08

2014-05-08 16:09:11 by Martin Nilsson <nilsson@opera.com>

Incompatible change for multibyte get/put_var_uint_array ADT.struct calles. The SSL specification, which is was made for, stores the number of bytes in the array size description, while this implementation stored the number of elements. Either one works fine for 1 byte arrays, which this was used for. Changed to use the byte size.

110:       //! 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. +  //! 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), len); +  put_uint(sizeof(data)*item_size, len);    put_fix_uint_array(data, item_size);    return this;    }
174:    //! from the buffer.    array(int) get_var_uint_array(int item_size, int len)    { -  return get_fix_uint_array(item_size, get_uint(len)); +  int size = get_uint(len); +  int elems = size/item_size; +  if( elems*item_size != size ) +  throw(structError("Impossible uint array length value.\n")); +  return get_fix_uint_array(item_size, elems);    }       //! Returns one of there is any more data to read.