lib/core: Use GBytes for file headers
This simplifies a lot of code; the header function was structured
to write to an input stream, but many callers only wanted the checksum,
so it's simpler (and error-free) to simply allocate a whole buffer
and checksum that.
For the callers that want to write it, it's also still simpler to allocate the
buffer and write the whole thing rather than having this function do the
writing.
A lot of the complexity here again is a legacy of the packfile code, which is
dead.
This is prep for faster regfile commits where we can avoid `G{In,Out}putStream`.
Closes: #1257
Approved by: jlebon
This commit is contained in:
1 parent
d10593e65d
commit
bb51a43d81
5 files changed
+81
-130
No files matched your search
@@ -51,6 +51,14 @@ void ot_checksum_init (OtChecksum *checksum);
|
||||
void ot_checksum_update (OtChecksum *checksum,
|
||||
const guint8 *buf,
|
||||
size_t len);
|
||||
static inline void
|
||||
ot_checksum_update_bytes (OtChecksum *checksum,
|
||||
GBytes *buf)
|
||||
{
|
||||
gsize len;
|
||||
const guint8 *bufdata = g_bytes_get_data (buf, &len);
|
||||
ot_checksum_update (checksum, bufdata, len);
|
||||
}
|
||||
void ot_checksum_get_digest (OtChecksum *checksum,
|
||||
guint8 *buf,
|
||||
size_t buflen);
|
||||
|
||||
Reference in new issue
Block a user