Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: LCD_DISCO_F429ZI mbed BSP_DISCO_F429ZI
Revision 6:06ff453bb16e, committed 2020-05-22
- Comitter:
- matis755
- Date:
- Fri May 22 07:30:59 2020 +0000
- Parent:
- 5:3c19c3ae6286
- Child:
- 7:34a9bd9d3093
- Commit message:
- Use standard C functions
Changed in this revision
| decoder.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/decoder.cpp Fri May 22 07:21:44 2020 +0000
+++ b/decoder.cpp Fri May 22 07:30:59 2020 +0000
@@ -19,29 +19,7 @@
if(pcString[ucCharCounter] == cOldChar) pcString[ucCharCounter] = cNewChar;
}
}
-
-
-
-enum Result Decoder::eHexStringToUInt(char pcStr[],unsigned int *puiValue){
-
- unsigned char ucCharCounter;
-
- if((pcStr[0] != '0') | (pcStr[1] != 'x') | (pcStr[2] == '\0'))
- return NOK;
- *puiValue = 0;
- for(ucCharCounter=2;ucCharCounter<7;ucCharCounter++){
- if(pcStr[ucCharCounter] == '\0')
- return OK;
- *puiValue = *puiValue << 4;
- if(pcStr[ucCharCounter] >= 'A')
- *puiValue = *puiValue | (pcStr[ucCharCounter] - 'A' + 10);
- else
- *puiValue = *puiValue | (pcStr[ucCharCounter] - '0');
- }
- return OK;
-}
-
-
+
unsigned char Decoder::ucFindTokensInString(char *pcString){
unsigned char ucTokenPointer;
@@ -98,7 +76,10 @@
for(ucTokenCounter=0;ucTokenCounter<ucTokenCnt;ucTokenCounter++){
tValue = &asToken[ucTokenCounter];
if (eStringToKeyword(tValue->uValue.pcString,&tValue->uValue.eKeyword) == OK) tValue->eType = KEYWORD;
- else if (eHexStringToUInt(tValue->uValue.pcString,&tValue->uValue.uiNumber) == OK) tValue->eType = NUMBER;
+ else if ((int)strtol(tValue->uValue.pcString, NULL, 0)) {
+ tValue->uValue.uiNumber = (int)strtol(tValue->uValue.pcString, NULL, 0);
+ tValue->eType = NUMBER;
+ }
else tValue->eType = STRING;
}
}