Commit dacfbe41 authored by leechul's avatar leechul Committed by Randeep

[IOT-1045] Remove the CborEncoder initialization in security modules to remove compile error.

Related JIRA ticket : https://jira.iotivity.org/browse/IOT-1045

I've modified on the basis of the following :
  1) Does not initialize CborEncoder in all other modules except security modules.
  2) Current initialization can make compile error in some other environment.
     Actually, I can't reproduce this errors in my environment.

[Patch 1] : Intial upload.
[Patch 2] : Update commit message.

Change-Id: I98ff0b7db802605a54f357064fad13e7b3888a4c
Signed-off-by: default avatarleechul <chuls.lee@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/7371Reviewed-by: default avatarKyungsun Cho <goodsun.cho@samsung.com>
Reviewed-by: Randeep's avatarRandeep Singh <randeep.s@samsung.com>
Tested-by: Randeep's avatarRandeep Singh <randeep.s@samsung.com>
parent f615e038
...@@ -141,10 +141,10 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl, uint8_t **payload, siz ...@@ -141,10 +141,10 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl, uint8_t **payload, siz
OCStackResult ret = OC_STACK_ERROR; OCStackResult ret = OC_STACK_ERROR;
CborError cborEncoderResult = CborNoError; CborError cborEncoderResult = CborNoError;
OicSecAcl_t *acl = (OicSecAcl_t *)secAcl; OicSecAcl_t *acl = (OicSecAcl_t *)secAcl;
CborEncoder encoder = { {.ptr = NULL }, .end = 0 }; CborEncoder encoder;
CborEncoder aclMap = { {.ptr = NULL }, .end = 0 }; CborEncoder aclMap;
CborEncoder aclListMap = { {.ptr = NULL }, .end = 0 }; CborEncoder aclListMap;
CborEncoder acesArray = { {.ptr = NULL }, .end = 0 }; CborEncoder acesArray;
uint8_t *outPayload = NULL; uint8_t *outPayload = NULL;
size_t cborLen = *size; size_t cborLen = *size;
*size = 0; *size = 0;
...@@ -181,7 +181,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl, uint8_t **payload, siz ...@@ -181,7 +181,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl, uint8_t **payload, siz
while (acl) while (acl)
{ {
CborEncoder oicSecAclMap = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 }; CborEncoder oicSecAclMap;
// ACL Map size - Number of mandatory items // ACL Map size - Number of mandatory items
uint8_t aclMapSize = ACL_ACES_MAP_SIZE; uint8_t aclMapSize = ACL_ACES_MAP_SIZE;
size_t inLen = 0; size_t inLen = 0;
...@@ -223,7 +223,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl, uint8_t **payload, siz ...@@ -223,7 +223,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl, uint8_t **payload, siz
// Resources // Resources
{ {
CborEncoder resources = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 }; CborEncoder resources;
cborEncoderResult = cbor_encode_text_string(&oicSecAclMap, OIC_JSON_RESOURCES_NAME, cborEncoderResult = cbor_encode_text_string(&oicSecAclMap, OIC_JSON_RESOURCES_NAME,
strlen(OIC_JSON_RESOURCES_NAME)); strlen(OIC_JSON_RESOURCES_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Resource Name Tag."); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Resource Name Tag.");
...@@ -234,7 +234,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl, uint8_t **payload, siz ...@@ -234,7 +234,7 @@ OCStackResult AclToCBORPayload(const OicSecAcl_t *secAcl, uint8_t **payload, siz
for (size_t i = 0; i < acl->resourcesLen; i++) for (size_t i = 0; i < acl->resourcesLen; i++)
{ {
CborEncoder rMap = { {.ptr = NULL }, .end = 0 }; CborEncoder rMap;
cborEncoderResult = cbor_encoder_create_map(&resources, &rMap, ACL_RESOURCE_MAP_SIZE); cborEncoderResult = cbor_encoder_create_map(&resources, &rMap, ACL_RESOURCE_MAP_SIZE);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding Resource Map."); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding Resource Map.");
......
...@@ -100,12 +100,12 @@ OCStackResult AmaclToCBORPayload(const OicSecAmacl_t *amaclS, uint8_t **cborPayl ...@@ -100,12 +100,12 @@ OCStackResult AmaclToCBORPayload(const OicSecAmacl_t *amaclS, uint8_t **cborPayl
*cborSize = 0; *cborSize = 0;
*cborPayload = NULL; *cborPayload = NULL;
CborEncoder encoder = { {.ptr = NULL }, .end = 0 }; CborEncoder encoder;
CborEncoder amaclMap = { {.ptr = NULL }, .end = 0 }; CborEncoder amaclMap;
int64_t cborEncoderResult = CborNoError; int64_t cborEncoderResult = CborNoError;
CborEncoder rsrcMap = { {.ptr = NULL }, .end = 0 }; CborEncoder rsrcMap;
CborEncoder rlistArray = { {.ptr = NULL }, .end = 0 }; CborEncoder rlistArray;
CborEncoder amss = { {.ptr = NULL }, .end = 0 }; CborEncoder amss;
char *stRowner = NULL; char *stRowner = NULL;
const OicSecAmacl_t *amacl = amaclS; const OicSecAmacl_t *amacl = amaclS;
...@@ -138,7 +138,7 @@ OCStackResult AmaclToCBORPayload(const OicSecAmacl_t *amaclS, uint8_t **cborPayl ...@@ -138,7 +138,7 @@ OCStackResult AmaclToCBORPayload(const OicSecAmacl_t *amaclS, uint8_t **cborPayl
for (size_t i = 0; i < amacl->resourcesLen; i++) for (size_t i = 0; i < amacl->resourcesLen; i++)
{ {
// TODO : Need to create rMap structure based on RAML spec. // TODO : Need to create rMap structure based on RAML spec.
CborEncoder rMap = { {.ptr = NULL }, .end = 0 }; CborEncoder rMap;
cborEncoderResult = cbor_encoder_create_map(&rlistArray, &rMap, AMACL_RLIST_MAP_SIZE); cborEncoderResult = cbor_encoder_create_map(&rlistArray, &rMap, AMACL_RLIST_MAP_SIZE);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RLIST Map."); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding RLIST Map.");
......
...@@ -139,9 +139,9 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload ...@@ -139,9 +139,9 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload
*cborSize = 0; *cborSize = 0;
*cborPayload = NULL; *cborPayload = NULL;
const OicSecCred_t *cred = credS; const OicSecCred_t *cred = credS;
CborEncoder encoder = { {.ptr = NULL }, .end = 0 }; CborEncoder encoder;
CborEncoder credArray = { {.ptr = NULL }, .end = 0 }; CborEncoder credArray;
CborEncoder credRootMap = { {.ptr = NULL }, .end = 0 }; CborEncoder credRootMap;
if (0 == cborLen) if (0 == cborLen)
{ {
...@@ -167,7 +167,7 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload ...@@ -167,7 +167,7 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload
while (cred) while (cred)
{ {
CborEncoder credMap = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 }; CborEncoder credMap;
size_t mapSize = CRED_MAP_SIZE; size_t mapSize = CRED_MAP_SIZE;
char *subject = NULL; char *subject = NULL;
if (cred->period) if (cred->period)
...@@ -215,7 +215,7 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload ...@@ -215,7 +215,7 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload
//PublicData -- Not Mandatory //PublicData -- Not Mandatory
if (SIGNED_ASYMMETRIC_KEY == cred->credType && cred->publicData.data) if (SIGNED_ASYMMETRIC_KEY == cred->credType && cred->publicData.data)
{ {
CborEncoder publicMap = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 }; CborEncoder publicMap;
const size_t publicMapSize = 2; const size_t publicMapSize = 2;
cborEncoderResult = cbor_encode_text_string(&credMap, OIC_JSON_PUBLICDATA_NAME, cborEncoderResult = cbor_encode_text_string(&credMap, OIC_JSON_PUBLICDATA_NAME,
...@@ -247,7 +247,7 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload ...@@ -247,7 +247,7 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload
//PrivateData -- Not Mandatory //PrivateData -- Not Mandatory
if(cred->privateData.data) if(cred->privateData.data)
{ {
CborEncoder privateMap = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 }; CborEncoder privateMap;
const size_t privateMapSize = 2; const size_t privateMapSize = 2;
cborEncoderResult = cbor_encode_text_string(&credMap, OIC_JSON_PRIVATEDATA_NAME, cborEncoderResult = cbor_encode_text_string(&credMap, OIC_JSON_PRIVATEDATA_NAME,
......
...@@ -92,8 +92,8 @@ OCStackResult CrlToCBORPayload(const OicSecCrl_t *crl, uint8_t **payload, size_t ...@@ -92,8 +92,8 @@ OCStackResult CrlToCBORPayload(const OicSecCrl_t *crl, uint8_t **payload, size_t
OCStackResult ret = OC_STACK_ERROR; OCStackResult ret = OC_STACK_ERROR;
CborEncoder encoder = { {.ptr = NULL }, .end = 0 }; CborEncoder encoder;
CborEncoder crlMap = { {.ptr = NULL }, .end = 0 }; CborEncoder crlMap;
CborError cborEncoderResult = CborNoError; CborError cborEncoderResult = CborNoError;
......
...@@ -116,8 +116,8 @@ OCStackResult DoxmToCBORPayload(const OicSecDoxm_t *doxm, uint8_t **payload, siz ...@@ -116,8 +116,8 @@ OCStackResult DoxmToCBORPayload(const OicSecDoxm_t *doxm, uint8_t **payload, siz
OCStackResult ret = OC_STACK_ERROR; OCStackResult ret = OC_STACK_ERROR;
CborEncoder encoder = { {.ptr = NULL }, .end = 0 }; CborEncoder encoder;
CborEncoder doxmMap = { {.ptr = NULL }, .end = 0 }; CborEncoder doxmMap;
char* strUuid = NULL; char* strUuid = NULL;
int64_t cborEncoderResult = CborNoError; int64_t cborEncoderResult = CborNoError;
...@@ -141,7 +141,7 @@ OCStackResult DoxmToCBORPayload(const OicSecDoxm_t *doxm, uint8_t **payload, siz ...@@ -141,7 +141,7 @@ OCStackResult DoxmToCBORPayload(const OicSecDoxm_t *doxm, uint8_t **payload, siz
//OxmType -- Not Mandatory //OxmType -- Not Mandatory
if (doxm->oxmTypeLen > 0) if (doxm->oxmTypeLen > 0)
{ {
CborEncoder oxmType = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 }; CborEncoder oxmType;
cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_OXM_TYPE_NAME, cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_OXM_TYPE_NAME,
strlen(OIC_JSON_OXM_TYPE_NAME)); strlen(OIC_JSON_OXM_TYPE_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding oxmType Tag."); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding oxmType Tag.");
...@@ -161,7 +161,7 @@ OCStackResult DoxmToCBORPayload(const OicSecDoxm_t *doxm, uint8_t **payload, siz ...@@ -161,7 +161,7 @@ OCStackResult DoxmToCBORPayload(const OicSecDoxm_t *doxm, uint8_t **payload, siz
//Oxm -- Not Mandatory //Oxm -- Not Mandatory
if (doxm->oxmLen > 0) if (doxm->oxmLen > 0)
{ {
CborEncoder oxm = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 }; CborEncoder oxm;
cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_OXMS_NAME, cborEncoderResult = cbor_encode_text_string(&doxmMap, OIC_JSON_OXMS_NAME,
strlen(OIC_JSON_OXMS_NAME)); strlen(OIC_JSON_OXMS_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding oxmName Tag."); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding oxmName Tag.");
......
...@@ -193,8 +193,8 @@ OCStackResult DpairingToCBORPayload(const OicSecDpairing_t *dpair, uint8_t **pay ...@@ -193,8 +193,8 @@ OCStackResult DpairingToCBORPayload(const OicSecDpairing_t *dpair, uint8_t **pay
OCStackResult ret = OC_STACK_ERROR; OCStackResult ret = OC_STACK_ERROR;
CborEncoder encoder = { {.ptr = NULL }, .end = 0 }; CborEncoder encoder;
CborEncoder dpairMap = { {.ptr = NULL }, .end = 0 }; CborEncoder dpairMap;
int64_t cborEncoderResult = CborNoError; int64_t cborEncoderResult = CborNoError;
uint8_t mapSize = DPAIR_MAP_SIZE; uint8_t mapSize = DPAIR_MAP_SIZE;
......
...@@ -168,8 +168,8 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si ...@@ -168,8 +168,8 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si
*payload = NULL; *payload = NULL;
OCStackResult ret = OC_STACK_ERROR; OCStackResult ret = OC_STACK_ERROR;
CborEncoder encoder = { {.ptr = NULL}, .end = 0}; CborEncoder encoder;
CborEncoder pconfMap = { {.ptr = NULL}, .end = 0}; CborEncoder pconfMap;
int64_t cborEncoderResult = CborNoError; int64_t cborEncoderResult = CborNoError;
uint8_t mapSize = PCONF_MAP_SIZE; uint8_t mapSize = PCONF_MAP_SIZE;
...@@ -204,7 +204,7 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si ...@@ -204,7 +204,7 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si
//PRM type -- Not Mandatory //PRM type -- Not Mandatory
if(pconf->prmLen > 0) if(pconf->prmLen > 0)
{ {
CborEncoder prm = { {.ptr = NULL }, .end = 0 }; CborEncoder prm;
cborEncoderResult = cbor_encode_text_string(&pconfMap, OIC_JSON_PRM_NAME, cborEncoderResult = cbor_encode_text_string(&pconfMap, OIC_JSON_PRM_NAME,
strlen(OIC_JSON_PRM_NAME)); strlen(OIC_JSON_PRM_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Convert Pconf PRM NAME"); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Convert Pconf PRM NAME");
...@@ -231,7 +231,7 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si ...@@ -231,7 +231,7 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si
if (pconf->pdacls) if (pconf->pdacls)
{ {
OicSecPdAcl_t *pdacl = pconf->pdacls; OicSecPdAcl_t *pdacl = pconf->pdacls;
CborEncoder pdAclArray = {{.ptr = NULL }, .end = 0 }; CborEncoder pdAclArray;
cborEncoderResult = cbor_encode_text_string(&pconfMap, OIC_JSON_PDACL_NAME, cborEncoderResult = cbor_encode_text_string(&pconfMap, OIC_JSON_PDACL_NAME,
strlen(OIC_JSON_PDACL_NAME)); strlen(OIC_JSON_PDACL_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to create OIC_JSON_PDACL_NAME"); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to create OIC_JSON_PDACL_NAME");
...@@ -241,7 +241,7 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si ...@@ -241,7 +241,7 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si
while(pdacl) while(pdacl)
{ {
CborEncoder pdAclMap = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 }; CborEncoder pdAclMap;
// PDACL Map size - Number of mandatory items // PDACL Map size - Number of mandatory items
uint8_t aclMapSize = 2; uint8_t aclMapSize = 2;
...@@ -262,14 +262,14 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si ...@@ -262,14 +262,14 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si
strlen(OIC_JSON_RESOURCES_NAME)); strlen(OIC_JSON_RESOURCES_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to encode resource result"); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to encode resource result");
CborEncoder resources = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 }; CborEncoder resources;
cborEncoderResult = cbor_encoder_create_array(&pdAclMap, &resources, cborEncoderResult = cbor_encoder_create_array(&pdAclMap, &resources,
pdacl->resourcesLen); pdacl->resourcesLen);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to create resource array"); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to create resource array");
for (size_t i = 0; i < pdacl->resourcesLen; i++) for (size_t i = 0; i < pdacl->resourcesLen; i++)
{ {
CborEncoder rMap = { {.ptr = NULL }, .end = 0 }; CborEncoder rMap;
cborEncoderResult = cbor_encoder_create_map(&resources, &rMap, cborEncoderResult = cbor_encoder_create_map(&resources, &rMap,
PCONF_RESOURCE_MAP_SIZE); PCONF_RESOURCE_MAP_SIZE);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding Resource Map."); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Addding Resource Map.");
...@@ -325,7 +325,7 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si ...@@ -325,7 +325,7 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si
// Period -- Not Mandatory // Period -- Not Mandatory
if (pdacl->periods) if (pdacl->periods)
{ {
CborEncoder period = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 }; CborEncoder period;
cborEncoderResult = cbor_encode_text_string(&pdAclMap, OIC_JSON_PERIODS_NAME, cborEncoderResult = cbor_encode_text_string(&pdAclMap, OIC_JSON_PERIODS_NAME,
strlen(OIC_JSON_PERIODS_NAME)); strlen(OIC_JSON_PERIODS_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to encode period value"); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to encode period value");
...@@ -346,7 +346,7 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si ...@@ -346,7 +346,7 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si
// Period -- Not Mandatory // Period -- Not Mandatory
if(0 != pdacl->prdRecrLen && pdacl->recurrences) if(0 != pdacl->prdRecrLen && pdacl->recurrences)
{ {
CborEncoder recurrences = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 }; CborEncoder recurrences;
cborEncoderResult = cbor_encode_text_string(&pdAclMap, OIC_JSON_RECURRENCES_NAME, cborEncoderResult = cbor_encode_text_string(&pdAclMap, OIC_JSON_RECURRENCES_NAME,
strlen(OIC_JSON_RECURRENCES_NAME)); strlen(OIC_JSON_RECURRENCES_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult,"Failed to encode recurrences"); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult,"Failed to encode recurrences");
...@@ -377,7 +377,7 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si ...@@ -377,7 +377,7 @@ OCStackResult PconfToCBORPayload(const OicSecPconf_t *pconf,uint8_t **payload,si
//There may not be paired devices if it did not pairing before //There may not be paired devices if it did not pairing before
if (pconf->pddevs && 0 < pconf->pddevLen) if (pconf->pddevs && 0 < pconf->pddevLen)
{ {
CborEncoder pddev = { {.ptr = NULL }, .end = 0, .added = 0, .flags = 0 }; CborEncoder pddev;
cborEncoderResult = cbor_encode_text_string(&pconfMap, OIC_JSON_PDDEV_LIST_NAME, cborEncoderResult = cbor_encode_text_string(&pconfMap, OIC_JSON_PDDEV_LIST_NAME,
strlen(OIC_JSON_PDDEV_LIST_NAME)); strlen(OIC_JSON_PDDEV_LIST_NAME));
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to encode pddev"); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to encode pddev");
......
...@@ -94,8 +94,8 @@ OCStackResult PstatToCBORPayload(const OicSecPstat_t *pstat, uint8_t **payload, ...@@ -94,8 +94,8 @@ OCStackResult PstatToCBORPayload(const OicSecPstat_t *pstat, uint8_t **payload,
OCStackResult ret = OC_STACK_ERROR; OCStackResult ret = OC_STACK_ERROR;
CborEncoder encoder = { {.ptr = NULL }, .end = 0 }; CborEncoder encoder;
CborEncoder pstatMap = { {.ptr = NULL }, .end = 0 }; CborEncoder pstatMap;
char* strUuid = NULL; char* strUuid = NULL;
int64_t cborEncoderResult = CborNoError; int64_t cborEncoderResult = CborNoError;
......
...@@ -94,8 +94,8 @@ OCStackResult SVCToCBORPayload(const OicSecSvc_t *svc, uint8_t **cborPayload, ...@@ -94,8 +94,8 @@ OCStackResult SVCToCBORPayload(const OicSecSvc_t *svc, uint8_t **cborPayload,
int64_t cborEncoderResult = CborNoError; int64_t cborEncoderResult = CborNoError;
OCStackResult ret = OC_STACK_ERROR; OCStackResult ret = OC_STACK_ERROR;
CborEncoder encoder = { {.ptr = NULL }, .end = 0 }; CborEncoder encoder;
CborEncoder svcArray = { {.ptr = NULL }, .end = 0 }; CborEncoder svcArray;
uint8_t *outPayload = (uint8_t *)OICCalloc(1, cborLen); uint8_t *outPayload = (uint8_t *)OICCalloc(1, cborLen);
VERIFY_NON_NULL(TAG, outPayload, ERROR); VERIFY_NON_NULL(TAG, outPayload, ERROR);
...@@ -108,8 +108,8 @@ OCStackResult SVCToCBORPayload(const OicSecSvc_t *svc, uint8_t **cborPayload, ...@@ -108,8 +108,8 @@ OCStackResult SVCToCBORPayload(const OicSecSvc_t *svc, uint8_t **cborPayload,
while (svc) while (svc)
{ {
CborEncoder svcMap = {{.ptr = NULL }, .end = 0 }; CborEncoder svcMap;
CborEncoder owners = {{.ptr = NULL }, .end = 0 }; CborEncoder owners;
cborEncoderResult = cbor_encoder_create_map(&svcArray, &svcMap, SVC_MAP_SIZE); cborEncoderResult = cbor_encoder_create_map(&svcArray, &svcMap, SVC_MAP_SIZE);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to Create SVC Map."); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed to Create SVC Map.");
......
...@@ -89,8 +89,8 @@ OCStackResult VerToCBORPayload(const OicSecVer_t *ver, uint8_t **payload, size_t ...@@ -89,8 +89,8 @@ OCStackResult VerToCBORPayload(const OicSecVer_t *ver, uint8_t **payload, size_t
OCStackResult ret = OC_STACK_ERROR; OCStackResult ret = OC_STACK_ERROR;
CborEncoder encoder = { {.ptr = NULL }, .end = 0 }; CborEncoder encoder;
CborEncoder verMap = { {.ptr = NULL }, .end = 0 }; CborEncoder verMap;
int64_t cborEncoderResult = CborNoError; int64_t cborEncoderResult = CborNoError;
uint8_t mapSize = VER_MAP_SIZE; uint8_t mapSize = VER_MAP_SIZE;
......
...@@ -215,7 +215,7 @@ static void ConvertJsonToCBOR(const char *jsonFileName, const char *cborFileName ...@@ -215,7 +215,7 @@ static void ConvertJsonToCBOR(const char *jsonFileName, const char *cborFileName
DeleteCredList(cred); DeleteCredList(cred);
} }
CborEncoder encoder = { {.ptr = NULL }, .end = 0 }; CborEncoder encoder;
size_t cborSize = aclCborSize + pstatCborSize + doxmCborSize + svcCborSize + credCborSize + amaclCborSize; size_t cborSize = aclCborSize + pstatCborSize + doxmCborSize + svcCborSize + credCborSize + amaclCborSize;
printf("Total Cbor Size : %zd\n", cborSize); printf("Total Cbor Size : %zd\n", cborSize);
...@@ -223,7 +223,7 @@ static void ConvertJsonToCBOR(const char *jsonFileName, const char *cborFileName ...@@ -223,7 +223,7 @@ static void ConvertJsonToCBOR(const char *jsonFileName, const char *cborFileName
uint8_t *outPayload = (uint8_t *)OICCalloc(1, cborSize); uint8_t *outPayload = (uint8_t *)OICCalloc(1, cborSize);
VERIFY_NON_NULL(TAG, outPayload, ERROR); VERIFY_NON_NULL(TAG, outPayload, ERROR);
cbor_encoder_init(&encoder, outPayload, cborSize, 0); cbor_encoder_init(&encoder, outPayload, cborSize, 0);
CborEncoder map = { {.ptr = NULL }, .end = 0 }; CborEncoder map;
CborError cborEncoderResult = cbor_encoder_create_map(&encoder, &map, CborIndefiniteLength); CborError cborEncoderResult = cbor_encoder_create_map(&encoder, &map, CborIndefiniteLength);
VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Creating Main Map."); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Creating Main Map.");
if (aclCborSize > 0) if (aclCborSize > 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment