Ignore:
Timestamp:
07/12/15 00:47:33 (9 years ago)
Author:
Maciej Komosinski
Message:

Print messages when unexpected lines are encountered in param/multiparam loaders

File:
1 edited

Legend:

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

    r412 r413  
    400400        bool loaded;
    401401        int fields_loaded = 0;
     402        int unexpected_line = 0;
    402403        if ((i=findId("beforeLoad"))>=0)
    403404                call(i,NULL,NULL);
     
    406407                if (linenum) (*linenum)++;
    407408                const char* t = buf.c_str();
    408                 p0 = t; while ((*p0 == ' ') || (*p0 == '\t')) p0++;
     409                p0 = t; while (isblank(*p0)) p0++;
    409410                if (!*p0) break;
    410                 if (p0[0] == '#') continue;
    411                 p = strchr(p0, ':'); if (!p) continue;
     411                if (p0[0] == '#') { unexpected_line = 0; continue; }
     412                p = strchr(p0, ':');
     413                if (!p)
     414                        {
     415                        switch(unexpected_line)
     416                                {
     417                                case 0:
     418                                        logPrintf("ParamInterface", "load", LOG_WARN, "Ignored unexpected line %s while reading object '%s'",
     419                                          linenum ?
     420                                          SString::sprintf("%d",*linenum).c_str()
     421                                        : SString::sprintf("'%s'", p0).c_str(),
     422                                          getName());
     423                                        break;
     424                                case 1:
     425                                        logPrintf("ParamInterface", "load", LOG_WARN, "The following line(s) were also unexpected and were ignored");
     426                                        break;
     427                                }
     428                        unexpected_line++;
     429                        continue;
     430                        }
     431                unexpected_line = 0;
    412432                p_len = (int)(p - p0);
    413433                loaded = false;
Note: See TracChangeset for help on using the changeset viewer.