]> git.pond.sub.org Git - empserver/commitdiff
Fix xdump trade column type on big endian hosts
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 29 Apr 2013 19:24:51 +0000 (21:24 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 8 May 2013 04:57:58 +0000 (06:57 +0200)
Broken in commit 14ea670 (v4.3.8), which changed struct trdstr member
trd_type from char to short, but neglected to update the ca_type in
trade_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 trade badly.

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

index c3c64356552fcbe179676f30d1b8a7a8d702e536..0178e822cb43125e1b4b7b0ceb90bfa58063266a 100644 (file)
@@ -523,7 +523,7 @@ struct castr trade_ca[] = {
     {"timestamp", fldoff(trd_timestamp), NSC_TIME, 0, NULL,
      EF_BAD, NSC_EXTRA},
     {"owner", fldoff(trd_owner), NSC_NATID, 0, NULL, EF_NATION, 0},
-    {"type", fldoff(trd_type), NSC_CHAR, 0, NULL, EF_TABLE, 0},
+    {"type", fldoff(trd_type), NSC_SHORT, 0, NULL, EF_TABLE, 0},
     /* unitid's ca_table given by type, but can't express that: */
     {"unitid", fldoff(trd_unitid), NSC_INT, 0, NULL, EF_BAD, 0},
     {"price", fldoff(trd_price), NSC_INT, 0, NULL, EF_BAD, 0},
index d6a24673837fdc18e5c397f01d907948d52d2bd8..d1df77f86a7e392c46f4db2553e8de1ba4886711 100644 (file)
@@ -240,7 +240,7 @@ Player 00 Turn 00 starting
 [0:640] Command : XDUMP meta trade 0
 "uid" 8 0 0 7
 "owner" 5 0 0 9
-"type" 4 0 0 27
+"type" 6 0 0 27
 "unitid" 8 0 0 -1
 "price" 8 0 0 -1
 "maxbidder" 8 0 0 9
@@ -1161,7 +1161,7 @@ CENSUS                   del dst
 [0:636] Command : XDUMP meta trade 0
 "uid" 8 0 0 7
 "owner" 5 0 0 9
-"type" 4 0 0 27
+"type" 6 0 0 27
 "unitid" 8 0 0 -1
 "price" 8 0 0 -1
 "maxbidder" 8 0 0 9