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

Commit 32af3b6

Browse files
authored
Merge pull request #32 from yaohaizh/master
Fix issues on esp8266 arch for mqtt.
2 parents 5819964 + 4f295e2 commit 32af3b6

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/sdk/iothubtransport_mqtt_common.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,9 @@ static int parse_device_twin_topic_info(const char* resp_topic, bool* patch_msg,
679679
return result;
680680
}
681681

682+
683+
#define TOUPPER(c) (((c>='a') && (c<='z'))?c-'a'+'A':c)
684+
682685
static IOTHUB_IDENTITY_TYPE retrieve_topic_type(const char* topic_resp)
683686
{
684687
IOTHUB_IDENTITY_TYPE type;
@@ -710,7 +713,7 @@ static IOTHUB_IDENTITY_TYPE retrieve_topic_type(const char* topic_resp)
710713
{
711714
break;
712715
}
713-
else if (toupper(TOPIC_DEVICE_TWIN_PREFIX[index]) != toupper(topic_resp[index]))
716+
else if (TOUPPER(TOPIC_DEVICE_TWIN_PREFIX[index]) != TOUPPER(topic_resp[index]))
714717
{
715718
search_device_twin = false;
716719
}
@@ -728,7 +731,7 @@ static IOTHUB_IDENTITY_TYPE retrieve_topic_type(const char* topic_resp)
728731
{
729732
break;
730733
}
731-
else if (toupper(TOPIC_DEVICE_METHOD_PREFIX[index]) != toupper(topic_resp[index]))
734+
else if (TOUPPER(TOPIC_DEVICE_METHOD_PREFIX[index]) != TOUPPER(topic_resp[index]))
732735
{
733736
search_device_method = false;
734737
}

src/sdk/jsondecoder.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ static JSON_DECODER_RESULT ParseString(PARSER_STATE* parserState, char** stringB
112112
return result;
113113
}
114114

115+
#define ISDIGIT(c) (((c>='0') && (c<='9'))?1:0)
116+
115117
static JSON_DECODER_RESULT ParseNumber(PARSER_STATE* parserState)
116118
{
117119
JSON_DECODER_RESULT result = JSON_DECODER_OK;
@@ -126,7 +128,7 @@ static JSON_DECODER_RESULT ParseNumber(PARSER_STATE* parserState)
126128
while (*(parserState->json) != '\0')
127129
{
128130
/* Codes_SRS_JSON_DECODER_99_044:[ Octal and hex forms are not allowed.] */
129-
if (isdigit(*(parserState->json)))
131+
if (ISDIGIT(*(parserState->json)))
130132
{
131133
digitCount++;
132134
/* simply continue */
@@ -158,7 +160,7 @@ static JSON_DECODER_RESULT ParseNumber(PARSER_STATE* parserState)
158160
while (*(parserState->json) != '\0')
159161
{
160162
/* Codes_SRS_JSON_DECODER_99_044:[ Octal and hex forms are not allowed.] */
161-
if (isdigit(*(parserState->json)))
163+
if (ISDIGIT(*(parserState->json)))
162164
{
163165
digitCount++;
164166
/* simply continue */
@@ -195,7 +197,7 @@ static JSON_DECODER_RESULT ParseNumber(PARSER_STATE* parserState)
195197
while (*(parserState->json) != '\0')
196198
{
197199
/* Codes_SRS_JSON_DECODER_99_044:[ Octal and hex forms are not allowed.] */
198-
if (isdigit(*(parserState->json)))
200+
if (ISDIGIT(*(parserState->json)))
199201
{
200202
digitCount++;
201203
/* simply continue */
@@ -263,7 +265,7 @@ static JSON_DECODER_RESULT ParseValue(PARSER_STATE* parserState, MULTITREE_HANDL
263265
}
264266
else if (
265267
(
266-
isdigit(*(parserState->json))
268+
ISDIGIT(*(parserState->json))
267269
)
268270
|| (*(parserState->json) == '-'))
269271
{

0 commit comments

Comments
 (0)