Updated liberasurecode_supported_checksum_types to accept a pointer
argument that holds the length of the list returned (i.e. the number of supported checksum types).
This commit is contained in:
parent
c22312f2d0
commit
4cfd3f535b
|
@ -115,7 +115,7 @@ struct ec_args {
|
|||
* set of backends can be different from the names listed in
|
||||
* ec_backend_names above.
|
||||
*
|
||||
* @param num_backends - pointer to return number of backends in
|
||||
* @param num_backends - pointer to int, size of list returned
|
||||
*
|
||||
* @returns list of EC backends implemented
|
||||
*/
|
||||
|
@ -125,11 +125,11 @@ const char ** liberasurecode_supported_backends(int *num_backends);
|
|||
* Returns a list of checksum types supported for fragment data, stored in
|
||||
* individual fragment headers as part of fragment metadata
|
||||
*
|
||||
* @param num_checksum_types - pointer to return number of checksum types in
|
||||
* @param num_checksum_types - pointer to int, size of list returned
|
||||
*
|
||||
* @returns list of checksum types supported for fragment data
|
||||
*/
|
||||
const char ** liberasurecode_supported_checksum_types(void);
|
||||
const char ** liberasurecode_supported_checksum_types(int *num_checksum_types);
|
||||
|
||||
/**
|
||||
* Create a liberasurecode instance and return a descriptor
|
||||
|
|
|
@ -246,12 +246,13 @@ const char ** liberasurecode_supported_backends(int *num_backends)
|
|||
* Returns a list of checksum types supported for fragment data, stored in
|
||||
* individual fragment headers as part of fragment metadata
|
||||
*
|
||||
* @param num_checksum_types - pointer to return number of checksum types in
|
||||
* @param num_checksum_types - pointer to int, size of list returned
|
||||
*
|
||||
* @returns list of checksum types supported for fragment data
|
||||
*/
|
||||
const char ** liberasurecode_supported_checksum_types(void)
|
||||
const char ** liberasurecode_supported_checksum_types(int *num_checksum_types)
|
||||
{
|
||||
*num_checksum_types = CHKSUM_TYPES_MAX;
|
||||
return (const char **) ec_chksum_types;
|
||||
}
|
||||
|
||||
|
|
|
@ -116,9 +116,11 @@ static void test_liberasurecode_supported_backends()
|
|||
static void test_liberasurecode_supported_checksum_types()
|
||||
{
|
||||
int i;
|
||||
int num_checksum_types;
|
||||
const char **supported_checksum_types =
|
||||
liberasurecode_supported_checksum_types();
|
||||
liberasurecode_supported_checksum_types(&num_checksum_types);
|
||||
|
||||
assert(num_checksum_types == CHKSUM_TYPES_MAX);
|
||||
for (i = 0; i < CHKSUM_TYPES_MAX; i++)
|
||||
printf("%s\n", supported_checksum_types[i]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue