More work on aqhome-cgi.
This commit is contained in:
@@ -312,29 +312,10 @@ const char *_readValueAndProbablyRange(const char *s, uint64_t *ptrBitField, int
|
||||
{
|
||||
int v=0;
|
||||
|
||||
if (*s=='#') {
|
||||
while(*s) {
|
||||
unsigned char c;
|
||||
|
||||
c=tolower(*s);
|
||||
if ((c>='0' && c<='9') || (c>='a' && c<='f')) {
|
||||
c-='0';
|
||||
if (c>9)
|
||||
c-=7;
|
||||
v<<=4;
|
||||
v+=c;
|
||||
}
|
||||
else
|
||||
break;
|
||||
s++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
while(isdigit(*s)) {
|
||||
v*=10;
|
||||
v+=(*s)-'0';
|
||||
s++;
|
||||
}
|
||||
while(isdigit(*s)) {
|
||||
v*=10;
|
||||
v+=(*s)-'0';
|
||||
s++;
|
||||
}
|
||||
if (!_valueOkay(v, minValue, maxValue)) {
|
||||
DBG_INFO(NULL, "here");
|
||||
@@ -368,13 +349,35 @@ const char *_readDouble(const char *s, double *ptrDouble)
|
||||
while(*s && isspace(*s))
|
||||
s++;
|
||||
sStart=s;
|
||||
while(*s && (isdigit(*s) || *s=='.' || *s=='+' || *s=='-'))
|
||||
s++;
|
||||
if (*s=='#') {
|
||||
uint32_t v=0;
|
||||
|
||||
rv=GWEN_Text_StringToDouble(sStart, ptrDouble);
|
||||
if (rv<0) {
|
||||
DBG_ERROR(NULL, "Error reading double: %d", rv);
|
||||
return NULL;
|
||||
s++;
|
||||
while(*s) {
|
||||
unsigned char c;
|
||||
|
||||
c=tolower(*s);
|
||||
if ((c>='0' && c<='9') || (c>='a' && c<='f')) {
|
||||
c-='0';
|
||||
if (c>9)
|
||||
c-=7;
|
||||
v<<=4;
|
||||
v+=c;
|
||||
}
|
||||
else
|
||||
break;
|
||||
s++;
|
||||
}
|
||||
*ptrDouble=(double) v;
|
||||
}
|
||||
else {
|
||||
while(*s && (isdigit(*s) || *s=='.' || *s=='+' || *s=='-'))
|
||||
s++;
|
||||
rv=GWEN_Text_StringToDouble(sStart, ptrDouble);
|
||||
if (rv<0) {
|
||||
DBG_ERROR(NULL, "Error reading double: %d", rv);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
|
||||
Reference in New Issue
Block a user