in src/configuration_reader.c [232:295]
int configuration_reader_get_uint64_t(IFabricCodePackageActivationContext* activation_context, const wchar_t* config_package_name, const wchar_t* section_name, const wchar_t* parameter_name, uint64_t* value)
{
int result;
if (
/*Codes_SRS_CONFIGURATION_READER_42_001: [ If activation_context is NULL then configuration_reader_get_uint64_t shall fail and return a non-zero value. ]*/
activation_context == NULL ||
/*Codes_SRS_CONFIGURATION_READER_42_002: [ If config_package_name is NULL or empty then configuration_reader_get_uint64_t shall fail and return a non-zero value. ]*/
(config_package_name == NULL || config_package_name[0] == L'\0') ||
/*Codes_SRS_CONFIGURATION_READER_42_003: [ If section_name is NULL or empty then configuration_reader_get_uint64_t shall fail and return a non-zero value. ]*/
(section_name == NULL || section_name[0] == L'\0') ||
/*Codes_SRS_CONFIGURATION_READER_42_004: [ If parameter_name is NULL or empty then configuration_reader_get_uint64_t shall fail and return a non-zero value. ]*/
(parameter_name == NULL || parameter_name[0] == L'\0') ||
/*Codes_SRS_CONFIGURATION_READER_42_005: [ If value is NULL then configuration_reader_get_uint64_t shall fail and return a non-zero value. ]*/
(value == NULL)
)
{
LogError("Invalid args: IFabricCodePackageActivationContext* activation_context = %p, const wchar_t* config_package_name = %ls, const wchar_t* section_name = %ls, const wchar_t* parameter_name = %ls, uint64_t* value = %p",
activation_context, MU_WP_OR_NULL(config_package_name), MU_WP_OR_NULL(section_name), MU_WP_OR_NULL(parameter_name), value);
result = MU_FAILURE;
}
else
{
IFabricConfigurationPackage* fabric_configuration_package;
const wchar_t* wchar_value;
if (get_string_value_from_package(activation_context, config_package_name, section_name, parameter_name, &fabric_configuration_package, &wchar_value) != 0)
{
// already logged error
result = MU_FAILURE;
}
else
{
/*Codes_SRS_CONFIGURATION_READER_42_008: [ configuration_reader_get_uint64_t shall convert the value to uint64_t and store it in value. ]*/
wchar_t* end_ptr;
uint64_t temp = wcstoull(wchar_value, &end_ptr, 10);
if (end_ptr == wchar_value)
{
/*Codes_SRS_CONFIGURATION_READER_42_010: [ If there are any other failures then configuration_reader_get_uint64_t shall fail and return a non-zero value. ]*/
LogError("failure in wcstoull(%ls): subject sequence is empty or does not have the expected form (config_package_name:%ls, section_name:%ls, parameter_name:%ls)",
wchar_value, config_package_name, section_name, parameter_name);
result = MU_FAILURE;
}
else
{
if ((temp == ULLONG_MAX) && (errno == ERANGE))
{
/*Codes_SRS_CONFIGURATION_READER_42_009: [ If the value is outside the range of representable values then configuration_reader_get_uint64_t shall fail and return a non-zero value. ]*/
LogError("ULLONGMAX was returned for wcstoull(%ls), indicating the correct value is outside the range of representable values (config_package_name:%ls, section_name:%ls, parameter_name:%ls)",
wchar_value, config_package_name, section_name, parameter_name);
result = MU_FAILURE;
}
else
{
/*Codes_SRS_CONFIGURATION_READER_42_011: [ configuration_reader_get_uint64_t shall succeed and return 0. ]*/
*value = temp;
result = 0;
}
}
(void)fabric_configuration_package->lpVtbl->Release(fabric_configuration_package);
}
}
return result;
}