Jan Breuer
2015-11-13 b5e8e4dc2bdeca39195a78d8d7f01bd7f099923c
Resolve #65: Cast char to unsigned in isctype functions
1个文件已修改
18 ■■■■ 已修改文件
libscpi/src/lexer.c 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/src/lexer.c
@@ -189,7 +189,7 @@
 * @return 
 */
static int skipDigit(lex_state_t * state) {
    if (!iseos(state) && isdigit(state->pos[0])) {
    if (!iseos(state) && isdigit((uint8_t)(state->pos[0]))) {
        state->pos++;
        return SKIP_OK;
    } else {
@@ -204,7 +204,7 @@
 */
static int skipNumbers(lex_state_t * state) {
    int someNumbers = 0;
    while (!iseos(state) && isdigit(state->pos[0])) {
    while (!iseos(state) && isdigit((uint8_t)(state->pos[0]))) {
        state->pos++;
        someNumbers++;
    }
@@ -232,7 +232,7 @@
 */
static int skipAlpha(lex_state_t * state) {
    int someLetters = 0;
    while (!iseos(state) && isalpha(state->pos[0])) {
    while (!iseos(state) && isalpha((uint8_t)(state->pos[0]))) {
        state->pos++;
        someLetters++;
    }
@@ -305,9 +305,9 @@
 */
static int skipProgramMnemonic(lex_state_t * state) {
    const char * startPos = state->pos;
    if (!iseos(state) && isalpha(state->pos[0])) {
    if (!iseos(state) && isalpha((uint8_t)(state->pos[0]))) {
        state->pos++;
        while (!iseos(state) && (isalnum(state->pos[0]) || ischr(state, '_'))) {
        while (!iseos(state) && (isalnum((uint8_t)(state->pos[0])) || ischr(state, '_'))) {
            state->pos++;
        }
    }
@@ -451,9 +451,9 @@
int scpiLex_CharacterProgramData(lex_state_t * state, scpi_token_t * token) {
    token->ptr = state->pos;
    if (!iseos(state) && isalpha(state->pos[0])) {
    if (!iseos(state) && isalpha((uint8_t)(state->pos[0]))) {
        state->pos++;
        while (!iseos(state) && (isalnum(state->pos[0]) || ischr(state, '_'))) {
        while (!iseos(state) && (isalnum((uint8_t)(state->pos[0])) || ischr(state, '_'))) {
            state->pos++;
        }
    }
@@ -562,7 +562,7 @@
/* 7.7.4 <NONDECIMAL NUMERIC PROGRAM DATA> */
static int skipHexNum(lex_state_t * state) {
    int someNumbers = 0;
    while (!iseos(state) && isxdigit(state->pos[0])) {
    while (!iseos(state) && isxdigit((uint8_t)(state->pos[0]))) {
        state->pos++;
        someNumbers++;
    }
@@ -728,7 +728,7 @@
            state->pos++;
            for (; i > 0; i--) {
                if (!iseos(state) && isdigit(state->pos[0])) {
                if (!iseos(state) && isdigit((uint8_t)(state->pos[0]))) {
                    arbitraryBlockLength *= 10;
                    arbitraryBlockLength += (state->pos[0] - '0');
                    state->pos++;