/* auto-generated, do not modify */
#include "config.h"

#include "fu-smbios-struct.h"
#include "fu-byte-array.h"
#include "fu-mem-private.h"
#include "fu-string.h"

#ifdef G_LOG_DOMAIN
  #undef G_LOG_DOMAIN
#endif
#define G_LOG_DOMAIN "FuStruct"
/* getters */
/**
 * fu_struct_smbios_ep32_get_anchor_str: (skip):
 **/
gchar *
fu_struct_smbios_ep32_get_anchor_str(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    return fu_memstrsafe(st->data, st->len, 0, 4, NULL);
}
/**
 * fu_struct_smbios_ep32_get_entry_point_csum: (skip):
 **/
guint8
fu_struct_smbios_ep32_get_entry_point_csum(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[4];
}
/**
 * fu_struct_smbios_ep32_get_entry_point_len: (skip):
 **/
guint8
fu_struct_smbios_ep32_get_entry_point_len(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[5];
}
/**
 * fu_struct_smbios_ep32_get_smbios_major_ver: (skip):
 **/
guint8
fu_struct_smbios_ep32_get_smbios_major_ver(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[6];
}
/**
 * fu_struct_smbios_ep32_get_smbios_minor_ver: (skip):
 **/
guint8
fu_struct_smbios_ep32_get_smbios_minor_ver(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[7];
}
/**
 * fu_struct_smbios_ep32_get_max_structure_sz: (skip):
 **/
guint16
fu_struct_smbios_ep32_get_max_structure_sz(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 8, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_smbios_ep32_get_entry_point_rev: (skip):
 **/
guint8
fu_struct_smbios_ep32_get_entry_point_rev(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[10];
}
/**
 * fu_struct_smbios_ep32_get_intermediate_anchor_str: (skip):
 **/
gchar *
fu_struct_smbios_ep32_get_intermediate_anchor_str(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    return fu_memstrsafe(st->data, st->len, 16, 5, NULL);
}
/**
 * fu_struct_smbios_ep32_get_intermediate_csum: (skip):
 **/
guint8
fu_struct_smbios_ep32_get_intermediate_csum(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[21];
}
/**
 * fu_struct_smbios_ep32_get_structure_table_len: (skip):
 **/
guint16
fu_struct_smbios_ep32_get_structure_table_len(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 22, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_smbios_ep32_get_structure_table_addr: (skip):
 **/
guint32
fu_struct_smbios_ep32_get_structure_table_addr(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->data + 24, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_smbios_ep32_get_number_smbios_structs: (skip):
 **/
guint16
fu_struct_smbios_ep32_get_number_smbios_structs(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 28, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_smbios_ep32_get_smbios_bcd_rev: (skip):
 **/
guint8
fu_struct_smbios_ep32_get_smbios_bcd_rev(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[30];
}

/* setters */
/**
 * fu_struct_smbios_ep32_set_anchor_str: (skip):
 **/
gboolean
fu_struct_smbios_ep32_set_anchor_str(GByteArray *st, const gchar *value, GError **error)
{
    gsize len;
    g_return_val_if_fail(st != NULL, FALSE);
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
    if (value == NULL) {
        memset(st->data + 0, 0x0, 4);
        return TRUE;
    }
    len = strlen(value);
    if (len > 4) {
        g_set_error(error,
                    G_IO_ERROR,
                    G_IO_ERROR_INVALID_DATA,
                    "string '%s' (0x%x bytes) does not fit in SmbiosEp32.anchor_str (0x%x bytes)",
                    value, (guint) len, (guint) 4);
        return FALSE;
    }
    return fu_memcpy_safe(st->data, st->len, 0, (const guint8 *)value, len, 0x0, len, error);
}
/**
 * fu_struct_smbios_ep32_set_entry_point_csum: (skip):
 **/
void
fu_struct_smbios_ep32_set_entry_point_csum(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[4] = value;
}
/**
 * fu_struct_smbios_ep32_set_entry_point_len: (skip):
 **/
void
fu_struct_smbios_ep32_set_entry_point_len(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[5] = value;
}
/**
 * fu_struct_smbios_ep32_set_smbios_major_ver: (skip):
 **/
void
fu_struct_smbios_ep32_set_smbios_major_ver(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[6] = value;
}
/**
 * fu_struct_smbios_ep32_set_smbios_minor_ver: (skip):
 **/
void
fu_struct_smbios_ep32_set_smbios_minor_ver(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[7] = value;
}
/**
 * fu_struct_smbios_ep32_set_max_structure_sz: (skip):
 **/
void
fu_struct_smbios_ep32_set_max_structure_sz(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 8, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_smbios_ep32_set_entry_point_rev: (skip):
 **/
void
fu_struct_smbios_ep32_set_entry_point_rev(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[10] = value;
}
/**
 * fu_struct_smbios_ep32_set_intermediate_anchor_str: (skip):
 **/
gboolean
fu_struct_smbios_ep32_set_intermediate_anchor_str(GByteArray *st, const gchar *value, GError **error)
{
    gsize len;
    g_return_val_if_fail(st != NULL, FALSE);
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
    if (value == NULL) {
        memset(st->data + 16, 0x0, 5);
        return TRUE;
    }
    len = strlen(value);
    if (len > 5) {
        g_set_error(error,
                    G_IO_ERROR,
                    G_IO_ERROR_INVALID_DATA,
                    "string '%s' (0x%x bytes) does not fit in SmbiosEp32.intermediate_anchor_str (0x%x bytes)",
                    value, (guint) len, (guint) 5);
        return FALSE;
    }
    return fu_memcpy_safe(st->data, st->len, 16, (const guint8 *)value, len, 0x0, len, error);
}
/**
 * fu_struct_smbios_ep32_set_intermediate_csum: (skip):
 **/
void
fu_struct_smbios_ep32_set_intermediate_csum(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[21] = value;
}
/**
 * fu_struct_smbios_ep32_set_structure_table_len: (skip):
 **/
void
fu_struct_smbios_ep32_set_structure_table_len(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 22, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_smbios_ep32_set_structure_table_addr: (skip):
 **/
void
fu_struct_smbios_ep32_set_structure_table_addr(GByteArray *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->data + 24, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_smbios_ep32_set_number_smbios_structs: (skip):
 **/
void
fu_struct_smbios_ep32_set_number_smbios_structs(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 28, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_smbios_ep32_set_smbios_bcd_rev: (skip):
 **/
void
fu_struct_smbios_ep32_set_smbios_bcd_rev(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[30] = value;
}
/**
 * fu_struct_smbios_ep32_new: (skip):
 **/
GByteArray *
fu_struct_smbios_ep32_new(void)
{
    GByteArray *st = g_byte_array_sized_new(31);
    fu_byte_array_set_size(st, 31, 0x0);
    return st;
}
/**
 * fu_struct_smbios_ep32_to_string: (skip):
 **/
static gchar *
fu_struct_smbios_ep32_to_string(const GByteArray *st)
{
    g_autoptr(GString) str = g_string_new("SmbiosEp32:\n");
    g_return_val_if_fail(st != NULL, NULL);
    {
        g_autofree gchar *tmp = fu_struct_smbios_ep32_get_anchor_str(st);
        if (tmp != NULL)
            g_string_append_printf(str, "  anchor_str: %s\n", tmp);
    }
    g_string_append_printf(str, "  entry_point_csum: 0x%x\n",
                           (guint) fu_struct_smbios_ep32_get_entry_point_csum(st));
    g_string_append_printf(str, "  entry_point_len: 0x%x\n",
                           (guint) fu_struct_smbios_ep32_get_entry_point_len(st));
    g_string_append_printf(str, "  smbios_major_ver: 0x%x\n",
                           (guint) fu_struct_smbios_ep32_get_smbios_major_ver(st));
    g_string_append_printf(str, "  smbios_minor_ver: 0x%x\n",
                           (guint) fu_struct_smbios_ep32_get_smbios_minor_ver(st));
    g_string_append_printf(str, "  max_structure_sz: 0x%x\n",
                           (guint) fu_struct_smbios_ep32_get_max_structure_sz(st));
    g_string_append_printf(str, "  entry_point_rev: 0x%x\n",
                           (guint) fu_struct_smbios_ep32_get_entry_point_rev(st));
    {
        g_autofree gchar *tmp = fu_struct_smbios_ep32_get_intermediate_anchor_str(st);
        if (tmp != NULL)
            g_string_append_printf(str, "  intermediate_anchor_str: %s\n", tmp);
    }
    g_string_append_printf(str, "  intermediate_csum: 0x%x\n",
                           (guint) fu_struct_smbios_ep32_get_intermediate_csum(st));
    g_string_append_printf(str, "  structure_table_len: 0x%x\n",
                           (guint) fu_struct_smbios_ep32_get_structure_table_len(st));
    g_string_append_printf(str, "  structure_table_addr: 0x%x\n",
                           (guint) fu_struct_smbios_ep32_get_structure_table_addr(st));
    g_string_append_printf(str, "  number_smbios_structs: 0x%x\n",
                           (guint) fu_struct_smbios_ep32_get_number_smbios_structs(st));
    g_string_append_printf(str, "  smbios_bcd_rev: 0x%x\n",
                           (guint) fu_struct_smbios_ep32_get_smbios_bcd_rev(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
/**
 * fu_struct_smbios_ep32_parse: (skip):
 **/
GByteArray *
fu_struct_smbios_ep32_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(GByteArray) st = g_byte_array_new();
    g_autofree gchar *str = NULL;
    g_return_val_if_fail(buf != NULL, NULL);
    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
    if (!fu_memchk_read(bufsz, offset, 31, error)) {
        g_prefix_error(error, "invalid struct SmbiosEp32: ");
        return NULL;
    }
    g_byte_array_append(st, buf + offset, 31);
    str = fu_struct_smbios_ep32_to_string(st);
    g_debug("%s", str);
    return g_steal_pointer(&st);
}
/* getters */
/**
 * fu_struct_smbios_ep64_get_anchor_str: (skip):
 **/
gchar *
fu_struct_smbios_ep64_get_anchor_str(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    return fu_memstrsafe(st->data, st->len, 0, 5, NULL);
}
/**
 * fu_struct_smbios_ep64_get_entry_point_csum: (skip):
 **/
guint8
fu_struct_smbios_ep64_get_entry_point_csum(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[5];
}
/**
 * fu_struct_smbios_ep64_get_entry_point_len: (skip):
 **/
guint8
fu_struct_smbios_ep64_get_entry_point_len(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[6];
}
/**
 * fu_struct_smbios_ep64_get_smbios_major_ver: (skip):
 **/
guint8
fu_struct_smbios_ep64_get_smbios_major_ver(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[7];
}
/**
 * fu_struct_smbios_ep64_get_smbios_minor_ver: (skip):
 **/
guint8
fu_struct_smbios_ep64_get_smbios_minor_ver(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[8];
}
/**
 * fu_struct_smbios_ep64_get_smbios_docrev: (skip):
 **/
guint8
fu_struct_smbios_ep64_get_smbios_docrev(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[9];
}
/**
 * fu_struct_smbios_ep64_get_entry_point_rev: (skip):
 **/
guint8
fu_struct_smbios_ep64_get_entry_point_rev(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[10];
}
/**
 * fu_struct_smbios_ep64_get_reserved0: (skip):
 **/
guint8
fu_struct_smbios_ep64_get_reserved0(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[11];
}
/**
 * fu_struct_smbios_ep64_get_structure_table_len: (skip):
 **/
guint32
fu_struct_smbios_ep64_get_structure_table_len(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->data + 12, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_smbios_ep64_get_structure_table_addr: (skip):
 **/
guint64
fu_struct_smbios_ep64_get_structure_table_addr(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint64(st->data + 16, G_LITTLE_ENDIAN);
}

/* setters */
/**
 * fu_struct_smbios_ep64_set_anchor_str: (skip):
 **/
gboolean
fu_struct_smbios_ep64_set_anchor_str(GByteArray *st, const gchar *value, GError **error)
{
    gsize len;
    g_return_val_if_fail(st != NULL, FALSE);
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
    if (value == NULL) {
        memset(st->data + 0, 0x0, 5);
        return TRUE;
    }
    len = strlen(value);
    if (len > 5) {
        g_set_error(error,
                    G_IO_ERROR,
                    G_IO_ERROR_INVALID_DATA,
                    "string '%s' (0x%x bytes) does not fit in SmbiosEp64.anchor_str (0x%x bytes)",
                    value, (guint) len, (guint) 5);
        return FALSE;
    }
    return fu_memcpy_safe(st->data, st->len, 0, (const guint8 *)value, len, 0x0, len, error);
}
/**
 * fu_struct_smbios_ep64_set_entry_point_csum: (skip):
 **/
void
fu_struct_smbios_ep64_set_entry_point_csum(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[5] = value;
}
/**
 * fu_struct_smbios_ep64_set_entry_point_len: (skip):
 **/
void
fu_struct_smbios_ep64_set_entry_point_len(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[6] = value;
}
/**
 * fu_struct_smbios_ep64_set_smbios_major_ver: (skip):
 **/
void
fu_struct_smbios_ep64_set_smbios_major_ver(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[7] = value;
}
/**
 * fu_struct_smbios_ep64_set_smbios_minor_ver: (skip):
 **/
void
fu_struct_smbios_ep64_set_smbios_minor_ver(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[8] = value;
}
/**
 * fu_struct_smbios_ep64_set_smbios_docrev: (skip):
 **/
void
fu_struct_smbios_ep64_set_smbios_docrev(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[9] = value;
}
/**
 * fu_struct_smbios_ep64_set_entry_point_rev: (skip):
 **/
void
fu_struct_smbios_ep64_set_entry_point_rev(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[10] = value;
}
/**
 * fu_struct_smbios_ep64_set_reserved0: (skip):
 **/
void
fu_struct_smbios_ep64_set_reserved0(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[11] = value;
}
/**
 * fu_struct_smbios_ep64_set_structure_table_len: (skip):
 **/
void
fu_struct_smbios_ep64_set_structure_table_len(GByteArray *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->data + 12, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_smbios_ep64_set_structure_table_addr: (skip):
 **/
void
fu_struct_smbios_ep64_set_structure_table_addr(GByteArray *st, guint64 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint64(st->data + 16, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_smbios_ep64_new: (skip):
 **/
GByteArray *
fu_struct_smbios_ep64_new(void)
{
    GByteArray *st = g_byte_array_sized_new(24);
    fu_byte_array_set_size(st, 24, 0x0);
    return st;
}
/**
 * fu_struct_smbios_ep64_to_string: (skip):
 **/
static gchar *
fu_struct_smbios_ep64_to_string(const GByteArray *st)
{
    g_autoptr(GString) str = g_string_new("SmbiosEp64:\n");
    g_return_val_if_fail(st != NULL, NULL);
    {
        g_autofree gchar *tmp = fu_struct_smbios_ep64_get_anchor_str(st);
        if (tmp != NULL)
            g_string_append_printf(str, "  anchor_str: %s\n", tmp);
    }
    g_string_append_printf(str, "  entry_point_csum: 0x%x\n",
                           (guint) fu_struct_smbios_ep64_get_entry_point_csum(st));
    g_string_append_printf(str, "  entry_point_len: 0x%x\n",
                           (guint) fu_struct_smbios_ep64_get_entry_point_len(st));
    g_string_append_printf(str, "  smbios_major_ver: 0x%x\n",
                           (guint) fu_struct_smbios_ep64_get_smbios_major_ver(st));
    g_string_append_printf(str, "  smbios_minor_ver: 0x%x\n",
                           (guint) fu_struct_smbios_ep64_get_smbios_minor_ver(st));
    g_string_append_printf(str, "  smbios_docrev: 0x%x\n",
                           (guint) fu_struct_smbios_ep64_get_smbios_docrev(st));
    g_string_append_printf(str, "  entry_point_rev: 0x%x\n",
                           (guint) fu_struct_smbios_ep64_get_entry_point_rev(st));
    g_string_append_printf(str, "  reserved0: 0x%x\n",
                           (guint) fu_struct_smbios_ep64_get_reserved0(st));
    g_string_append_printf(str, "  structure_table_len: 0x%x\n",
                           (guint) fu_struct_smbios_ep64_get_structure_table_len(st));
    g_string_append_printf(str, "  structure_table_addr: 0x%x\n",
                           (guint) fu_struct_smbios_ep64_get_structure_table_addr(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
/**
 * fu_struct_smbios_ep64_parse: (skip):
 **/
GByteArray *
fu_struct_smbios_ep64_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(GByteArray) st = g_byte_array_new();
    g_autofree gchar *str = NULL;
    g_return_val_if_fail(buf != NULL, NULL);
    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
    if (!fu_memchk_read(bufsz, offset, 24, error)) {
        g_prefix_error(error, "invalid struct SmbiosEp64: ");
        return NULL;
    }
    g_byte_array_append(st, buf + offset, 24);
    str = fu_struct_smbios_ep64_to_string(st);
    g_debug("%s", str);
    return g_steal_pointer(&st);
}
/* getters */
/**
 * fu_struct_smbios_structure_get_type: (skip):
 **/
guint8
fu_struct_smbios_structure_get_type(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[0];
}
/**
 * fu_struct_smbios_structure_get_length: (skip):
 **/
guint8
fu_struct_smbios_structure_get_length(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[1];
}
/**
 * fu_struct_smbios_structure_get_handle: (skip):
 **/
guint16
fu_struct_smbios_structure_get_handle(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 2, G_LITTLE_ENDIAN);
}

/* setters */
/**
 * fu_struct_smbios_structure_set_type: (skip):
 **/
void
fu_struct_smbios_structure_set_type(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[0] = value;
}
/**
 * fu_struct_smbios_structure_set_length: (skip):
 **/
void
fu_struct_smbios_structure_set_length(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[1] = value;
}
/**
 * fu_struct_smbios_structure_set_handle: (skip):
 **/
void
fu_struct_smbios_structure_set_handle(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 2, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_smbios_structure_new: (skip):
 **/
GByteArray *
fu_struct_smbios_structure_new(void)
{
    GByteArray *st = g_byte_array_sized_new(4);
    fu_byte_array_set_size(st, 4, 0x0);
    return st;
}
/**
 * fu_struct_smbios_structure_to_string: (skip):
 **/
static gchar *
fu_struct_smbios_structure_to_string(const GByteArray *st)
{
    g_autoptr(GString) str = g_string_new("SmbiosStructure:\n");
    g_return_val_if_fail(st != NULL, NULL);
    g_string_append_printf(str, "  type: 0x%x\n",
                           (guint) fu_struct_smbios_structure_get_type(st));
    g_string_append_printf(str, "  length: 0x%x\n",
                           (guint) fu_struct_smbios_structure_get_length(st));
    g_string_append_printf(str, "  handle: 0x%x\n",
                           (guint) fu_struct_smbios_structure_get_handle(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
/**
 * fu_struct_smbios_structure_parse: (skip):
 **/
GByteArray *
fu_struct_smbios_structure_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(GByteArray) st = g_byte_array_new();
    g_autofree gchar *str = NULL;
    g_return_val_if_fail(buf != NULL, NULL);
    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
    if (!fu_memchk_read(bufsz, offset, 4, error)) {
        g_prefix_error(error, "invalid struct SmbiosStructure: ");
        return NULL;
    }
    g_byte_array_append(st, buf + offset, 4);
    str = fu_struct_smbios_structure_to_string(st);
    g_debug("%s", str);
    return g_steal_pointer(&st);
}
