Commit 06fb83ab authored by Gábor Szalai's avatar Gábor Szalai
Browse files

Remove leading zero warning from str2float (bug 566028)



The standard explicitly allow the leading zero for str2float
Leading zero warning is not needed as it is allowed.

C.1.29  Character string to float
str2float(in charstring invalue) return float This function
converts a charstring comprising a number into a float value.
The format of the number in the charstring shall follow rules
in clause 6.1.0, items a) or b) with the following exceptions:

leading zeros are allowed;

EXAMPLE:

str2float("12345.6") // is the same as str2float("123.456E+02")

Change-Id: Ia3a81017b234dae493cd33ccc4ce3ea124727be2
Signed-off-by: Gábor Szalai's avatarGabor Szalai <gabor.szalai@ericsson.com>
parent 06f872c1
......@@ -16,6 +16,7 @@
* Raduly, Csaba
* Szabo, Bence Janos
* Szabo, Janos Zoltan – initial implementation
* Szalai, Gabor
* Zalanyi, Balazs Andor
*
******************************************************************************/
......@@ -1261,7 +1262,6 @@ double str2float(const CHARSTRING& value)
size_t end = value_len;
boolean leading_ws = FALSE;
boolean trailing_ws = FALSE;
boolean leading_zero = FALSE;
double ret_val;
while (is_whitespace(value_str[start])) {
leading_ws = TRUE;
......@@ -1321,7 +1321,6 @@ double str2float(const CHARSTRING& value)
if (c == '.') state = S_FIRST_F;
else if (c == 'E' || c == 'e') state = S_INITIAL_E;
else if (c >= '0' && c <= '9') {
leading_zero = TRUE;
state = S_MORE_M;
} else state = S_ERR;
break;
......@@ -1353,7 +1352,6 @@ double str2float(const CHARSTRING& value)
break;
case S_ZERO_E:
if (c >= '0' && c <= '9') {
leading_zero = TRUE;
state = S_MORE_E;
}
else state = S_ERR;
......@@ -1405,13 +1403,6 @@ double str2float(const CHARSTRING& value)
TTCN_Logger::log_char('.');
TTCN_warning_end();
}
if (leading_zero) {
TTCN_warning_begin("Leading zero digit was detected in the argument "
"of function str2float(): ");
value.log();
TTCN_Logger::log_char('.');
TTCN_warning_end();
}
if (trailing_ws) {
TTCN_warning_begin("Trailing whitespace was detected in the argument "
"of function str2float(): ");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment