Commit d14a9e2f authored by Oleksandr Dmytrenko's avatar Oleksandr Dmytrenko

windows build fix

windows build fix

Change-Id: I455130b66d0d1a5ddaf5342726463039e233348c
Signed-off-by: default avatarOleksandr Dmytrenko <o.dmytrenko@samsung.com>
parent 15f62487
......@@ -335,10 +335,9 @@ do {
#define LL_APPEND2(head,add,next) \
do { \
LDECLTYPE(head) _tmp; \
(add)->next=NULL; \
if (head) { \
_tmp = (head); \
LDECLTYPE(head) _tmp = (head); \
while (_tmp->next) { _tmp = _tmp->next; } \
_tmp->next=(add); \
} else { \
......
......@@ -246,18 +246,44 @@ OCStackResult OC_CALL SetDeviceIdSeed(const uint8_t* seed, size_t seedSize);
/**
* cbor default init
*/
#define OC_DEFAULT_CBOR_VALUE {.parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0}
#ifndef OC_DEFAULT_CBOR_VALUE
# if (__STDC_VERSION__ >= 199901L)
# define OC_DEFAULT_CBOR_VALUE {.parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0}
# else
# define OC_DEFAULT_CBOR_VALUE {NULL, NULL, 0, 0, 0, 0}
# endif
#endif
#define OC_DEFAULT_CBOR_PARSER {.end = NULL, .flags = 0}
#ifndef OC_DEFAULT_CBOR_PARSER
# if (__STDC_VERSION__ >= 199901L)
# define OC_DEFAULT_CBOR_PARSER {.end = NULL, .flags = 0}
# else
# define OC_DEFAULT_CBOR_PARSER {NULL, 0}
# endif
#endif
#define OC_DEFAULT_OICPARSEQUWRYITER \
{ \
.attrPos = NULL,\
.attrLen = 0,\
.valPos = NULL,\
.valLen = 0,\
.pi = {.n=0,.separator=NULL,.delim=NULL,.dlen=0,.pos=NULL,.segment_length=0}\
}
#ifndef OC_DEFAULT_OICPARSEQUWRYITER
# if (__STDC_VERSION__ >= 199901L)
# define OC_DEFAULT_OICPARSEQUWRYITER \
{ \
.attrPos = NULL,\
.attrLen = 0,\
.valPos = NULL,\
.valLen = 0,\
.pi = {.n=0,.separator=NULL,.delim=NULL,.dlen=0,.pos=NULL,.segment_length=0}\
}
# else
# define OC_DEFAULT_OICPARSEQUWRYITER { NULL, 0, NULL, 0, {0,NULL,NULL,0,NULL,0}}
# endif
#endif
#ifndef OC_DEFAULT_OICUUID
# if (__STDC_VERSION__ >= 199901L)
# define OC_DEFAULT_OICUUID {.id= { 0 } }
# else
# define OC_DEFAULT_OICUUID {{ 0 }}
# endif
#endif
/**
* Is the URI for a Security Virtual Resource as defined
......
......@@ -1442,9 +1442,9 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
return NULL;
}
OCStackResult ret = OC_STACK_ERROR;
CborValue aclMap = { .parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0 };
CborValue aclCbor = OC_DEFAULT_CBOR_VALUE ;
CborParser parser = OC_DEFAULT_CBOR_PARSER ;
CborValue aclMap = OC_DEFAULT_CBOR_VALUE;
CborValue aclCbor = OC_DEFAULT_CBOR_VALUE;
CborParser parser = OC_DEFAULT_CBOR_PARSER;
CborError cborFindResult = CborNoError;
char *tagName = NULL;
char *subjectTag = NULL;
......@@ -1519,7 +1519,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
}
}
CborValue aclistMap = { .parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0 };
CborValue aclistMap = OC_DEFAULT_CBOR_VALUE;
if (aclistTagJustFound && OIC_SEC_ACL_V1 == aclistVersion)
{
aclistTagJustFound = false; // don't enter this check a second time
......@@ -1572,7 +1572,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
while (cbor_value_is_valid(&aclistMap) && !aclistMapDone)
{
// Enter ACES Array
CborValue acesArray = { .parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0 };
CborValue acesArray = OC_DEFAULT_CBOR_VALUE;
cborFindResult = cbor_value_enter_container(&aclistMap, &acesArray);
VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering ACES Array.");
OIC_LOG_V(DEBUG, TAG, "%s entered ace object array.", __func__);
......@@ -1583,7 +1583,7 @@ static OicSecAcl_t* CBORPayloadToAclVersionOpt(const uint8_t *cborPayload, const
while (cbor_value_is_valid(&acesArray))
{
acesCount++;
CborValue aceMap = { .parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0 };
CborValue aceMap = OC_DEFAULT_CBOR_VALUE;
cborFindResult = cbor_value_enter_container(&acesArray, &aceMap);
VERIFY_CBOR_SUCCESS_OR_OUT_OF_MEMORY(TAG, cborFindResult, "Failed Entering ACE Map.");
OIC_LOG_V(DEBUG, TAG, "%s entered %s map.", __func__,
......@@ -2805,9 +2805,7 @@ static OCEntityHandlerResult HandleACLGetRequest(const OCEntityHandlerRequest *e
uint8_t* payload = NULL;
size_t size = 0;
OCEntityHandlerResult ehRet;
OicUuid_t subject = {.id= { 0 } };
OicUuid_t subject = OC_DEFAULT_OICUUID;
// In case, 'subject' field is included in REST request.
if (ehRequest->query && GetSubjectFromQueryString(ehRequest->query, &subject))
......@@ -3142,7 +3140,7 @@ static OCEntityHandlerResult HandleACLDeleteRequest(const OCEntityHandlerRequest
{
OIC_LOG(DEBUG, TAG, "Processing ACLDeleteRequest");
OCEntityHandlerResult ehRet = OC_EH_ERROR;
OicUuid_t subject = { .id= { 0 } };
OicUuid_t subject = OC_DEFAULT_OICUUID;
AceIdList_t *aceIdList = NULL;
char resource[MAX_URI_LENGTH] = { 0 };
......@@ -3309,7 +3307,7 @@ OCStackResult SetDefaultACL(OicSecAcl_t *acl)
OCStackResult GetDefaultACL(OicSecAcl_t** defaultAcl)
{
OCStackResult ret = OC_STACK_ERROR;
OicUuid_t ownerId = { .id = { 0 } };
OicUuid_t ownerId = OC_DEFAULT_OICUUID;
OicSecAcl_t *acl = NULL;
OicSecAce_t *readOnlyAceAnon = NULL;
OicSecAce_t *readOnlyAceAuth = NULL;
......@@ -4033,7 +4031,7 @@ OCStackResult SetAclRownerId(const OicUuid_t* newROwner)
OCStackResult ret = OC_STACK_ERROR;
uint8_t *cborPayload = NULL;
size_t size = 0;
OicUuid_t prevId = {.id={0}};
OicUuid_t prevId = OC_DEFAULT_OICUUID;
if(NULL == newROwner)
{
......
......@@ -86,14 +86,14 @@ static OicSecDoxm_t gDefaultDoxm =
OIC_RANDOM_DEVICE_PIN, /* uint16_t oxmSel */
SYMMETRIC_PAIR_WISE_KEY | SIGNED_ASYMMETRIC_KEY, /* OicSecCredType_t sct */
false, /* bool owned */
{.id = {0}}, /* OicUuid_t deviceID */
OC_DEFAULT_OICUUID, /* OicUuid_t deviceID */
false, /* bool dpc */
{.id = {0}}, /* OicUuid_t owner */
OC_DEFAULT_OICUUID, /* OicUuid_t owner */
#ifdef MULTIPLE_OWNER
NULL, /* OicSecSubOwner_t sub-owner list */
NULL, /* OicSecMomType_t multiple owner mode */
#endif //MULTIPLE_OWNER
{.id = {0}}, /* OicUuid_t rownerID */
OC_DEFAULT_OICUUID, /* OicUuid_t rownerID */
};
#define R PERMISSION_READ
......@@ -892,7 +892,7 @@ static bool ValidateQuery(const char * query)
if (strncasecmp((char *)parseIter.attrPos, OIC_JSON_DEVICE_ID_NAME, parseIter.attrLen) == 0)
{
bDeviceIDQry = true;
OicUuid_t subject = {.id={0}};
OicUuid_t subject = OC_DEFAULT_OICUUID;
if (sizeof(subject.id) < parseIter.valLen)
{
......@@ -1366,7 +1366,7 @@ OCEntityHandlerResult StartOTMJustWorks(OCEntityHandlerRequest *ehRequest)
{
uint8_t preMutualVerifNum[OWNER_PSK_LENGTH_128] = {0};
uint8_t mutualVerifNum[MUTUAL_VERIF_NUM_LEN] = {0};
OicUuid_t deviceID = {.id = {0}};
OicUuid_t deviceID = OC_DEFAULT_OICUUID;
//Generate mutualVerifNum
OCServerRequest * request = (OCServerRequest *)ehRequest->requestHandle;
......@@ -1906,7 +1906,7 @@ OCStackResult InitDoxmResource(void)
//In case of the server is shut down unintentionally, we should initialize the owner
if(gDoxm && (false == gDoxm->owned))
{
OicUuid_t emptyUuid = {.id={0}};
OicUuid_t emptyUuid = OC_DEFAULT_OICUUID;
memcpy(&gDoxm->owner, &emptyUuid, sizeof(OicUuid_t));
}
......
......@@ -916,7 +916,7 @@ OCStackResult OC_CALL OCGetUuidFromCSR(const char* csr, OicUuid_t* uuid)
{
dnSize += 512;
p = (char*)OICRealloc(dnStr, dnSize);
if (p == dnStr)
if (p == NULL)
{
OIC_LOG_V(ERROR, TAG, "%s: allocate", __func__);
goto exit;
......
......@@ -236,7 +236,13 @@ OCStackResult OC_CALL OCAssertRoles(void *ctx, const OCDevAddr *devAddr, OCAsser
}
OIC_LOG_V(DEBUG, TAG, "Query=%s", query);
OCCallbackData cbData = { .context = NULL,.cb = NULL,.cd = NULL };
OCCallbackData cbData = {
# if (__STDC_VERSION__ >= 199901L)
.context = NULL,.cb = NULL,.cd = NULL
# else
NULL,NULL,NULL
# endif
};
cbData.cb = &OCAssertRolesCBHandler;
AssertRolesData_t *assertRolesData = (AssertRolesData_t *)OICCalloc(1, sizeof(AssertRolesData_t));
if (assertRolesData == NULL)
......
......@@ -64,7 +64,7 @@ static OicSecPstat_t gDefaultPstat =
1, // the number of elts in Sms
&gSm, // OicSecDpom_t *sm
0, // uint16_t commitHash
{.id = {0}}, // OicUuid_t rowneruuid
OC_DEFAULT_OICUUID, // OicUuid_t rowneruuid
};
static OicSecPstat_t *gPstat = NULL;
......@@ -1071,7 +1071,7 @@ bool IsPstatRowneruuidTheNilUuid(void)
OCStackResult SetPstatRownerId(const OicUuid_t *rowneruuid)
{
OCStackResult ret = OC_STACK_OK;
OicUuid_t prevId = {.id={0}};
OicUuid_t prevId = OC_DEFAULT_OICUUID;
VERIFY_NOT_NULL_RETURN(TAG, rowneruuid, ERROR, OC_STACK_INVALID_PARAM);
VERIFY_NOT_NULL_RETURN(TAG, gPstat, ERROR, OC_STACK_NO_RESOURCE);
......
......@@ -195,8 +195,7 @@ const char * MF_TRUST_CA = "oic.sec.cred.mfgtrustca";
const char * MF_PRIMARY_CERT = "oic.sec.cred.mfgcert";
OicUuid_t WILDCARD_SUBJECT_ID = {"*"};
OicUuid_t WILDCARD_SUBJECT_B64_ID = { .id = {'2', '2', '2', '2', '2', '2', '2', '2',
'2', '2', '2', '2', '2', '2', '2', '2' }};
OicUuid_t WILDCARD_SUBJECT_B64_ID = {{'2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2'}};
size_t WILDCARD_SUBJECT_ID_LEN = 1;
const char * WILDCARD_RESOURCE_URI = "*";
......
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