Add %s NULL check to logging statements (#2594)

* Add null ptr to "NULL" string

* avoid double maco expansion

* added comments
  // advoid MU_P_OR_NULL double call

* handle NULL CompareProperties
This commit is contained in:
Eric Wolz 2024-03-13 11:29:53 -07:00 коммит произвёл GitHub
Родитель f8e111bf7d
Коммит dd31b51eee
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
6 изменённых файлов: 64 добавлений и 44 удалений

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

@ -2385,7 +2385,7 @@ IOTHUB_CLIENT_RESULT IoTHubClientCore_UploadToBlobAsync(IOTHUB_CLIENT_CORE_HANDL
{
LogError("invalid parameters IOTHUB_CLIENT_CORE_HANDLE iotHubClientHandle = %p , const char* destinationFileName = %s, const unsigned char* source= %p, size_t size = %lu, IOTHUB_CLIENT_FILE_UPLOAD_CALLBACK iotHubClientFileUploadCallback = %p, void* context = %p",
iotHubClientHandle,
destinationFileName,
MU_P_OR_NULL(destinationFileName),
source,
(unsigned long)size,
iotHubClientFileUploadCallback,

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

@ -656,7 +656,7 @@ static bool IoTHubClientCore_LL_MessageCallbackFromInput(IOTHUB_MESSAGE_HANDLE m
if (item_handle == NULL)
{
LogError("Could not find callback (explicit or default) for input queue %s", inputName);
LogError("Could not find callback (explicit or default) for input queue %s", MU_P_OR_NULL(inputName));
result = false;
}
else
@ -2714,7 +2714,7 @@ IOTHUB_CLIENT_RESULT IoTHubClientCore_LL_UploadToBlob(IOTHUB_CLIENT_CORE_LL_HAND
)
{
LogError("invalid parameters iotHubClientHandle=%p, const char* destinationFileName=%s, const unsigned char* source=%p, size_t size=%lu",
iotHubClientHandle, destinationFileName, source, (unsigned long)size);
iotHubClientHandle, MU_P_OR_NULL(destinationFileName), source, (unsigned long)size);
result = IOTHUB_CLIENT_INVALID_ARG;
}
else
@ -3165,7 +3165,7 @@ static IOTHUB_CLIENT_RESULT remove_event_unsubscribe_if_needed(IOTHUB_CLIENT_COR
LIST_ITEM_HANDLE item_handle = singlylinkedlist_find(handleData->event_callbacks, is_event_equal_for_match, (const void*)inputName);
if (item_handle == NULL)
{
LogError("Input name %s was not present", inputName);
LogError("Input name %s was not present", MU_P_OR_NULL(inputName));
result = IOTHUB_CLIENT_ERROR;
}
else

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

@ -195,7 +195,7 @@ static STRING_HANDLE get_target_iothub_fqdn(const IOTHUBTRANSPORT_CONFIG* config
if (config->upperConfig->protocolGatewayHostName == NULL)
{
if ((fqdn = STRING_construct_sprintf("%s.%s", config->upperConfig->iotHubName, config->upperConfig->iotHubSuffix)) == NULL)
if ((fqdn = STRING_construct_sprintf("%s.%s", MU_P_OR_NULL(config->upperConfig->iotHubName), MU_P_OR_NULL(config->upperConfig->iotHubSuffix))) == NULL)
{
LogError("Failed to copy iotHubName and iotHubSuffix (STRING_construct_sprintf failed)");
}
@ -495,7 +495,8 @@ static int subscribe_methods(AMQP_TRANSPORT_DEVICE_INSTANCE* deviceState)
if ((amqp_connection_get_session_handle(deviceState->transport_instance->amqp_connection, &session_handle)) != RESULT_OK)
{
LogError("Device '%s' failed subscribing for methods (failed getting session handle)", STRING_c_str(deviceState->device_id));
const char* device_id = STRING_c_str(deviceState->device_id); // advoid MU_P_OR_NULL double call
LogError("Device '%s' failed subscribing for methods (failed getting session handle)", MU_P_OR_NULL(device_id));
result = MU_FAILURE;
}
else if (iothubtransportamqp_methods_subscribe(deviceState->methods_handle, session_handle, on_methods_error, deviceState, on_method_request_received, deviceState, on_methods_unsubscribed, deviceState) != 0)
@ -815,7 +816,8 @@ static void prepare_device_for_connection_retry(AMQP_TRANSPORT_DEVICE_INSTANCE*
{
if (amqp_device_stop(registered_device->device_handle) != RESULT_OK)
{
LogError("Failed preparing device '%s' for connection retry (amqp_device_stop failed)", STRING_c_str(registered_device->device_id));
const char* device_id = STRING_c_str(registered_device->device_id); // advoid MU_P_OR_NULL double call
LogError("Failed preparing device '%s' for connection retry (amqp_device_stop failed)", MU_P_OR_NULL(device_id));
}
}
@ -869,7 +871,7 @@ static bool is_device_credential_acceptable(const IOTHUB_DEVICE_CONFIG* device_c
if ((device_config->deviceSasToken != NULL) && (device_config->deviceKey != NULL))
{
LogError("Credential of device '%s' is not acceptable (must provide EITHER deviceSasToken OR deviceKey)", device_config->deviceId);
LogError("Credential of device '%s' is not acceptable (must provide EITHER deviceSasToken OR deviceKey)", MU_P_OR_NULL(device_config->deviceId));
result = false;
}
else if (preferred_authentication_mode == AMQP_TRANSPORT_AUTHENTICATION_MODE_NOT_SET)
@ -878,12 +880,12 @@ static bool is_device_credential_acceptable(const IOTHUB_DEVICE_CONFIG* device_c
}
else if (preferred_authentication_mode == AMQP_TRANSPORT_AUTHENTICATION_MODE_X509 && (device_config->deviceKey != NULL || device_config->deviceSasToken != NULL))
{
LogError("Credential of device '%s' is not acceptable (transport is using X509 certificate authentication, but device config contains deviceKey or sasToken)", device_config->deviceId);
LogError("Credential of device '%s' is not acceptable (transport is using X509 certificate authentication, but device config contains deviceKey or sasToken)", MU_P_OR_NULL(device_config->deviceId));
result = false;
}
else if (preferred_authentication_mode != AMQP_TRANSPORT_AUTHENTICATION_MODE_X509 && (device_config->deviceKey == NULL && device_config->deviceSasToken == NULL))
{
LogError("Credential of device '%s' is not acceptable (transport is using CBS authentication, but device config does not contain deviceKey nor sasToken)", device_config->deviceId);
LogError("Credential of device '%s' is not acceptable (transport is using CBS authentication, but device config does not contain deviceKey nor sasToken)", MU_P_OR_NULL(device_config->deviceId));
result = false;
}
else
@ -992,7 +994,8 @@ static int send_pending_events(AMQP_TRANSPORT_DEVICE_INSTANCE* device_state)
{
if (amqp_device_send_event_async(device_state->device_handle, message, on_event_send_complete, device_state) != RESULT_OK)
{
LogError("Device '%s' failed to send message (amqp_device_send_event_async failed)", STRING_c_str(device_state->device_id));
const char* device_id = STRING_c_str(device_state->device_id); // advoid MU_P_OR_NULL double call
LogError("Device '%s' failed to send message (amqp_device_send_event_async failed)", MU_P_OR_NULL(device_id));
result = MU_FAILURE;
on_event_send_complete(message, D2C_EVENT_SEND_COMPLETE_RESULT_ERROR_FAIL_SENDING, device_state);
@ -1022,18 +1025,21 @@ static int IoTHubTransport_AMQP_Common_Device_DoWork(AMQP_TRANSPORT_DEVICE_INSTA
if (amqp_connection_get_session_handle(registered_device->transport_instance->amqp_connection, &session_handle) != RESULT_OK)
{
LogError("Failed performing DoWork for device '%s' (failed to get the amqp_connection session_handle)", STRING_c_str(registered_device->device_id));
const char* device_id = STRING_c_str(registered_device->device_id); // advoid MU_P_OR_NULL double call
LogError("Failed performing DoWork for device '%s' (failed to get the amqp_connection session_handle)", MU_P_OR_NULL(device_id));
result = MU_FAILURE;
}
else if (registered_device->transport_instance->preferred_authentication_mode == AMQP_TRANSPORT_AUTHENTICATION_MODE_CBS &&
amqp_connection_get_cbs_handle(registered_device->transport_instance->amqp_connection, &cbs_handle) != RESULT_OK)
{
LogError("Failed performing DoWork for device '%s' (failed to get the amqp_connection cbs_handle)", STRING_c_str(registered_device->device_id));
const char* device_id = STRING_c_str(registered_device->device_id); // advoid MU_P_OR_NULL double call
LogError("Failed performing DoWork for device '%s' (failed to get the amqp_connection cbs_handle)", MU_P_OR_NULL(device_id));
result = MU_FAILURE;
}
else if (amqp_device_start_async(registered_device->device_handle, session_handle, cbs_handle) != RESULT_OK)
{
LogError("Failed performing DoWork for device '%s' (failed to start device)", STRING_c_str(registered_device->device_id));
const char* device_id = STRING_c_str(registered_device->device_id); // advoid MU_P_OR_NULL double call
LogError("Failed performing DoWork for device '%s' (failed to start device)", MU_P_OR_NULL(device_id));
result = MU_FAILURE;
}
else
@ -1047,13 +1053,15 @@ static int IoTHubTransport_AMQP_Common_Device_DoWork(AMQP_TRANSPORT_DEVICE_INSTA
bool is_timed_out;
if (is_timeout_reached(registered_device->time_of_last_state_change, registered_device->max_state_change_timeout_secs, &is_timed_out) != RESULT_OK)
{
LogError("Failed performing DoWork for device '%s' (failed tracking timeout of device %d state)", STRING_c_str(registered_device->device_id), registered_device->device_state);
const char* device_id = STRING_c_str(registered_device->device_id); // advoid MU_P_OR_NULL double call
LogError("Failed performing DoWork for device '%s' (failed tracking timeout of device %d state)", MU_P_OR_NULL(device_id), registered_device->device_state);
registered_device->device_state = DEVICE_STATE_ERROR_AUTH; // if time could not be calculated, the worst must be assumed.
result = MU_FAILURE;
}
else if (is_timed_out)
{
LogError("Failed performing DoWork for device '%s' (device failed to start or stop within expected timeout)", STRING_c_str(registered_device->device_id));
const char* device_id = STRING_c_str(registered_device->device_id); // advoid MU_P_OR_NULL double call
LogError("Failed performing DoWork for device '%s' (device failed to start or stop within expected timeout)", MU_P_OR_NULL(device_id));
registered_device->device_state = DEVICE_STATE_ERROR_AUTH; // this will cause device to be stopped bellow on the next call to this function.
result = MU_FAILURE;
}
@ -1068,13 +1076,15 @@ static int IoTHubTransport_AMQP_Common_Device_DoWork(AMQP_TRANSPORT_DEVICE_INSTA
if (registered_device->number_of_previous_failures >= MAX_NUMBER_OF_DEVICE_FAILURES)
{
const char* device_id = STRING_c_str(registered_device->device_id); // advoid MU_P_OR_NULL double call
LogError("Failed performing DoWork for device '%s' (device reported state %d; number of previous failures: %lu)",
STRING_c_str(registered_device->device_id), (int)registered_device->device_state, (unsigned long)registered_device->number_of_previous_failures);
MU_P_OR_NULL(device_id), (int)registered_device->device_state, (unsigned long)registered_device->number_of_previous_failures);
result = MU_FAILURE;
}
else if (amqp_device_delayed_stop(registered_device->device_handle, DEFAULT_DEVICE_STOP_DELAY) != RESULT_OK)
{
LogError("Failed to stop reset device '%s' (amqp_device_stop failed)", STRING_c_str(registered_device->device_id));
const char* device_id = STRING_c_str(registered_device->device_id); // advoid MU_P_OR_NULL double call
LogError("Failed to stop reset device '%s' (amqp_device_stop failed)", MU_P_OR_NULL(device_id));
result = MU_FAILURE;
}
else
@ -1087,7 +1097,8 @@ static int IoTHubTransport_AMQP_Common_Device_DoWork(AMQP_TRANSPORT_DEVICE_INSTA
!registered_device->subscribed_for_methods &&
subscribe_methods(registered_device) != RESULT_OK)
{
LogError("Failed performing DoWork for device '%s' (failed registering for device methods)", STRING_c_str(registered_device->device_id));
const char* device_id = STRING_c_str(registered_device->device_id); // advoid MU_P_OR_NULL double call
LogError("Failed performing DoWork for device '%s' (failed registering for device methods)", MU_P_OR_NULL(device_id));
registered_device->number_of_previous_failures++;
result = MU_FAILURE;
}
@ -1095,7 +1106,8 @@ static int IoTHubTransport_AMQP_Common_Device_DoWork(AMQP_TRANSPORT_DEVICE_INSTA
{
if (send_pending_events(registered_device) != RESULT_OK)
{
LogError("Failed performing DoWork for device '%s' (failed sending pending events)", STRING_c_str(registered_device->device_id));
const char* device_id = STRING_c_str(registered_device->device_id); // advoid MU_P_OR_NULL double call
LogError("Failed performing DoWork for device '%s' (failed sending pending events)", MU_P_OR_NULL(device_id));
registered_device->number_of_previous_failures++;
result = MU_FAILURE;
}
@ -1127,7 +1139,8 @@ static int replicate_device_options_to(AMQP_TRANSPORT_DEVICE_INSTANCE* dev_insta
DEVICE_OPTION_EVENT_SEND_TIMEOUT_SECS,
&dev_instance->transport_instance->option_send_event_timeout_secs) != RESULT_OK)
{
LogError("Failed to apply option DEVICE_OPTION_EVENT_SEND_TIMEOUT_SECS to device '%s' (amqp_device_set_option failed)", STRING_c_str(dev_instance->device_id));
const char* device_id = STRING_c_str(dev_instance->device_id); // advoid MU_P_OR_NULL double call
LogError("Failed to apply option DEVICE_OPTION_EVENT_SEND_TIMEOUT_SECS to device '%s' (amqp_device_set_option failed)", MU_P_OR_NULL(device_id));
result = MU_FAILURE;
}
else if (auth_mode == DEVICE_AUTH_MODE_CBS)
@ -1137,7 +1150,8 @@ static int replicate_device_options_to(AMQP_TRANSPORT_DEVICE_INSTANCE* dev_insta
DEVICE_OPTION_CBS_REQUEST_TIMEOUT_SECS,
&dev_instance->transport_instance->option_cbs_request_timeout_secs) != RESULT_OK)
{
LogError("Failed to apply option DEVICE_OPTION_CBS_REQUEST_TIMEOUT_SECS to device '%s' (amqp_device_set_option failed)", STRING_c_str(dev_instance->device_id));
const char* device_id = STRING_c_str(dev_instance->device_id); // advoid MU_P_OR_NULL double call
LogError("Failed to apply option DEVICE_OPTION_CBS_REQUEST_TIMEOUT_SECS to device '%s' (amqp_device_set_option failed)", MU_P_OR_NULL(device_id));
result = MU_FAILURE;
}
else
@ -1208,8 +1222,9 @@ static int IoTHubTransport_AMQP_Common_Device_SetOption(TRANSPORT_LL_HANDLE hand
}
else if (amqp_device_set_option(registered_device->device_handle, device_option, value) != RESULT_OK)
{
const char* device_id = STRING_c_str(registered_device->device_id); // advoid MU_P_OR_NULL double call
LogError("failed setting option '%s' to registered device '%s' (amqp_device_set_option failed)",
option, STRING_c_str(registered_device->device_id));
option, MU_P_OR_NULL(device_id));
result = MU_FAILURE;
break;
}
@ -1512,12 +1527,14 @@ int IoTHubTransport_AMQP_Common_Subscribe(IOTHUB_DEVICE_HANDLE handle)
if (!is_device_registered(amqp_device_instance))
{
LogError("Device '%s' failed subscribing to cloud-to-device messages (device is not registered)", STRING_c_str(amqp_device_instance->device_id));
const char* device_id = STRING_c_str(amqp_device_instance->device_id); // advoid MU_P_OR_NULL double call
LogError("Device '%s' failed subscribing to cloud-to-device messages (device is not registered)", MU_P_OR_NULL(device_id));
result = MU_FAILURE;
}
else if (amqp_device_subscribe_message(amqp_device_instance->device_handle, on_message_received, amqp_device_instance) != RESULT_OK)
{
LogError("Device '%s' failed subscribing to cloud-to-device messages (amqp_device_subscribe_message failed)", STRING_c_str(amqp_device_instance->device_id));
const char* device_id = STRING_c_str(amqp_device_instance->device_id); // advoid MU_P_OR_NULL double call
LogError("Device '%s' failed subscribing to cloud-to-device messages (amqp_device_subscribe_message failed)", MU_P_OR_NULL(device_id));
result = MU_FAILURE;
}
else
@ -1541,11 +1558,13 @@ void IoTHubTransport_AMQP_Common_Unsubscribe(IOTHUB_DEVICE_HANDLE handle)
if (!is_device_registered(amqp_device_instance))
{
LogError("Device '%s' failed unsubscribing to cloud-to-device messages (device is not registered)", STRING_c_str(amqp_device_instance->device_id));
const char* device_id = STRING_c_str(amqp_device_instance->device_id); // advoid MU_P_OR_NULL double call
LogError("Device '%s' failed unsubscribing to cloud-to-device messages (device is not registered)", MU_P_OR_NULL(device_id));
}
else if (amqp_device_unsubscribe_message(amqp_device_instance->device_handle) != RESULT_OK)
{
LogError("Device '%s' failed unsubscribing to cloud-to-device messages (amqp_device_unsubscribe_message failed)", STRING_c_str(amqp_device_instance->device_id));
const char* device_id = STRING_c_str(amqp_device_instance->device_id); // advoid MU_P_OR_NULL double call
LogError("Device '%s' failed unsubscribing to cloud-to-device messages (amqp_device_unsubscribe_message failed)", MU_P_OR_NULL(device_id));
}
}
}
@ -2034,12 +2053,12 @@ IOTHUB_DEVICE_HANDLE IoTHubTransport_AMQP_Common_Register(TRANSPORT_LL_HANDLE ha
if (is_device_registered_ex(transport_instance->registered_devices, device->deviceId, &list_item))
{
LogError("IoTHubTransport_AMQP_Common_Register failed (device '%s' already registered on this transport instance)", device->deviceId);
LogError("IoTHubTransport_AMQP_Common_Register failed (device '%s' already registered on this transport instance)", MU_P_OR_NULL(device->deviceId));
result = NULL;
}
else if (!is_device_credential_acceptable(device, transport_instance->preferred_authentication_mode))
{
LogError("Transport failed to register device '%s' (device credential was not accepted)", device->deviceId);
LogError("Transport failed to register device '%s' (device credential was not accepted)", MU_P_OR_NULL(device->deviceId));
result = NULL;
}
else
@ -2048,7 +2067,7 @@ IOTHUB_DEVICE_HANDLE IoTHubTransport_AMQP_Common_Register(TRANSPORT_LL_HANDLE ha
if ((amqp_device_instance = (AMQP_TRANSPORT_DEVICE_INSTANCE*)malloc(sizeof(AMQP_TRANSPORT_DEVICE_INSTANCE))) == NULL)
{
LogError("Transport failed to register device '%s' (failed to create the device state instance; malloc failed)", device->deviceId);
LogError("Transport failed to register device '%s' (failed to create the device state instance; malloc failed)", MU_P_OR_NULL(device->deviceId));
result = NULL;
}
else
@ -2067,7 +2086,7 @@ IOTHUB_DEVICE_HANDLE IoTHubTransport_AMQP_Common_Register(TRANSPORT_LL_HANDLE ha
if ((amqp_device_instance->device_id = STRING_construct(device->deviceId)) == NULL)
{
LogError("Transport failed to register device '%s' (failed to copy the deviceId)", device->deviceId);
LogError("Transport failed to register device '%s' (failed to copy the deviceId)", MU_P_OR_NULL(device->deviceId));
result = NULL;
}
else
@ -2085,7 +2104,7 @@ IOTHUB_DEVICE_HANDLE IoTHubTransport_AMQP_Common_Register(TRANSPORT_LL_HANDLE ha
if ((amqp_device_instance->device_handle = amqp_device_create(&device_config)) == NULL)
{
LogError("Transport failed to register device '%s' (failed to create the DEVICE_HANDLE instance)", device->deviceId);
LogError("Transport failed to register device '%s' (failed to create the DEVICE_HANDLE instance)", MU_P_OR_NULL(device->deviceId));
result = NULL;
}
else
@ -2095,19 +2114,19 @@ IOTHUB_DEVICE_HANDLE IoTHubTransport_AMQP_Common_Register(TRANSPORT_LL_HANDLE ha
amqp_device_instance->methods_handle = iothubtransportamqp_methods_create(STRING_c_str(transport_instance->iothub_host_fqdn), device->deviceId, device->moduleId);
if (amqp_device_instance->methods_handle == NULL)
{
LogError("Transport failed to register device '%s' (Cannot create the methods module)", device->deviceId);
LogError("Transport failed to register device '%s' (Cannot create the methods module)", MU_P_OR_NULL(device->deviceId));
result = NULL;
}
else
{
if (replicate_device_options_to(amqp_device_instance, device_config.authentication_mode) != RESULT_OK)
{
LogError("Transport failed to register device '%s' (failed to replicate options)", device->deviceId);
LogError("Transport failed to register device '%s' (failed to replicate options)", MU_P_OR_NULL(device->deviceId));
result = NULL;
}
else if (singlylinkedlist_add(transport_instance->registered_devices, amqp_device_instance) == NULL)
{
LogError("Transport failed to register device '%s' (singlylinkedlist_add failed)", device->deviceId);
LogError("Transport failed to register device '%s' (singlylinkedlist_add failed)", MU_P_OR_NULL(device->deviceId));
result = NULL;
}
else
@ -2160,18 +2179,18 @@ void IoTHubTransport_AMQP_Common_Unregister(IOTHUB_DEVICE_HANDLE deviceHandle)
}
else if (registered_device->transport_instance == NULL)
{
LogError("Failed to unregister device '%s' (deviceHandle does not have a transport state associated to).", device_id);
LogError("Failed to unregister device '%s' (deviceHandle does not have a transport state associated to).", MU_P_OR_NULL(device_id));
}
else if (!is_device_registered_ex(registered_device->transport_instance->registered_devices, device_id, &list_item))
{
LogError("Failed to unregister device '%s' (device is not registered within this transport).", device_id);
LogError("Failed to unregister device '%s' (device is not registered within this transport).", MU_P_OR_NULL(device_id));
}
else
{
// Removing it first so the race hazard is reduced between this function and DoWork. Best would be to use locks.
if (singlylinkedlist_remove(registered_device->transport_instance->registered_devices, list_item) != RESULT_OK)
{
LogError("Failed to unregister device '%s' (singlylinkedlist_remove failed).", device_id);
LogError("Failed to unregister device '%s' (singlylinkedlist_remove failed).", MU_P_OR_NULL(device_id));
}
else
{
@ -2276,7 +2295,8 @@ IOTHUB_CLIENT_RESULT IoTHubTransport_AMQP_Common_SendMessageDisposition(IOTHUB_D
if (amqp_device_send_message_disposition(amqp_device_instance->device_handle, (DEVICE_MESSAGE_DISPOSITION_INFO*)device_message_disposition_info, device_disposition_result) != RESULT_OK)
{
LogError("Device '%s' failed sending message disposition (amqp_device_send_message_disposition failed)", STRING_c_str(amqp_device_instance->device_id));
const char* device_id = STRING_c_str(amqp_device_instance->device_id); // advoid MU_P_OR_NULL double call
LogError("Device '%s' failed sending message disposition (amqp_device_send_message_disposition failed)", MU_P_OR_NULL(device_id));
result = IOTHUB_CLIENT_ERROR;
}
else

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

@ -1290,10 +1290,10 @@ static void CompareProperties(const IOTHUB_CLIENT_PROPERTY_PARSED* expectedPrope
{
ASSERT_ARE_EQUAL(int, expectedProperty->structVersion, actualProperty->structVersion);
ASSERT_ARE_EQUAL(int, expectedProperty->propertyType, actualProperty->propertyType);
ASSERT_ARE_EQUAL(char_ptr, expectedProperty->componentName, actualProperty->componentName);
ASSERT_ARE_EQUAL(char_ptr, expectedProperty->name, actualProperty->name);
ASSERT_ARE_EQUAL(char_ptr, MU_P_OR_NULL(expectedProperty->componentName), MU_P_OR_NULL(actualProperty->componentName));
ASSERT_ARE_EQUAL(char_ptr, MU_P_OR_NULL(expectedProperty->name), MU_P_OR_NULL(actualProperty->name));
ASSERT_ARE_EQUAL(int, expectedProperty->valueType, actualProperty->valueType);
ASSERT_ARE_EQUAL(char_ptr, expectedProperty->value.str, actualProperty->value.str);
ASSERT_ARE_EQUAL(char_ptr, MU_P_OR_NULL(expectedProperty->value.str), MU_P_OR_NULL(actualProperty->value.str));
ASSERT_ARE_EQUAL(int, expectedProperty->valueLength, actualProperty->valueLength);
}

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

@ -302,7 +302,7 @@ DEVICE_RESULT Device_PublishTransacted_ReportedProperty(REPORTED_PROPERTIES_TRAN
(data == NULL)
)
{
LogError("invalid argument REPORTED_PROPERTIES_TRANSACTION_HANDLE transactionHandle=%p, const char* reportedPropertyPath=%s, const AGENT_DATA_TYPE* data=%p", transactionHandle, reportedPropertyPath, data);
LogError("invalid argument REPORTED_PROPERTIES_TRANSACTION_HANDLE transactionHandle=%p, const char* reportedPropertyPath=%s, const AGENT_DATA_TYPE* data=%p", transactionHandle, MU_P_OR_NULL(reportedPropertyPath), data);
result = DEVICE_INVALID_ARG;
}
else

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

@ -2443,7 +2443,7 @@ bool Schema_ModelReportedPropertyByPathExists(SCHEMA_MODEL_TYPE_HANDLE modelType
if ((modelTypeHandle == NULL) ||
(reportedPropertyPath == NULL))
{
LogError("invalid argument SCHEMA_MODEL_TYPE_HANDLE modelTypeHandle=%p, const char* reportedPropertyPath=%s", modelTypeHandle, reportedPropertyPath);
LogError("invalid argument SCHEMA_MODEL_TYPE_HANDLE modelTypeHandle=%p, const char* reportedPropertyPath=%s", modelTypeHandle, MU_P_OR_NULL(reportedPropertyPath));
result = false;
}
else