Ignore:
Timestamp:
01/17/15 04:15:17 (9 years ago)
Author:
Maciej Komosinski
Message:
  • don't assume getPropCount() is constant while iterating
  • getMinMax() strips trailing space from default string, as specified in f0 formatspec
File:
1 edited

Legend:

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

    r290 r300  
    102102                if (*t)
    103103                        {
    104                         const char* til=strchr(t,'~');
    105                         if (!til)
    106                                 def=SString(t);
    107                         else
    108                                 {
    109                                 while ((til>t)&&(til[-1]==' ')) til--;
    110                                 def=SString(t,til-t);
    111                                 }
     104                        const char* end=strchr(t,'~');
     105                        if (!end)
     106                                end=t+strlen(t);
     107                        while ((end>t)&&(end[-1]==' ')) end--;
     108                        def=SString(t,end-t);
    112109                        }
    113110                return 3;
     
    119116void ParamInterface::setDefault()
    120117{
    121         int n = getPropCount();
    122         for (int i = 0; i < n; i++)
     118        for (int i = 0; i < getPropCount(); i++)
    123119                setDefault(i);
    124120}
     
    126122void ParamInterface::setMin()
    127123{
    128         int n = getPropCount();
    129         for (int i = 0; i < n; i++)
     124        for (int i = 0; i < getPropCount(); i++)
    130125                setMin(i);
    131126}
     
    133128void ParamInterface::setMax()
    134129{
    135         int n = getPropCount();
    136         for (int i = 0; i < n; i++)
     130        for (int i = 0; i < getPropCount(); i++)
    137131                setMax(i);
    138132}
Note: See TracChangeset for help on using the changeset viewer.