Skip to content
This repository was archived by the owner on Jul 22, 2022. It is now read-only.

Fix issues on esp8266 arch for mqtt. #32

Merged
merged 1 commit into from
Dec 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/sdk/iothubtransport_mqtt_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,9 @@ static int parse_device_twin_topic_info(const char* resp_topic, bool* patch_msg,
return result;
}


#define TOUPPER(c) (((c>='a') && (c<='z'))?c-'a'+'A':c)

static IOTHUB_IDENTITY_TYPE retrieve_topic_type(const char* topic_resp)
{
IOTHUB_IDENTITY_TYPE type;
Expand Down Expand Up @@ -710,7 +713,7 @@ static IOTHUB_IDENTITY_TYPE retrieve_topic_type(const char* topic_resp)
{
break;
}
else if (toupper(TOPIC_DEVICE_TWIN_PREFIX[index]) != toupper(topic_resp[index]))
else if (TOUPPER(TOPIC_DEVICE_TWIN_PREFIX[index]) != TOUPPER(topic_resp[index]))
{
search_device_twin = false;
}
Expand All @@ -728,7 +731,7 @@ static IOTHUB_IDENTITY_TYPE retrieve_topic_type(const char* topic_resp)
{
break;
}
else if (toupper(TOPIC_DEVICE_METHOD_PREFIX[index]) != toupper(topic_resp[index]))
else if (TOUPPER(TOPIC_DEVICE_METHOD_PREFIX[index]) != TOUPPER(topic_resp[index]))
{
search_device_method = false;
}
Expand Down
10 changes: 6 additions & 4 deletions src/sdk/jsondecoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ static JSON_DECODER_RESULT ParseString(PARSER_STATE* parserState, char** stringB
return result;
}

#define ISDIGIT(c) (((c>='0') && (c<='9'))?1:0)

static JSON_DECODER_RESULT ParseNumber(PARSER_STATE* parserState)
{
JSON_DECODER_RESULT result = JSON_DECODER_OK;
Expand All @@ -126,7 +128,7 @@ static JSON_DECODER_RESULT ParseNumber(PARSER_STATE* parserState)
while (*(parserState->json) != '\0')
{
/* Codes_SRS_JSON_DECODER_99_044:[ Octal and hex forms are not allowed.] */
if (isdigit(*(parserState->json)))
if (ISDIGIT(*(parserState->json)))
{
digitCount++;
/* simply continue */
Expand Down Expand Up @@ -158,7 +160,7 @@ static JSON_DECODER_RESULT ParseNumber(PARSER_STATE* parserState)
while (*(parserState->json) != '\0')
{
/* Codes_SRS_JSON_DECODER_99_044:[ Octal and hex forms are not allowed.] */
if (isdigit(*(parserState->json)))
if (ISDIGIT(*(parserState->json)))
{
digitCount++;
/* simply continue */
Expand Down Expand Up @@ -195,7 +197,7 @@ static JSON_DECODER_RESULT ParseNumber(PARSER_STATE* parserState)
while (*(parserState->json) != '\0')
{
/* Codes_SRS_JSON_DECODER_99_044:[ Octal and hex forms are not allowed.] */
if (isdigit(*(parserState->json)))
if (ISDIGIT(*(parserState->json)))
{
digitCount++;
/* simply continue */
Expand Down Expand Up @@ -263,7 +265,7 @@ static JSON_DECODER_RESULT ParseValue(PARSER_STATE* parserState, MULTITREE_HANDL
}
else if (
(
isdigit(*(parserState->json))
ISDIGIT(*(parserState->json))
)
|| (*(parserState->json) == '-'))
{
Expand Down