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 | | |
14 | | /* getters */ |
15 | | |
16 | | /* setters */ |
17 | | static gboolean |
18 | | fu_struct_elantp_firmware_hdr_validate_internal(FuStructElantpFirmwareHdr *st, GError **error) |
19 | 3.44M | { |
20 | 3.44M | g_return_val_if_fail(st != NULL, FALSE); |
21 | 3.44M | if (memcmp(st->data + 0, "\xAA\x55\xCC\x33\xFF\xFF", 6) != 0) { |
22 | 3.44M | g_set_error_literal(error, |
23 | 3.44M | FWUPD_ERROR, |
24 | 3.44M | FWUPD_ERROR_INVALID_DATA, |
25 | 3.44M | "constant FuStructElantpFirmwareHdr.magic was not valid"); |
26 | 3.44M | return FALSE; |
27 | 3.44M | } |
28 | 181 | return TRUE; |
29 | 3.44M | } |
30 | | /** |
31 | | * fu_struct_elantp_firmware_hdr_validate_stream: (skip): |
32 | | **/ |
33 | | gboolean |
34 | | fu_struct_elantp_firmware_hdr_validate_stream(GInputStream *stream, gsize offset, GError **error) |
35 | 3.44M | { |
36 | 3.44M | g_autoptr(GByteArray) st = NULL; |
37 | 3.44M | g_return_val_if_fail(G_IS_INPUT_STREAM(stream), FALSE); |
38 | 3.44M | g_return_val_if_fail(error == NULL || *error == NULL, FALSE); |
39 | 3.44M | st = fu_input_stream_read_byte_array(stream, offset, 6, NULL, error); |
40 | 3.44M | if (st == NULL) { |
41 | 0 | g_prefix_error(error, "FuStructElantpFirmwareHdr failed read of 0x%x: ", (guint) 6); |
42 | 0 | return FALSE; |
43 | 0 | } |
44 | 3.44M | if (st->len != 6) { |
45 | 0 | g_set_error(error, |
46 | 0 | FWUPD_ERROR, |
47 | 0 | FWUPD_ERROR_INVALID_DATA, |
48 | 0 | "FuStructElantpFirmwareHdr requested 0x%x and got 0x%x", |
49 | 0 | (guint) 6, |
50 | 0 | (guint) st->len); |
51 | 0 | return FALSE; |
52 | 0 | } |
53 | 3.44M | return fu_struct_elantp_firmware_hdr_validate_internal(st, error); |
54 | 3.44M | } |
55 | | /* getters */ |
56 | | |
57 | | /* setters */ |
58 | | static gboolean |
59 | | fu_struct_elantp_haptic_firmware_hdr_validate_internal(FuStructElantpHapticFirmwareHdr *st, GError **error) |
60 | 0 | { |
61 | 0 | g_return_val_if_fail(st != NULL, FALSE); |
62 | 0 | if (memcmp(st->data + 0, "\xFF\x40\xA2\x5B", 4) != 0) { |
63 | 0 | g_set_error_literal(error, |
64 | 0 | FWUPD_ERROR, |
65 | 0 | FWUPD_ERROR_INVALID_DATA, |
66 | 0 | "constant FuStructElantpHapticFirmwareHdr.magic was not valid"); |
67 | 0 | return FALSE; |
68 | 0 | } |
69 | 0 | return TRUE; |
70 | 0 | } |
71 | | /** |
72 | | * fu_struct_elantp_haptic_firmware_hdr_validate_stream: (skip): |
73 | | **/ |
74 | | gboolean |
75 | | fu_struct_elantp_haptic_firmware_hdr_validate_stream(GInputStream *stream, gsize offset, GError **error) |
76 | 0 | { |
77 | 0 | g_autoptr(GByteArray) st = NULL; |
78 | 0 | g_return_val_if_fail(G_IS_INPUT_STREAM(stream), FALSE); |
79 | 0 | g_return_val_if_fail(error == NULL || *error == NULL, FALSE); |
80 | 0 | st = fu_input_stream_read_byte_array(stream, offset, 4, NULL, error); |
81 | 0 | if (st == NULL) { |
82 | 0 | g_prefix_error(error, "FuStructElantpHapticFirmwareHdr failed read of 0x%x: ", (guint) 4); |
83 | 0 | return FALSE; |
84 | 0 | } |
85 | 0 | if (st->len != 4) { |
86 | 0 | g_set_error(error, |
87 | 0 | FWUPD_ERROR, |
88 | 0 | FWUPD_ERROR_INVALID_DATA, |
89 | 0 | "FuStructElantpHapticFirmwareHdr requested 0x%x and got 0x%x", |
90 | 0 | (guint) 4, |
91 | 0 | (guint) st->len); |
92 | 0 | return FALSE; |
93 | 0 | } |
94 | 0 | return fu_struct_elantp_haptic_firmware_hdr_validate_internal(st, error); |
95 | 0 | } |