diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/stringbuf.c | 2 | ||||
-rw-r--r-- | runtime/var.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/runtime/stringbuf.c b/runtime/stringbuf.c index 93d1e1ef..63b42348 100644 --- a/runtime/stringbuf.c +++ b/runtime/stringbuf.c @@ -820,7 +820,7 @@ rsCStrConvertToNumber(cstr_t *pStr, number_t *pNumber) /* TODO: octal? hex? */ n = 0; while(i < pStr->iStrLen && isdigit(pStr->pBuf[i])) { - n = n * 10 + pStr->pBuf[i] * 10; + n = n * 10 + pStr->pBuf[i] - '0'; ++i; } diff --git a/runtime/var.c b/runtime/var.c index 7e51fc6d..f964874b 100644 --- a/runtime/var.c +++ b/runtime/var.c @@ -327,7 +327,7 @@ ConvForOperation(var_t *pThis, var_t *pOther) case VARTYPE_NUMBER: /* check if we can convert pThis to a number, if so use number format. */ iRet = ConvToNumber(pThis); - if(iRet != RS_RET_NOT_A_NUMBER) { + if(iRet == RS_RET_NOT_A_NUMBER) { CHKiRet(ConvToString(pOther)); } else { FINALIZE; /* OK or error */ @@ -345,7 +345,7 @@ ConvForOperation(var_t *pThis, var_t *pOther) break; case VARTYPE_STR: iRet = ConvToNumber(pOther); - if(iRet != RS_RET_NOT_A_NUMBER) { + if(iRet == RS_RET_NOT_A_NUMBER) { CHKiRet(ConvToString(pThis)); } else { FINALIZE; /* OK or error */ |