/src/fwupd/libfwupdplugin/fu-memory-input-stream.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2026 Red Hat |
3 | | * |
4 | | * SPDX-License-Identifier: LGPL-2.1-or-later |
5 | | */ |
6 | | |
7 | 0 | #define G_LOG_DOMAIN "FuMemoryInputStream" |
8 | | |
9 | | #include "config.h" |
10 | | |
11 | | #include "fu-memory-input-stream.h" |
12 | | |
13 | | /** |
14 | | * fu_memory_input_stream_new: |
15 | | * |
16 | | * Creates a new empty memory-backed input stream. |
17 | | * |
18 | | * Returns: (transfer full): a #FuInputStream |
19 | | * |
20 | | * Since: 2.1.7 |
21 | | **/ |
22 | | FuInputStream * |
23 | | fu_memory_input_stream_new(void) |
24 | 0 | { |
25 | 0 | return g_memory_input_stream_new(); /* nocheck:blocked */ |
26 | 0 | } |
27 | | |
28 | | /** |
29 | | * fu_memory_input_stream_new_from_bytes: |
30 | | * @bytes: a #GBytes |
31 | | * |
32 | | * Creates a new memory-backed input stream from @bytes. |
33 | | * |
34 | | * Returns: (transfer full): a #FuInputStream |
35 | | * |
36 | | * Since: 2.1.7 |
37 | | **/ |
38 | | FuInputStream * |
39 | | fu_memory_input_stream_new_from_bytes(GBytes *bytes) |
40 | 796k | { |
41 | 796k | g_return_val_if_fail(bytes != NULL, NULL); |
42 | 796k | return g_memory_input_stream_new_from_bytes(bytes); /* nocheck:blocked */ |
43 | 796k | } |
44 | | |
45 | | /** |
46 | | * fu_memory_input_stream_new_from_data: |
47 | | * @data: (array length=len) (element-type guint8): input data |
48 | | * @len: length of the data, or -1 if @data is a nul-terminated string |
49 | | * @destroy: (nullable): function that is called to free @data, or %NULL |
50 | | * |
51 | | * Creates a new memory-backed input stream from @data. |
52 | | * |
53 | | * Returns: (transfer full): a #FuInputStream |
54 | | * |
55 | | * Since: 2.1.7 |
56 | | **/ |
57 | | FuInputStream * |
58 | | fu_memory_input_stream_new_from_data(const void *data, gssize len, GDestroyNotify destroy) |
59 | 4 | { |
60 | 4 | g_return_val_if_fail(data != NULL, NULL); |
61 | 4 | return g_memory_input_stream_new_from_data(data, len, destroy); /* nocheck:blocked */ |
62 | 4 | } |