]> git.pond.sub.org Git - empserver/commitdiff
Make xundump oops on virtual selectors
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 12 May 2008 09:26:41 +0000 (11:26 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 12 May 2008 09:26:41 +0000 (11:26 +0200)
Commit da8a1dae (v4.3.12) introduced virtual selectors, but neglected
to update xundump.  Xundump can't work for them, because they don't
provide a setter method.

This didn't actually break anything, because all virtual selectors
have flag NSC_EXTRA set, or are in table EF_VERSION, which xundump
refuses to touch.

Make deffld() oops on virtual selector, just to be safe.

include/nsc.h
src/lib/common/xundump.c

index f46ca6ccac7072723143e3ccbc1b11e17c93aed6..405cf46da0c0c9e71ef0fcc38d4050eeb1c78293 100644 (file)
@@ -213,8 +213,10 @@ enum {
  * NP points to the country to use for coordinate translation and
  * access control (null for none), and CTXO is the context object.
  * See struct valstr for details.
+ * Because virtual selectors don't have a setter method, xundump must
+ * be made to ignore them, e.g. by setting NSC_EXTRA.
  * If flag NSC_DEITY is set, only to deities can use this selector.
- * If flag NSC_EXTRA is set, xdump ignores this selector.
+ * If flag NSC_EXTRA is set, xdump and xundump ignore this selector.
  * If flag NSC_CONST is set, the datum can't be changed from its
  * initial value (xundump obeys that).
  * If ca_table is not EF_BAD, the datum refers to that Empire table;
index 1cce54f769810c39d5d0efbb81be29a71176e24f..69914c3377e01b186707bc5177a356d98149fb4c 100644 (file)
@@ -47,6 +47,7 @@
  * - Check each partial table supplies the same rows
  * - Check EFF_CFG tables are dense
  * - Symbolic array indexes
+ * - Option to treat missing and unknown fields as warning, not error
  * TODO, but hardly worth the effort:
  * - Permit reordering of array elements
  */
@@ -352,7 +353,7 @@ deffld(int fldno, char *name, int idx)
     if (res < 0)
        return gripe("Header %s of field %d is %s", name, fldno + 1,
                     res == M_NOTUNIQUE ? "ambiguous" : "unknown");
-    if (ca[res].ca_flags == NSC_EXTRA)
+    if (ca[res].ca_flags == NSC_EXTRA || CANT_HAPPEN(ca[res].ca_get))
        return gripe("Extraneous header %s in field %d", name, fldno + 1);
     if (ca[res].ca_type != NSC_STRINGY && ca[res].ca_len != 0) {
        if (idx < 0)