Ignore:
Timestamp:
12/31/16 20:35:12 (7 years ago)
Author:
Maciej Komosinski
Message:

f0 is strict now, will not accept float when int is expected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/param/param.cpp

    r640 r645  
    574574}
    575575
    576 int ParamInterface::setInt(int i, const char* str)
     576int ParamInterface::setInt(int i, const char* str, bool strict)
    577577{
    578578        paInt value;
    579         if (!ExtValue::parseInt(str, value, false, true))
     579        if (!ExtValue::parseInt(str, value, strict, true))
    580580        {
    581581                paInt mn, mx, def;
     
    645645}
    646646
    647 int ParamInterface::set(int i, const char *v)
     647int ParamInterface::set(int i, const char *v, bool strict)
    648648{
    649649        char typ = type(i)[0];
    650650        switch (typ)
    651651        {
    652         case 'd': return setInt(i, v);
     652        case 'd': return setInt(i, v, strict);
    653653        case 'f': return setDouble(i, v);
    654654        case 's': { SString t(v); return setString(i, t); }
     
    745745        {
    746746        case 'd': t+="integer";
    747         {paInt a,b,c; int n=getMinMax(type,a,b,c); if (n>=2) t+=SString::sprintf(" %d..%d",a,b); if (n>=3) t+=SString::sprintf(" (default %d)",c);}
     747        {paInt a,b,c; int n=getMinMax(type,a,b,c); if ((n>=2)&&(b>=a)) t+=SString::sprintf(" %d..%d",a,b); if (n>=3) t+=SString::sprintf(" (default %d)",c);}
    748748        break;
    749749        case 'f': t+="float";
    750         {double a,b,c; int n=getMinMax(type,a,b,c); if (n>=2) t+=SString::sprintf(" %g..%g",a,b); if (n>=3) t+=SString::sprintf(" (default %g)",c);}
     750        {double a,b,c; int n=getMinMax(type,a,b,c); if ((n>=2)&&(b>=a)) t+=SString::sprintf(" %g..%g",a,b); if (n>=3) t+=SString::sprintf(" (default %g)",c);}
    751751        break;
    752752        case 's': t+="string";
     
    12021202                        remember = *valstop;
    12031203                        *(char*)valstop = 0;
    1204                         ret = set(i, value);
     1204                        ret = set(i, value, true);
    12051205                        fields_loaded++;
    12061206                        if (ret&(PSET_HITMAX | PSET_HITMIN))
Note: See TracChangeset for help on using the changeset viewer.