Change uint32_t option to enum

This commit is contained in:
Jonathan Chiu 2019-03-05 13:29:28 -08:00
Родитель 360989e919
Коммит 4b116e0bed
12 изменённых файлов: 19 добавлений и 14 удалений

Просмотреть файл

@ -29,7 +29,7 @@ const IO_INTERFACE_DESCRIPTION* platform_get_default_tlsio(void)
return tlsio_openssl_get_interface_description();
}
STRING_HANDLE platform_get_platform_info(uint32_t options)
STRING_HANDLE platform_get_platform_info(PLATFORM_INFO_OPTION options)
{
(void)options;

Просмотреть файл

@ -20,7 +20,7 @@ const IO_INTERFACE_DESCRIPTION* platform_get_default_tlsio(void)
return tlsio_cyclonessl_get_interface_description();
}
STRING_HANDLE platform_get_platform_info(uint32_t options)
STRING_HANDLE platform_get_platform_info(PLATFORM_INFO_OPTION options)
{
(void)options;

Просмотреть файл

@ -47,7 +47,7 @@ const IO_INTERFACE_DESCRIPTION* platform_get_default_tlsio(void)
#endif
}
STRING_HANDLE platform_get_platform_info(uint32_t options)
STRING_HANDLE platform_get_platform_info(PLATFORM_INFO_OPTION options)
{
(void)options;

Просмотреть файл

@ -64,7 +64,7 @@ const IO_INTERFACE_DESCRIPTION* platform_get_default_tlsio(void)
return tlsio_wolfssl_get_interface_description();
}
STRING_HANDLE platform_get_platform_info(uint32_t options)
STRING_HANDLE platform_get_platform_info(PLATFORM_INFO_OPTION options)
{
(void)options;

Просмотреть файл

@ -16,7 +16,7 @@ const IO_INTERFACE_DESCRIPTION *platform_get_default_tlsio(void)
return tlsio_mbedtls_get_interface_description();
}
STRING_HANDLE platform_get_platform_info(uint32_t options)
STRING_HANDLE platform_get_platform_info(PLATFORM_INFO_OPTION options)
{
(void)options;

Просмотреть файл

@ -13,7 +13,7 @@ const IO_INTERFACE_DESCRIPTION* platform_get_default_tlsio(void)
return NULL;
}
STRING_HANDLE platform_get_platform_info(uint32_t options)
STRING_HANDLE platform_get_platform_info(PLATFORM_INFO_OPTION options)
{
(void)options;

Просмотреть файл

@ -15,7 +15,7 @@ const IO_INTERFACE_DESCRIPTION* platform_get_default_tlsio(void)
return tlsio_mbedtls_get_interface_description();
}
STRING_HANDLE platform_get_platform_info(uint32_t options)
STRING_HANDLE platform_get_platform_info(PLATFORM_INFO_OPTION options)
{
(void)options;

Просмотреть файл

@ -114,7 +114,7 @@ static char* get_win_sqm_info(void)
return result;
}
STRING_HANDLE platform_get_platform_info(uint32_t options)
STRING_HANDLE platform_get_platform_info(PLATFORM_INFO_OPTION options)
{
// Expected format: "(<runtime name>; <operating system name>; <platform>)"
STRING_HANDLE result;
@ -171,7 +171,7 @@ STRING_HANDLE platform_get_platform_info(uint32_t options)
LogError("STRING_construct_sprintf failed");
}
if (options & PLATFORM_OPTION_RETRIEVE_SQM)
if (options & PLATFORM_INFO_OPTION_RETRIEVE_SQM)
{
// Failure here should continue
char* sqm_info = get_win_sqm_info();

Просмотреть файл

@ -9,7 +9,12 @@
#include "azure_c_shared_utility/umock_c_prod.h"
#define GUID_LENGTH 64
#define PLATFORM_OPTION_RETRIEVE_SQM 0x0001
#define PLATFORM_INFO_OPTION_VALUES \
PLATFORM_INFO_OPTION_DEFAULT, \
PLATFORM_INFO_OPTION_RETRIEVE_SQM
DEFINE_ENUM(PLATFORM_INFO_OPTION, PLATFORM_INFO_OPTION_VALUES);
#ifdef __cplusplus
extern "C" {
@ -21,7 +26,7 @@ extern "C" {
MOCKABLE_FUNCTION(, int, platform_init);
MOCKABLE_FUNCTION(, void, platform_deinit);
MOCKABLE_FUNCTION(, const IO_INTERFACE_DESCRIPTION*, platform_get_default_tlsio);
MOCKABLE_FUNCTION(, STRING_HANDLE, platform_get_platform_info, uint32_t, options);
MOCKABLE_FUNCTION(, STRING_HANDLE, platform_get_platform_info, PLATFORM_INFO_OPTION, options);
#ifdef __cplusplus
}

Просмотреть файл

@ -20,7 +20,7 @@ const IO_INTERFACE_DESCRIPTION* platform_get_default_tlsio(void)
return tlsio_appleios_get_interface_description();
}
STRING_HANDLE platform_get_platform_info(uint32_t options)
STRING_HANDLE platform_get_platform_info(PLATFORM_INFO_OPTION options)
{
(void)options;
STRING_HANDLE result;

Просмотреть файл

@ -53,7 +53,7 @@ static void show_sastoken_example()
static void show_platform_info()
{
STRING_HANDLE platform_info = platform_get_platform_info(PLATFORM_OPTION_RETRIEVE_SQM);
STRING_HANDLE platform_info = platform_get_platform_info(PLATFORM_INFO_OPTION_RETRIEVE_SQM);
if (platform_info != NULL)
{
(void)printf("%s\r\n", STRING_c_str(platform_info));

Просмотреть файл

@ -242,7 +242,7 @@ TEST_FUNCTION(platform_get_platform_info_success)
//arrange
//act
STRING_HANDLE platform = platform_get_platform_info(PLATFORM_OPTION_RETRIEVE_SQM);
STRING_HANDLE platform = platform_get_platform_info(PLATFORM_INFO_OPTION_RETRIEVE_SQM);
//assert
ASSERT_IS_NOT_NULL(platform);