Пример #1
0
NVTable *
nv_table_deserialize(LogMessageSerializationState *state)
{
  SerializeArchive *sa = state->sa;
  NVTableMetaData meta_data;
  NVTable *res = NULL;

  if (!_read_metadata(sa, &meta_data))
    goto error;

  if (!_read_header(sa, &res))
    goto error;

  state->nvtable_flags = meta_data.flags;
  state->nvtable = res;
  if (!_read_struct(sa, res))
    goto error;

  if (!_read_payload(sa, res))
    goto error;

  if (_has_to_swap_bytes(meta_data.flags))
    nv_table_data_swap_bytes(res);


  return res;

error:
  if (res)
    g_free(res);
  return NULL;
}
Пример #2
0
NVTable *
nv_table_deserialize(SerializeArchive *sa)
{
  NVTableMetaData meta_data;
  NVTable *res = NULL;

  if (!_read_metadata(sa, &meta_data))
    {
      goto error;
    }

  if (!_read_header(sa, &res))
    {
      goto error;
    }

  if (!_read_struct(sa, res))
    {
      goto error;
    }

  if (!_read_payload(sa, res))
    {
      goto error;
    }

  if (_has_to_swap_bytes(meta_data.flags))
    {
      nv_table_data_swap_bytes(res);
    }

  return res;

error:
  if (res)
    g_free(res);
  return NULL;
}