mirror of
https://github.com/ostreedev/ostree.git
synced 2024-12-22 17:35:55 +03:00
core: Add allocating b64 checksum functions
The checksum_b64_inplace variants can't be used in bindings. Provide versions that allocate and return the output rather than working on a passed in buffer. These can then be used in GI bindings to get the ostree modified base64 encodings. Closes: #398 Approved by: cgwalters
This commit is contained in:
parent
2e97e72123
commit
db974b0596
@ -99,6 +99,8 @@ ostree_checksum_inplace_from_bytes
|
||||
ostree_checksum_inplace_to_bytes
|
||||
ostree_checksum_bytes_peek
|
||||
ostree_checksum_bytes_peek_validate
|
||||
ostree_checksum_b64_from_bytes
|
||||
ostree_checksum_b64_to_bytes
|
||||
ostree_checksum_b64_inplace_from_bytes
|
||||
ostree_checksum_b64_inplace_to_bytes
|
||||
ostree_cmp_checksum_bytes
|
||||
|
@ -351,9 +351,8 @@ global:
|
||||
* NOTE NOTE NOTE
|
||||
*/
|
||||
|
||||
/* UNCOMMENT WHEN ADDING THE FIRST NEW SYMBOL FOR 2016.8
|
||||
LIBOSTREE_2016.8 {
|
||||
global:
|
||||
insert_symbol_here;
|
||||
ostree_checksum_b64_to_bytes;
|
||||
ostree_checksum_b64_from_bytes;
|
||||
} LIBOSTREE_2016.7;
|
||||
*/
|
||||
|
@ -1272,6 +1272,20 @@ ostree_checksum_to_bytes_v (const char *checksum)
|
||||
return ot_gvariant_new_bytearray ((guchar*)result, OSTREE_SHA256_DIGEST_LEN);
|
||||
}
|
||||
|
||||
/**
|
||||
* ostree_checksum_b64_to_bytes:
|
||||
* @checksum: An ASCII checksum
|
||||
*
|
||||
* Returns: (transfer full) (array fixed-size=32): Binary version of @checksum.
|
||||
*/
|
||||
guchar *
|
||||
ostree_checksum_b64_to_bytes (const char *checksum)
|
||||
{
|
||||
guchar *ret = g_malloc (32);
|
||||
ostree_checksum_b64_inplace_to_bytes (checksum, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* ostree_checksum_inplace_from_bytes: (skip)
|
||||
* @csum: (array fixed-size=32): An binary checksum of length 32
|
||||
@ -1363,6 +1377,23 @@ ostree_checksum_from_bytes_v (GVariant *csum_v)
|
||||
return ostree_checksum_from_bytes (ostree_checksum_bytes_peek (csum_v));
|
||||
}
|
||||
|
||||
/**
|
||||
* ostree_checksum_b64_from_bytes:
|
||||
* @csum: (array fixed-size=32): An binary checksum of length 32
|
||||
*
|
||||
* Returns: (transfer full): Modified base64 encoding of @csum
|
||||
*
|
||||
* The "modified" term refers to the fact that instead of '/', the '_'
|
||||
* character is used.
|
||||
*/
|
||||
char *
|
||||
ostree_checksum_b64_from_bytes (const guchar *csum)
|
||||
{
|
||||
char *ret = g_malloc (44);
|
||||
ostree_checksum_b64_inplace_from_bytes (csum, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* ostree_checksum_bytes_peek:
|
||||
* @bytes: #GVariant of type ay
|
||||
|
@ -192,6 +192,8 @@ guchar *ostree_checksum_to_bytes (const char *checksum);
|
||||
_OSTREE_PUBLIC
|
||||
GVariant *ostree_checksum_to_bytes_v (const char *checksum);
|
||||
_OSTREE_PUBLIC
|
||||
guchar *ostree_checksum_b64_to_bytes (const char *checksum);
|
||||
_OSTREE_PUBLIC
|
||||
void ostree_checksum_b64_inplace_to_bytes (const char *checksum,
|
||||
guint8 *buf);
|
||||
|
||||
@ -199,6 +201,8 @@ _OSTREE_PUBLIC
|
||||
char * ostree_checksum_from_bytes (const guchar *csum);
|
||||
_OSTREE_PUBLIC
|
||||
char * ostree_checksum_from_bytes_v (GVariant *csum_v);
|
||||
_OSTREE_PUBLIC
|
||||
char * ostree_checksum_b64_from_bytes (const guchar *csum);
|
||||
|
||||
_OSTREE_PUBLIC
|
||||
void ostree_checksum_inplace_from_bytes (const guchar *csum,
|
||||
|
Loading…
Reference in New Issue
Block a user