Merge pull request #2326 from cgwalters/writing-api-prep

core: Drop unused error handling from object stream helper
This commit is contained in:
Luca Bruno 2021-04-08 08:12:59 +00:00 committed by GitHub
commit 078f022cfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 23 deletions

View File

@ -412,18 +412,12 @@ variant_to_lenprefixed_buffer (GVariant *variant)
* header_and_input_to_stream: * header_and_input_to_stream:
* @file_header: A file header * @file_header: A file header
* @input: File raw content stream * @input: File raw content stream
* @out_input: (out): Serialized object stream
* @cancellable: Cancellable
* @error: Error
* *
* Combines @file_header and @input into a single stream. * Combines @file_header and @input into a single stream.
*/ */
static gboolean static GInputStream *
header_and_input_to_stream (GBytes *file_header, header_and_input_to_stream (GBytes *file_header,
GInputStream *input, GInputStream *input)
GInputStream **out_input,
GCancellable *cancellable,
GError **error)
{ {
/* Our result stream chain */ /* Our result stream chain */
g_autoptr(GPtrArray) streams = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref); g_autoptr(GPtrArray) streams = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
@ -438,10 +432,7 @@ header_and_input_to_stream (GBytes *file_header,
g_ptr_array_add (streams, g_object_ref (input)); g_ptr_array_add (streams, g_object_ref (input));
/* Return the result stream */ /* Return the result stream */
g_autoptr(GInputStream) ret_input = (GInputStream*)ostree_chain_input_stream_new (streams); return (GInputStream*)ostree_chain_input_stream_new (streams);
ot_transfer_out_value (out_input, &ret_input);
return TRUE;
} }
/* Convert file metadata + file content into an archive-format stream. */ /* Convert file metadata + file content into an archive-format stream. */
@ -462,11 +453,8 @@ _ostree_raw_file_to_archive_stream (GInputStream *input,
zlib_input = g_converter_input_stream_new (input, zlib_compressor); zlib_input = g_converter_input_stream_new (input, zlib_compressor);
} }
g_autoptr(GBytes) file_header = _ostree_zlib_file_header_new (file_info, xattrs); g_autoptr(GBytes) file_header = _ostree_zlib_file_header_new (file_info, xattrs);
return header_and_input_to_stream (file_header, *out_input = header_and_input_to_stream (file_header, zlib_input);
zlib_input, return TRUE;
out_input,
cancellable,
error);
} }
/** /**
@ -560,12 +548,7 @@ ostree_raw_file_to_content_stream (GInputStream *input,
GError **error) GError **error)
{ {
g_autoptr(GBytes) file_header = _ostree_file_header_new (file_info, xattrs); g_autoptr(GBytes) file_header = _ostree_file_header_new (file_info, xattrs);
if (!header_and_input_to_stream (file_header, *out_input = header_and_input_to_stream (file_header, input);
input,
out_input,
cancellable,
error))
return FALSE;
if (out_length) if (out_length)
*out_length = g_bytes_get_size (file_header) + g_file_info_get_size (file_info); *out_length = g_bytes_get_size (file_header) + g_file_info_get_size (file_info);
return TRUE; return TRUE;