From a5347bccd893516eede5e61ed81659322aca1286 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Wed, 22 Feb 2017 19:31:40 +0100 Subject: [PATCH] csdk: Use OIC_LOG instead of OIC_LOG_V for logging single string This was creating mess with arduino macros (using VA lists). An other patch to come later Change-Id: I9657e11c96e84f375408e732917a275c7c3c1fb0 Signed-off-by: Philippe Coval Reviewed-on: https://gerrit.iotivity.org/gerrit/17439 Tested-by: jenkins-iotivity Reviewed-by: Dan Mihai --- .../csdk/connectivity/src/caconnectivitymanager.c | 14 +++++----- resource/csdk/connectivity/src/caprotocolmessage.c | 8 +++--- .../csdk/connectivity/util/src/cautilinterface.c | 2 +- resource/csdk/resource-directory/src/rd_client.c | 6 ++-- resource/csdk/security/src/directpairing.c | 12 ++++---- resource/csdk/security/src/dpairingresource.c | 4 +-- resource/csdk/security/src/policyengine.c | 2 +- resource/csdk/security/src/secureresourcemanager.c | 6 ++-- resource/csdk/stack/src/ocobserve.c | 2 +- resource/csdk/stack/src/ocresource.c | 32 +++++++++++----------- resource/csdk/stack/src/ocstack.c | 2 +- 11 files changed, 45 insertions(+), 45 deletions(-) diff --git a/resource/csdk/connectivity/src/caconnectivitymanager.c b/resource/csdk/connectivity/src/caconnectivitymanager.c index b2e680c..c7d1dd2 100644 --- a/resource/csdk/connectivity/src/caconnectivitymanager.c +++ b/resource/csdk/connectivity/src/caconnectivitymanager.c @@ -529,7 +529,7 @@ CAResult_t CASelectCipherSuite(const uint16_t cipher, CATransportAdapter_t adapt CAResult_t CAEnableAnonECDHCipherSuite(const bool enable) { - OIC_LOG_V(DEBUG, TAG, "CAEnableAnonECDHCipherSuite"); + OIC_LOG(DEBUG, TAG, "CAEnableAnonECDHCipherSuite"); CAResult_t res = CA_STATUS_FAILED; #if defined(__WITH_DTLS__) || defined(__WITH_TLS__) // TLS_ECDH_ANON_WITH_AES_128_CBC_SHA256 0xFF00 replaces 0xC018 @@ -552,7 +552,7 @@ CAResult_t CAGenerateOwnerPSK(const CAEndpoint_t* endpoint, const uint8_t* provServerDeviceID, const size_t provServerDeviceIDLen, uint8_t* ownerPSK, const size_t ownerPskSize) { - OIC_LOG_V(DEBUG, TAG, "IN : CAGenerateOwnerPSK"); + OIC_LOG(DEBUG, TAG, "IN : CAGenerateOwnerPSK"); CAResult_t res = CA_STATUS_FAILED; #if defined (__WITH_DTLS__) || defined(__WITH_TLS__) //newOwnerLabel and prevOwnerLabe can be NULL @@ -581,13 +581,13 @@ CAResult_t CAGenerateOwnerPSK(const CAEndpoint_t* endpoint, (void)(ownerPskSize); OIC_LOG(ERROR, TAG, "Method not supported"); #endif - OIC_LOG_V(DEBUG, TAG, "OUT : CAGenerateOwnerPSK"); + OIC_LOG(DEBUG, TAG, "OUT : CAGenerateOwnerPSK"); return res; } CAResult_t CAInitiateHandshake(const CAEndpoint_t *endpoint) { - OIC_LOG_V(DEBUG, TAG, "IN : CAInitiateHandshake"); + OIC_LOG(DEBUG, TAG, "IN : CAInitiateHandshake"); CAResult_t res = CA_STATUS_FAILED; #if defined (__WITH_DTLS__) || defined(__WITH_TLS__) if (!endpoint) @@ -604,13 +604,13 @@ CAResult_t CAInitiateHandshake(const CAEndpoint_t *endpoint) (void)(endpoint); // prevent unused-parameter compiler warning OIC_LOG(ERROR, TAG, "Method not supported"); #endif - OIC_LOG_V(DEBUG, TAG, "OUT : CAInitiateHandshake"); + OIC_LOG(DEBUG, TAG, "OUT : CAInitiateHandshake"); return res; } CAResult_t CAcloseSslSession(const CAEndpoint_t *endpoint) { - OIC_LOG_V(DEBUG, TAG, "IN : CAcloseSslSession"); + OIC_LOG(DEBUG, TAG, "IN : CAcloseSslSession"); CAResult_t res = CA_STATUS_FAILED; #if defined (__WITH_DTLS__) || defined(__WITH_TLS__) if (!endpoint) @@ -627,7 +627,7 @@ CAResult_t CAcloseSslSession(const CAEndpoint_t *endpoint) (void)(endpoint); // prevent unused-parameter compiler warning OIC_LOG(ERROR, TAG, "Method not supported"); #endif - OIC_LOG_V(DEBUG, TAG, "OUT : CAcloseSslSession"); + OIC_LOG(DEBUG, TAG, "OUT : CAcloseSslSession"); return res; } diff --git a/resource/csdk/connectivity/src/caprotocolmessage.c b/resource/csdk/connectivity/src/caprotocolmessage.c index 71c093e..c06c58a 100644 --- a/resource/csdk/connectivity/src/caprotocolmessage.c +++ b/resource/csdk/connectivity/src/caprotocolmessage.c @@ -894,7 +894,7 @@ CAResult_t CAGetInfoFromPDU(const coap_pdu_t *pdu, const CAEndpoint_t *endpoint, else { outInfo->payloadFormat = CA_FORMAT_UNSUPPORTED; - OIC_LOG_V(DEBUG, TAG, "option has an unsupported format"); + OIC_LOG(DEBUG, TAG, "option has an unsupported format"); } } else if (COAP_OPTION_CONTENT_VERSION == opt_iter.type) @@ -905,7 +905,7 @@ CAResult_t CAGetInfoFromPDU(const coap_pdu_t *pdu, const CAEndpoint_t *endpoint, } else { - OIC_LOG_V(DEBUG, TAG, "unsupported content version"); + OIC_LOG(DEBUG, TAG, "unsupported content version"); outInfo->payloadVersion = DEFAULT_CONTENT_VERSION_VALUE; } @@ -918,7 +918,7 @@ CAResult_t CAGetInfoFromPDU(const coap_pdu_t *pdu, const CAEndpoint_t *endpoint, } else { - OIC_LOG_V(DEBUG, TAG, "unsupported accept version"); + OIC_LOG(DEBUG, TAG, "unsupported accept version"); outInfo->acceptVersion = DEFAULT_ACCEPT_VERSION_VALUE; } } @@ -936,7 +936,7 @@ CAResult_t CAGetInfoFromPDU(const coap_pdu_t *pdu, const CAEndpoint_t *endpoint, else { outInfo->acceptFormat = CA_FORMAT_UNSUPPORTED; - OIC_LOG_V(DEBUG, TAG, "option has an unsupported accept format"); + OIC_LOG(DEBUG, TAG, "option has an unsupported accept format"); } } else if (COAP_OPTION_URI_PORT == opt_iter.type || diff --git a/resource/csdk/connectivity/util/src/cautilinterface.c b/resource/csdk/connectivity/util/src/cautilinterface.c index 4cdefe4..d76b112 100644 --- a/resource/csdk/connectivity/util/src/cautilinterface.c +++ b/resource/csdk/connectivity/util/src/cautilinterface.c @@ -373,7 +373,7 @@ CAResult_t CAUtilStopLEAdvertising() CAResult_t CAUtilSetBTConfigure(CAUtilConfig_t config) { - OIC_LOG_V(DEBUG, TAG, "CAUtilSetConfigure"); + OIC_LOG(DEBUG, TAG, "CAUtilSetConfigure"); #if (defined(__ANDROID__) && defined(LE_ADAPTER)) OIC_LOG_V(DEBUG, TAG, "bleFlag [%d]", config.bleFlags); CAManagerSetConfigure(config); diff --git a/resource/csdk/resource-directory/src/rd_client.c b/resource/csdk/resource-directory/src/rd_client.c index 26b3fe9..730819c 100644 --- a/resource/csdk/resource-directory/src/rd_client.c +++ b/resource/csdk/resource-directory/src/rd_client.c @@ -75,7 +75,7 @@ OCStackApplicationResult RDPublishCallback(void *ctx, OCRepPayload *rdPayload = (OCRepPayload *) clientResponse->payload; if (!OCRepPayloadGetPropObjectArray(rdPayload, OC_RSRVD_LINKS, &links, dimensions)) { - OIC_LOG_V(DEBUG, TAG, "No links in publish response"); + OIC_LOG(DEBUG, TAG, "No links in publish response"); goto exit; } for(size_t i = 0; i < dimensions[0]; i++) @@ -83,7 +83,7 @@ OCStackApplicationResult RDPublishCallback(void *ctx, char *uri = NULL; if (!OCRepPayloadGetPropString(links[i], OC_RSRVD_HREF, &uri)) { - OIC_LOG_V(ERROR, TAG, "Missing 'href' in publish response"); + OIC_LOG(ERROR, TAG, "Missing 'href' in publish response"); goto next; } OCResourceHandle handle = OCGetResourceHandleAtUri(uri); @@ -95,7 +95,7 @@ OCStackApplicationResult RDPublishCallback(void *ctx, int64_t ins = 0; if (!OCRepPayloadGetPropInt(links[i], OC_RSRVD_INS, &ins)) { - OIC_LOG_V(ERROR, TAG, "Missing 'ins' in publish response"); + OIC_LOG(ERROR, TAG, "Missing 'ins' in publish response"); goto next; } OCBindResourceInsToResource(handle, ins); diff --git a/resource/csdk/security/src/directpairing.c b/resource/csdk/security/src/directpairing.c index 3de8981..4c00338 100644 --- a/resource/csdk/security/src/directpairing.c +++ b/resource/csdk/security/src/directpairing.c @@ -341,7 +341,7 @@ void DPDeleteLists() static OCStackApplicationResult DirectPairingFinalizeHandler(void *ctx, OCDoHandle UNUSED, OCClientResponse *clientResponse) { - OIC_LOG_V(INFO, TAG, "IN DirectPairingFinalizeHandler()"); + OIC_LOG(INFO, TAG, "IN DirectPairingFinalizeHandler()"); (void)UNUSED; if(NULL == ctx) { @@ -524,7 +524,7 @@ OCStackResult FinalizeDirectPairing(void *ctx, OCDirectPairingDev_t* peer, */ void DirectPairingDTLSHandshakeCB(const CAEndpoint_t *endpoint, const CAErrorInfo_t *info) { - OIC_LOG_V(INFO, TAG, "IN DirectPairingDTLSHandshakeCB"); + OIC_LOG(INFO, TAG, "IN DirectPairingDTLSHandshakeCB"); if(g_dp_proceed_ctx && g_dp_proceed_ctx->peer && endpoint && info) @@ -572,11 +572,11 @@ void DirectPairingDTLSHandshakeCB(const CAEndpoint_t *endpoint, const CAErrorInf } else { - OIC_LOG_V(INFO, TAG, "DirectPairingDTLSHandshakeCB - Not matched to peer address"); + OIC_LOG(INFO, TAG, "DirectPairingDTLSHandshakeCB - Not matched to peer address"); } } - OIC_LOG_V(INFO, TAG, "OUT DirectPairingDTLSHandshakeCB"); + OIC_LOG(INFO, TAG, "OUT DirectPairingDTLSHandshakeCB"); } /** @@ -591,7 +591,7 @@ void DirectPairingDTLSHandshakeCB(const CAEndpoint_t *endpoint, const CAErrorInf static OCStackApplicationResult DirectPairingHandler(void *ctx, OCDoHandle UNUSED, OCClientResponse *clientResponse) { - OIC_LOG_V(INFO, TAG, "IN DirectPairingHandler."); + OIC_LOG(INFO, TAG, "IN DirectPairingHandler."); (void)UNUSED; if(NULL == ctx) { @@ -677,7 +677,7 @@ exit: resultCallback(dpairData->userCtx, dpairData->peer, res); } - OIC_LOG_V(INFO, TAG, "OUT DirectPairingHandler."); + OIC_LOG(INFO, TAG, "OUT DirectPairingHandler."); return OC_STACK_DELETE_TRANSACTION; } diff --git a/resource/csdk/security/src/dpairingresource.c b/resource/csdk/security/src/dpairingresource.c index ada1de3..4b5ed5a 100644 --- a/resource/csdk/security/src/dpairingresource.c +++ b/resource/csdk/security/src/dpairingresource.c @@ -366,7 +366,7 @@ exit: */ void DPairingDTLSHandshakeCB(const CAEndpoint_t *endpoint, const CAErrorInfo_t *info) { - OIC_LOG_V(INFO, TAG, "IN DPairingDTLSHandshakeCB"); + OIC_LOG(INFO, TAG, "IN DPairingDTLSHandshakeCB"); if(gDpair && endpoint && info) { @@ -391,7 +391,7 @@ void DPairingDTLSHandshakeCB(const CAEndpoint_t *endpoint, const CAErrorInfo_t * RemoveCredential(&gDpair->pdeviceID); } - OIC_LOG_V(INFO, TAG, "OUT DPairingDTLSHandshakeCB"); + OIC_LOG(INFO, TAG, "OUT DPairingDTLSHandshakeCB"); } static OCEntityHandlerResult HandleDpairingPostRequest (const OCEntityHandlerRequest * ehRequest) diff --git a/resource/csdk/security/src/policyengine.c b/resource/csdk/security/src/policyengine.c index b0582ec..e5cc060 100644 --- a/resource/csdk/security/src/policyengine.c +++ b/resource/csdk/security/src/policyengine.c @@ -499,7 +499,7 @@ void CheckPermission(SRMRequestContext_t *context) bool isDeviceOwned = true; // default to value that will NOT grant access if (OC_STACK_OK != GetDoxmIsOwned(&isDeviceOwned)) // if runtime error, don't grant { - OIC_LOG_V(ERROR, TAG, "GetDoxmIsOwned() call failed."); + OIC_LOG(ERROR, TAG, "GetDoxmIsOwned() call failed."); context->responseVal = ACCESS_DENIED_POLICY_ENGINE_ERROR; } // If we were able to get the value of doxm->isOwned, proceed with diff --git a/resource/csdk/security/src/secureresourcemanager.c b/resource/csdk/security/src/secureresourcemanager.c index 037a22e..e60e2ec 100644 --- a/resource/csdk/security/src/secureresourcemanager.c +++ b/resource/csdk/security/src/secureresourcemanager.c @@ -79,12 +79,12 @@ static void SRMSendResponse(SRMRequestContext_t *context) if (CA_STATUS_OK == CASendResponse(context->endPoint, &(context->responseInfo))) { - OIC_LOG_V(DEBUG, TAG, "SRM response sent."); + OIC_LOG(DEBUG, TAG, "SRM response sent."); context->responseSent = true; } else { - OIC_LOG_V(ERROR, TAG, "SRM response failed."); + OIC_LOG(ERROR, TAG, "SRM response failed."); } } else @@ -152,7 +152,7 @@ void SetResourceUriAndType(SRMRequestContext_t *context) } if (MAX_URI_LENGTH < position || 0 > position) { - OIC_LOG_V(ERROR, TAG, "Incorrect URI length."); + OIC_LOG(ERROR, TAG, "Incorrect URI length."); return; } OICStrcpyPartial(context->resourceUri, MAX_URI_LENGTH + 1, diff --git a/resource/csdk/stack/src/ocobserve.c b/resource/csdk/stack/src/ocobserve.c index 3520953..82cfd2a 100644 --- a/resource/csdk/stack/src/ocobserve.c +++ b/resource/csdk/stack/src/ocobserve.c @@ -349,7 +349,7 @@ OCStackResult GenerateObserverId (OCObservationId *observationId) { if (!OCGetRandomBytes((uint8_t*)observationId, sizeof(OCObservationId))) { - OIC_LOG_V(ERROR, TAG, "Failed to generate random observationId"); + OIC_LOG(ERROR, TAG, "Failed to generate random observationId"); goto exit; } diff --git a/resource/csdk/stack/src/ocresource.c b/resource/csdk/stack/src/ocresource.c index 6840fa9..9120d0b 100755 --- a/resource/csdk/stack/src/ocresource.c +++ b/resource/csdk/stack/src/ocresource.c @@ -149,7 +149,7 @@ OCStackResult ExtractFiltersFromQuery(const char *query, char **filterOne, char { if (!query) { - OIC_LOG_V(ERROR, TAG, "Query is empty!"); + OIC_LOG(ERROR, TAG, "Query is empty!"); return OC_STACK_INVALID_QUERY; } char *key = NULL; @@ -165,7 +165,7 @@ OCStackResult ExtractFiltersFromQuery(const char *query, char **filterOne, char queryDup = OICStrdup(query); if (NULL == queryDup) { - OIC_LOG_V(ERROR, TAG, "Creating duplicate string failed!"); + OIC_LOG(ERROR, TAG, "Creating duplicate string failed!"); return OC_STACK_NO_MEMORY; } @@ -217,7 +217,7 @@ OCStackResult ExtractFiltersFromQuery(const char *query, char **filterOne, char *filterOne = OICStrdup(*filterOne); if (NULL == *filterOne) { - OIC_LOG_V(ERROR, TAG, "Creating duplicate string failed!"); + OIC_LOG(ERROR, TAG, "Creating duplicate string failed!"); eCode = OC_STACK_NO_MEMORY; goto exit; } @@ -228,7 +228,7 @@ OCStackResult ExtractFiltersFromQuery(const char *query, char **filterOne, char *filterTwo = OICStrdup(*filterTwo); if (NULL == *filterTwo) { - OIC_LOG_V(ERROR, TAG, "Creating duplicate string failed!"); + OIC_LOG(ERROR, TAG, "Creating duplicate string failed!"); OICFree(*filterOne); eCode = OC_STACK_NO_MEMORY; goto exit; @@ -614,32 +614,32 @@ OCRepPayload *BuildUrlInfoWithProtocol(const char *protocol) OCRepPayload *urlInfoPayload = OCRepPayloadCreate(); if (!urlInfoPayload) { - OIC_LOG_V(ERROR, TAG, "Failed to create a new RepPayload"); + OIC_LOG(ERROR, TAG, "Failed to create a new RepPayload"); result = OC_STACK_NO_MEMORY; goto exit; } if (!OCRepPayloadSetPropString(urlInfoPayload, OC_RSRVD_INTROSPECTION_URL, OC_RSRVD_INTROSPECTION_PAYLOAD_URI)) { - OIC_LOG_V(ERROR, TAG, "Failed to add url"); + OIC_LOG(ERROR, TAG, "Failed to add url"); result = OC_STACK_ERROR; goto exit; } if (!OCRepPayloadSetPropString(urlInfoPayload, OC_RSRVD_INTROSPECTION_PROTOCOL, protocol)) { - OIC_LOG_V(ERROR, TAG, "Failed to add protocol"); + OIC_LOG(ERROR, TAG, "Failed to add protocol"); result = OC_STACK_ERROR; goto exit; } if (!OCRepPayloadSetPropString(urlInfoPayload, OC_RSRVD_INTROSPECTION_CONTENT_TYPE, OC_RSRVD_INTROSPECTION_CONTENT_TYPE_VALUE)) { - OIC_LOG_V(ERROR, TAG, "Failed to add content type"); + OIC_LOG(ERROR, TAG, "Failed to add content type"); result = OC_STACK_ERROR; goto exit; } if (!OCRepPayloadSetPropInt(urlInfoPayload, OC_RSRVD_INTROSPECTION_VERSION, OC_RSRVD_INTROSPECTION_VERSION_VALUE)) { - OIC_LOG_V(ERROR, TAG, "Failed to add version"); + OIC_LOG(ERROR, TAG, "Failed to add version"); result = OC_STACK_ERROR; goto exit; } @@ -731,7 +731,7 @@ OCStackResult BuildIntrospectionResponseRepresentation(const OCResource *resourc if (!OCRepPayloadSetUri(tempPayload, resourcePtr->uri)) { - OIC_LOG_V(ERROR, TAG, "Failed to set payload URI"); + OIC_LOG(ERROR, TAG, "Failed to set payload URI"); ret = OC_STACK_ERROR; goto exit; } @@ -741,7 +741,7 @@ OCStackResult BuildIntrospectionResponseRepresentation(const OCResource *resourc { if (!OCRepPayloadAddResourceType(tempPayload, resType->resourcetypename)) { - OIC_LOG_V(ERROR, TAG, "Failed at add resource type"); + OIC_LOG(ERROR, TAG, "Failed at add resource type"); ret = OC_STACK_ERROR; goto exit; } @@ -753,7 +753,7 @@ OCStackResult BuildIntrospectionResponseRepresentation(const OCResource *resourc { if (!OCRepPayloadAddInterface(tempPayload, resInterface->name)) { - OIC_LOG_V(ERROR, TAG, "Failed to add interface"); + OIC_LOG(ERROR, TAG, "Failed to add interface"); ret = OC_STACK_ERROR; goto exit; } @@ -761,7 +761,7 @@ OCStackResult BuildIntrospectionResponseRepresentation(const OCResource *resourc } if (!OCRepPayloadSetPropString(tempPayload, OC_RSRVD_INTROSPECTION_NAME, OC_RSRVD_INTROSPECTION_NAME_VALUE)) { - OIC_LOG_V(ERROR, TAG, "Failed to set Name property."); + OIC_LOG(ERROR, TAG, "Failed to set Name property."); ret = OC_STACK_ERROR; goto exit; } @@ -835,7 +835,7 @@ OCStackResult BuildIntrospectionResponseRepresentation(const OCResource *resourc urlInfoPayload[i] = BuildUrlInfoWithProtocol(proto->value); if (!urlInfoPayload[i]) { - OIC_LOG_V(ERROR, TAG, "Unable to build urlInfo object for protocol"); + OIC_LOG(ERROR, TAG, "Unable to build urlInfo object for protocol"); ret = OC_STACK_ERROR; goto exit; } @@ -847,14 +847,14 @@ OCStackResult BuildIntrospectionResponseRepresentation(const OCResource *resourc urlInfoPayload, dimensions)) { - OIC_LOG_V(ERROR, TAG, "Unable to add urlInfo object to introspection payload "); + OIC_LOG(ERROR, TAG, "Unable to add urlInfo object to introspection payload "); ret = OC_STACK_ERROR; goto exit; } } else { - OIC_LOG_V(ERROR, TAG, "Unable to allocate memory for urlInfo "); + OIC_LOG(ERROR, TAG, "Unable to allocate memory for urlInfo "); ret = OC_STACK_NO_MEMORY; goto exit; } diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c index db9da9f..b68af17 100644 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -2298,7 +2298,7 @@ void OCHandleRequests(const CAEndpoint_t* endPoint, const CARequestInfo_t* reque if (requestResult == OC_STACK_RESOURCE_ERROR && serverRequest.observationOption == OC_OBSERVE_REGISTER) { - OIC_LOG_V(ERROR, TAG, "Observe Registration failed due to resource error"); + OIC_LOG(ERROR, TAG, "Observe Registration failed due to resource error"); } else if (!OCResultToSuccess(requestResult)) { -- 2.7.4