Changeset 334 for cpp


Ignore:
Timestamp:
03/01/15 01:41:23 (10 years ago)
Author:
Maciej Komosinski
Message:

More specific error messages on failed deserialization (and the resulting value becomes null)

Location:
cpp/frams
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/_demos/loader_test_param.in

    r329 r334  
    5454x2:@Serialized:[[100,^1],["abc"],[300,^2]]
    5555i3:5
     56
     57#invalid serialization examples ahead
     58data:
     59# ^3 references the object occuring after the reference - only back references are allowed (here: ^0=whole object or ^1=[1,2,3])
     60x1:@Serialized:[[1,2,3],^3,[3,2,1]]
     61# whitespaces are not allowed (except before numeric types, as a side effect of "whitespace+number" being valid number)
     62x2:@Serialized:[1, 2, "3", { "key" : "value" }]
  • cpp/frams/param/param.cpp

    r333 r334  
    604604                        after = e.deserialize(v + strlen(SERIALIZATION_PREFIX));
    605605                        if ((after == NULL) || (*after))
     606                                {
    606607                                FMprintf("ParamInterface", "set", FMLV_WARN, "serialization format mismatch in %s.%s", (getName() ? getName() : "<Unknown>"), id(i));
     608                                e.setEmpty();
     609                                }
    607610                }
    608611                else if ((after = e.parseNumber(v)) && (*after == 0)) //consumed the whole string
Note: See TracChangeset for help on using the changeset viewer.