Coverage Report

Created: 2025-07-01 07:09

/work/fu-elantp-struct.c
Line
Count
Source (jump to first uncovered line)
1
/* auto-generated, do not modify */
2
#include "config.h"
3
4
#include "fu-elantp-struct.h"
5
#include "fu-byte-array.h"
6
#include "fu-mem-private.h"
7
#include "fu-string.h"
8
9
#ifdef G_LOG_DOMAIN
10
  #undef G_LOG_DOMAIN
11
#endif
12
0
#define G_LOG_DOMAIN "FuStruct"
13
/* getters */
14
15
/* setters */
16
static gboolean
17
fu_struct_elantp_firmware_hdr_validate_internal(FuStructElantpFirmwareHdr *st, GError **error)
18
6.68M
{
19
6.68M
    g_return_val_if_fail(st != NULL, FALSE);
20
6.68M
    if (memcmp(st->data + 0, "\xAA\x55\xCC\x33\xFF\xFF", 6) != 0) {
21
6.68M
        g_set_error_literal(error,
22
6.68M
                            FWUPD_ERROR,
23
6.68M
                            FWUPD_ERROR_INVALID_DATA,
24
6.68M
                            "constant FuStructElantpFirmwareHdr.magic was not valid");
25
6.68M
        return FALSE;
26
6.68M
    }
27
186
    return TRUE;
28
6.68M
}
29
/**
30
 * fu_struct_elantp_firmware_hdr_validate_stream: (skip):
31
 **/
32
gboolean
33
fu_struct_elantp_firmware_hdr_validate_stream(GInputStream *stream, gsize offset, GError **error)
34
6.68M
{
35
6.68M
    g_autoptr(GByteArray) st = NULL;
36
6.68M
    g_return_val_if_fail(G_IS_INPUT_STREAM(stream), FALSE);
37
6.68M
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
38
6.68M
    st = fu_input_stream_read_byte_array(stream, offset, 6, NULL, error);
39
6.68M
    if (st == NULL) {
40
0
        g_prefix_error(error, "FuStructElantpFirmwareHdr failed read of 0x%x: ", (guint) 6);
41
0
        return FALSE;
42
0
    }
43
6.68M
    if (st->len != 6) {
44
0
        g_set_error(error,
45
0
                    FWUPD_ERROR,
46
0
                    FWUPD_ERROR_INVALID_DATA,
47
0
                    "FuStructElantpFirmwareHdr requested 0x%x and got 0x%x",
48
0
                    (guint) 6,
49
0
                    (guint) st->len);
50
0
        return FALSE;
51
0
    }
52
6.68M
    return fu_struct_elantp_firmware_hdr_validate_internal(st, error);
53
6.68M
}
54
/* getters */
55
56
/* setters */
57
static gboolean
58
fu_struct_elantp_haptic_firmware_hdr_validate_internal(FuStructElantpHapticFirmwareHdr *st, GError **error)
59
0
{
60
0
    g_return_val_if_fail(st != NULL, FALSE);
61
0
    if (memcmp(st->data + 0, "\xFF\x40\xA2\x5B", 4) != 0) {
62
0
        g_set_error_literal(error,
63
0
                            FWUPD_ERROR,
64
0
                            FWUPD_ERROR_INVALID_DATA,
65
0
                            "constant FuStructElantpHapticFirmwareHdr.magic was not valid");
66
0
        return FALSE;
67
0
    }
68
0
    return TRUE;
69
0
}
70
/**
71
 * fu_struct_elantp_haptic_firmware_hdr_validate_stream: (skip):
72
 **/
73
gboolean
74
fu_struct_elantp_haptic_firmware_hdr_validate_stream(GInputStream *stream, gsize offset, GError **error)
75
0
{
76
0
    g_autoptr(GByteArray) st = NULL;
77
0
    g_return_val_if_fail(G_IS_INPUT_STREAM(stream), FALSE);
78
0
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
79
0
    st = fu_input_stream_read_byte_array(stream, offset, 4, NULL, error);
80
0
    if (st == NULL) {
81
0
        g_prefix_error(error, "FuStructElantpHapticFirmwareHdr failed read of 0x%x: ", (guint) 4);
82
0
        return FALSE;
83
0
    }
84
0
    if (st->len != 4) {
85
0
        g_set_error(error,
86
0
                    FWUPD_ERROR,
87
0
                    FWUPD_ERROR_INVALID_DATA,
88
0
                    "FuStructElantpHapticFirmwareHdr requested 0x%x and got 0x%x",
89
0
                    (guint) 4,
90
0
                    (guint) st->len);
91
0
        return FALSE;
92
0
    }
93
0
    return fu_struct_elantp_haptic_firmware_hdr_validate_internal(st, error);
94
0
}