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

Commit

Permalink
Fix issues on esp8266 arch for mqtt.
Browse files Browse the repository at this point in the history
  • Loading branch information
yaohaizh committed Dec 6, 2016
1 parent 8e29208 commit 4f295e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
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

0 comments on commit 4f295e2

Please sign in to comment.