]> git.pond.sub.org Git - empserver/commitdiff
Fix xdump lost column type on big endian hosts
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 29 Apr 2013 19:23:13 +0000 (21:23 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 8 May 2013 04:57:58 +0000 (06:57 +0200)
Broken in commit 09248d0 (v4.3.8), which changed struct loststr member
lost_type from char to short, but neglected to update the ca_type in
lost_ca[].

On little endian hosts, the selector reads the least significant byte,
with sign extension.  Happens to work, because the type values are all
sufficiently small integers.

On big endian hosts, the selector reads the most signiciant byte,
which is always zero (EF_SECTOR).  Messes up xdump lost badly.  Also
breaks lost * ?type=..., but that's exotic.

src/lib/common/nsc.c
tests/smoke/smoke.out

index bc50dcb1734afee580dc599b854cea4a8d2e9dac..c3c64356552fcbe179676f30d1b8a7a8d702e536 100644 (file)
@@ -487,7 +487,7 @@ struct castr lost_ca[] = {
     {"timestamp", fldoff(lost_timestamp), NSC_TIME, 0, NULL,
      EF_BAD, 0},
     {"owner", fldoff(lost_owner), NSC_NATID, 0, NULL, EF_NATION, 0},
     {"timestamp", fldoff(lost_timestamp), NSC_TIME, 0, NULL,
      EF_BAD, 0},
     {"owner", fldoff(lost_owner), NSC_NATID, 0, NULL, EF_NATION, 0},
-    {"type", fldoff(lost_type), NSC_CHAR, 0, NULL, EF_TABLE, 0},
+    {"type", fldoff(lost_type), NSC_SHORT, 0, NULL, EF_TABLE, 0},
     /* id's ca_table given by type, but can't express that: */
     {"id", fldoff(lost_id), NSC_INT, 0, NULL, EF_BAD, 0},
     {"x", fldoff(lost_x), NSC_XCOORD, 0, NULL, EF_BAD, 0},
     /* id's ca_table given by type, but can't express that: */
     {"id", fldoff(lost_id), NSC_INT, 0, NULL, EF_BAD, 0},
     {"x", fldoff(lost_x), NSC_XCOORD, 0, NULL, EF_BAD, 0},
index 6cc169fa0d65cc843f20d7f57ed982b164f0757f..d6a24673837fdc18e5c397f01d907948d52d2bd8 100644 (file)
@@ -313,7 +313,7 @@ Player 00 Turn 00 starting
 [0:640] Command : XDUMP meta lost 0
 "timestamp" 12 0 0 -1
 "owner" 5 0 0 9
 [0:640] Command : XDUMP meta lost 0
 "timestamp" 12 0 0 -1
 "owner" 5 0 0 9
-"type" 4 0 0 27
+"type" 6 0 0 27
 "id" 8 0 0 -1
 "x" 9 0 0 -1
 "y" 10 0 0 -1
 "id" 8 0 0 -1
 "x" 9 0 0 -1
 "y" 10 0 0 -1
@@ -1202,7 +1202,7 @@ CENSUS                   del dst
 [0:636] Command : XDUMP meta lost 0
 "timestamp" 12 0 0 -1
 "owner" 5 0 0 9
 [0:636] Command : XDUMP meta lost 0
 "timestamp" 12 0 0 -1
 "owner" 5 0 0 9
-"type" 4 0 0 27
+"type" 6 0 0 27
 "id" 8 0 0 -1
 "x" 9 0 0 -1
 "y" 10 0 0 -1
 "id" 8 0 0 -1
 "x" 9 0 0 -1
 "y" 10 0 0 -1