less horrible constant name
This commit is contained in:
parent
0ec0fca9be
commit
f9fa729d8d
|
@ -274,7 +274,7 @@ static void getByte(int offset) {
|
|||
|
||||
static void setBit(const char *offsetStr, const char *bitStr, const char *valueStr) {
|
||||
int offset = atoi(offsetStr);
|
||||
if (absI(offset) == absI(ERROR_CODE)) {
|
||||
if (absI(offset) == absI(ATOI_ERROR_CODE)) {
|
||||
efiPrintf("invalid offset [%s]", offsetStr);
|
||||
return;
|
||||
}
|
||||
|
@ -282,12 +282,12 @@ static void setBit(const char *offsetStr, const char *bitStr, const char *valueS
|
|||
return;
|
||||
}
|
||||
int bit = atoi(bitStr);
|
||||
if (absI(bit) == absI(ERROR_CODE)) {
|
||||
if (absI(bit) == absI(ATOI_ERROR_CODE)) {
|
||||
efiPrintf("invalid bit [%s]", bitStr);
|
||||
return;
|
||||
}
|
||||
int value = atoi(valueStr);
|
||||
if (absI(value) == absI(ERROR_CODE)) {
|
||||
if (absI(value) == absI(ATOI_ERROR_CODE)) {
|
||||
efiPrintf("invalid value [%s]", valueStr);
|
||||
return;
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ static void getFloat(int offset) {
|
|||
|
||||
static void setFloat(const char *offsetStr, const char *valueStr) {
|
||||
int offset = atoi(offsetStr);
|
||||
if (absI(offset) == absI(ERROR_CODE)) {
|
||||
if (absI(offset) == absI(ATOI_ERROR_CODE)) {
|
||||
efiPrintf("invalid offset [%s]", offsetStr);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -545,7 +545,7 @@ static void setTriggerSimulatorMode(const char *indexStr, const char *modeCode)
|
|||
return;
|
||||
}
|
||||
int mode = atoi(modeCode);
|
||||
if (absI(mode) == ERROR_CODE) {
|
||||
if (absI(mode) == ATOI_ERROR_CODE) {
|
||||
return;
|
||||
}
|
||||
engineConfiguration->triggerSimulatorPinModes[index] = (pin_output_mode_e) mode;
|
||||
|
|
|
@ -148,7 +148,7 @@ static void incLogFileName() {
|
|||
if (result < 5) {
|
||||
data[result] = 0;
|
||||
logFileIndex = maxI(MIN_FILE_INDEX, atoi(data));
|
||||
if (absI(logFileIndex) == ERROR_CODE) {
|
||||
if (absI(logFileIndex) == ATOI_ERROR_CODE) {
|
||||
logFileIndex = MIN_FILE_INDEX;
|
||||
} else {
|
||||
logFileIndex++; // next file would use next file name
|
||||
|
|
|
@ -338,7 +338,7 @@ int handleActionWithParameter(TokenCallback *current, char *argv[], int argc) {
|
|||
int value[2];
|
||||
for (int i = 0; i < 2; i++) {
|
||||
value[i] = atoi(argv[i]);
|
||||
if (absI(value[i]) == ERROR_CODE) {
|
||||
if (absI(value[i]) == ATOI_ERROR_CODE) {
|
||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||
efiPrintf("not an integer [%s]", argv[0]);
|
||||
#endif
|
||||
|
@ -420,7 +420,7 @@ int handleActionWithParameter(TokenCallback *current, char *argv[], int argc) {
|
|||
case INT_FLOAT_PARAMETER:
|
||||
{
|
||||
int value1 = atoi(argv[0]);
|
||||
if (absI(value1) == ERROR_CODE) {
|
||||
if (absI(value1) == ATOI_ERROR_CODE) {
|
||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||
efiPrintf("not an integer [%s]", argv[0]);
|
||||
#endif
|
||||
|
@ -439,7 +439,7 @@ int handleActionWithParameter(TokenCallback *current, char *argv[], int argc) {
|
|||
case ONE_PARAMETER:
|
||||
{
|
||||
int value = atoi(argv[0]);
|
||||
if (absI(value) == ERROR_CODE) {
|
||||
if (absI(value) == ATOI_ERROR_CODE) {
|
||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||
efiPrintf("not an integer [%s]", argv[0]);
|
||||
#endif
|
||||
|
|
|
@ -85,7 +85,7 @@ int atoi(const char *string) {
|
|||
// todo: use stdlib '#include <stdlib.h> '
|
||||
int len = strlen(string);
|
||||
if (len == 0) {
|
||||
return -ERROR_CODE;
|
||||
return -ATOI_ERROR_CODE;
|
||||
}
|
||||
if (string[0] == '-') {
|
||||
return -atoi(string + 1);
|
||||
|
@ -95,7 +95,7 @@ int atoi(const char *string) {
|
|||
for (int i = 0; i < len; i++) {
|
||||
char ch = string[i];
|
||||
if (ch < '0' || ch > '9') {
|
||||
return ERROR_CODE;
|
||||
return ATOI_ERROR_CODE;
|
||||
}
|
||||
int c = ch - '0';
|
||||
result = result * 10 + c;
|
||||
|
@ -214,19 +214,19 @@ float atoff(const char *param) {
|
|||
if (dotIndex == -1) {
|
||||
// just an integer
|
||||
int result = atoi(string);
|
||||
if (absI(result) == ERROR_CODE)
|
||||
if (absI(result) == ATOI_ERROR_CODE)
|
||||
return (float) NAN;
|
||||
return (float) result;
|
||||
}
|
||||
// todo: this needs to be fixed
|
||||
string[dotIndex] = 0;
|
||||
int integerPart = atoi(string);
|
||||
if (absI(integerPart) == ERROR_CODE)
|
||||
if (absI(integerPart) == ATOI_ERROR_CODE)
|
||||
return (float) NAN;
|
||||
string += (dotIndex + 1);
|
||||
int decimalLen = strlen(string);
|
||||
int decimal = atoi(string);
|
||||
if (absI(decimal) == ERROR_CODE)
|
||||
if (absI(decimal) == ATOI_ERROR_CODE)
|
||||
return (float) NAN;
|
||||
float divider = 1.0;
|
||||
// todo: reuse 'pow10' function which we have anyway
|
||||
|
|
|
@ -40,7 +40,7 @@ static inline uint32_t SWAP_UINT32(uint32_t x)
|
|||
// number of microseconds in one period of given frequency (per second)
|
||||
#define frequency2periodUs(freq) ((1000000.0f) / (freq))
|
||||
|
||||
#define ERROR_CODE 311223344
|
||||
#define ATOI_ERROR_CODE 311223344
|
||||
|
||||
#define Q(x) #x
|
||||
#define QUOTE(x) Q(x)
|
||||
|
|
Loading…
Reference in New Issue