Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] Re: inexplicable generate_packets error
Home

[Freeciv-Dev] Re: inexplicable generate_packets error

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: inexplicable generate_packets error
From: Jason Dorje Short <jdorje@xxxxxxxxxxxx>
Date: Mon, 26 Apr 2004 14:25:38 -0400

Raimar Falke wrote:

The type dataio type "string" is hardcoded.

So I see.  It takes this patch to make the change fully.

I think the patch is the wrong direction. There just should not be two
string types.

Perhaps. But the current method of put_conv_callback/get_conv_callback is broken because it converts all strings, including those which shouldn't be converted. This can break the GTK client if the network charset is not a superset of ASCII (which probably never happens).

So the alternative is to make these conversions manually for ALL relevant packet fields. This can be done either when sending/receiving the packets or when writing/reading data from the GUI. Either will take many times more code.

And realize these string types are fundamentally different. Someday the TEXT packets could use UTF-16. But the ASCII packets will always be ascii.

jason
Index: client/clinet.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/clinet.c,v
retrieving revision 1.96
diff -u -r1.96 clinet.c
--- client/clinet.c     13 Apr 2004 16:40:00 -0000      1.96
+++ client/clinet.c     26 Apr 2004 18:01:41 -0000
@@ -812,12 +812,12 @@
     if (type != SERVER_LAN_VERSION) {
       return lan_servers;
     }
-    dio_get_string(&din, servername, sizeof(servername));
-    dio_get_string(&din, port, sizeof(port));
-    dio_get_string(&din, version, sizeof(version));
-    dio_get_string(&din, status, sizeof(status));
-    dio_get_string(&din, players, sizeof(players));
-    dio_get_string(&din, metastring, sizeof(metastring));
+    dio_get_ascii_string(&din, servername, sizeof(servername));
+    dio_get_ascii_string(&din, port, sizeof(port));
+    dio_get_ascii_string(&din, version, sizeof(version));
+    dio_get_ascii_string(&din, status, sizeof(status));
+    dio_get_ascii_string(&din, players, sizeof(players));
+    dio_get_ascii_string(&din, metastring, sizeof(metastring));
 
     if (!mystrcasecmp("none", servername)) {
       from = gethostbyaddr((char *) &fromend.sockaddr_in.sin_addr,
Index: common/dataio.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/dataio.c,v
retrieving revision 1.10
diff -u -r1.10 dataio.c
--- common/dataio.c     14 Feb 2004 02:21:25 -0000      1.10
+++ common/dataio.c     26 Apr 2004 18:01:41 -0000
@@ -317,7 +317,15 @@
 /**************************************************************************
 ...
 **************************************************************************/
-void dio_put_string(struct data_out *dout, const char *value)
+void dio_put_ascii_string(struct data_out *dout, const char *value)
+{
+  dio_put_memory(dout, value, strlen(value) + 1);
+}
+
+/**************************************************************************
+...
+**************************************************************************/
+void dio_put_text_string(struct data_out *dout, const char *value)
 {
   if (put_conv_callback) {
     size_t length;
@@ -546,7 +554,46 @@
 /**************************************************************************
 ...
 **************************************************************************/
-void dio_get_string(struct data_in *din, char *dest, size_t max_dest_size)
+void dio_get_ascii_string(struct data_in *din,
+                         char *dest, size_t max_dest_size)
+{
+  unsigned char *c;
+  size_t ps_len;               /* length in packet, not including null */
+  size_t offset, remaining;
+
+  assert(max_dest_size > 0 || dest == NULL);
+
+  if (!enough_data(din, 1)) {
+    dest[0] = '\0';
+    return;
+  }
+
+  remaining = dio_input_remaining(din);
+  c = ADD_TO_POINTER(din->src, din->current);
+
+  /* avoid using strlen (or strcpy) on an (unsigned char*)  --dwp */
+  for (offset = 0; c[offset] != '\0' && offset < remaining; offset++) {
+    /* nothing */
+  }
+
+  if (offset >= remaining) {
+    ps_len = remaining;
+    din->too_short = TRUE;
+    din->bad_string = TRUE;
+  } else {
+    ps_len = offset;
+  }
+
+  if (!din->too_short) {
+    din->current += (ps_len + 1);      /* past terminator */
+  }
+}
+
+/**************************************************************************
+...
+**************************************************************************/
+void dio_get_text_string(struct data_in *din,
+                        char *dest, size_t max_dest_size)
 {
   unsigned char *c;
   size_t ps_len;               /* length in packet, not including null */
Index: common/dataio.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/dataio.h,v
retrieving revision 1.5
diff -u -r1.5 dataio.h
--- common/dataio.h     10 Apr 2004 03:47:49 -0000      1.5
+++ common/dataio.h     26 Apr 2004 18:01:41 -0000
@@ -65,7 +65,10 @@
 void dio_get_bool8(struct data_in *din, bool *dest);
 void dio_get_bool32(struct data_in *din, bool *dest);
 void dio_get_memory(struct data_in *din, void *dest, size_t dest_size);
-void dio_get_string(struct data_in *din, char *dest, size_t max_dest_size);
+void dio_get_ascii_string(struct data_in *din,
+                         char *dest, size_t max_dest_size);
+void dio_get_text_string(struct data_in *din,
+                        char *dest, size_t max_dest_size);
 void dio_get_bit_string(struct data_in *din, char *dest,
                        size_t max_dest_size);
 void dio_get_city_map(struct data_in *din, char *dest, size_t max_dest_size);
@@ -94,7 +97,8 @@
 void dio_put_bool32(struct data_out *dout, bool value);
 
 void dio_put_memory(struct data_out *dout, const void *value, size_t size);
-void dio_put_string(struct data_out *dout, const char *value);
+void dio_put_ascii_string(struct data_out *dout, const char *value);
+void dio_put_text_string(struct data_out *dout, const char *value);
 void dio_put_bit_string(struct data_out *dout, const char *value);
 void dio_put_city_map(struct data_out *dout, const char *value);
 void dio_put_tech_list(struct data_out *dout, const int *value);
Index: common/generate_packets.py
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/generate_packets.py,v
retrieving revision 1.10
diff -u -r1.10 generate_packets.py
--- common/generate_packets.py  7 Apr 2004 21:12:43 -0000       1.10
+++ common/generate_packets.py  26 Apr 2004 18:01:41 -0000
@@ -218,7 +218,7 @@
         return result
 
     def get_handle_type(self,const=0):
-        if self.dataio_type=="string":
+        if self.dataio_type in ["ascii_string","text_string"]:
             if const: return "const char *"
             else:     return "char *"
             
@@ -245,7 +245,7 @@
             return "  copy_worklist(&real_packet->%(name)s, 
%(name)s);"%self.__dict__
         if self.is_array==0:
             return "  real_packet->%(name)s = %(name)s;"%self.__dict__
-        if self.dataio_type=="string":
+        if self.dataio_type in ["ascii_string", "text_string"]:
             return "  sz_strlcpy(real_packet->%(name)s, 
%(name)s);"%self.__dict__
         if self.is_array==1:
             tmp="real_packet->%(name)s[i] = %(name)s[i]"%self.__dict__
@@ -266,14 +266,14 @@
             return "  differ = (memcmp(old->%(name)s, real_packet->%(name)s, 
%(array_size_d)s) != 0);"%self.__dict__
         if self.dataio_type=="bitvector":
             return "  differ = !BV_ARE_EQUAL(old->%(name)s, 
real_packet->%(name)s);"%self.__dict__
-        if self.dataio_type in ["string","bit_string"] and self.is_array==1:
+        if self.dataio_type in ["ascii_string","text_string","bit_string"] and 
self.is_array==1:
             return "  differ = (strcmp(old->%(name)s, real_packet->%(name)s) 
!= 0);"%self.__dict__
         if self.is_struct and self.is_array==0:
             return "  differ = !are_%(dataio_type)ss_equal(&old->%(name)s, 
&real_packet->%(name)s);"%self.__dict__
         if not self.is_array:
             return "  differ = (old->%(name)s != 
real_packet->%(name)s);"%self.__dict__
         
-        if self.dataio_type=="string":
+        if self.dataio_type in ["ascii_string","text_string"]:
             c="strcmp(old->%(name)s[i], real_packet->%(name)s[i]) != 
0"%self.__dict__
             array_size_u=self.array_size1_u
             array_size_o=self.array_size1_o
@@ -349,13 +349,13 @@
         if self.dataio_type in ["memory"]:
             return "  dio_put_%(dataio_type)s(&dout, &real_packet->%(name)s, 
%(array_size_u)s);"%self.__dict__
         
-        arr_types=["string","bit_string","city_map","tech_list"]
+        
arr_types=["ascii_string","text_string","bit_string","city_map","tech_list"]
         if (self.dataio_type in arr_types and self.is_array==1) or \
            (self.dataio_type not in arr_types and self.is_array==0):
             return "  dio_put_%(dataio_type)s(&dout, 
real_packet->%(name)s);"%self.__dict__
         if self.is_struct:
             c="dio_put_%(dataio_type)s(&dout, 
&real_packet->%(name)s[i]);"%self.__dict__
-        elif self.dataio_type=="string":
+        elif self.dataio_type in ["ascii_string","text_string"]:
             c="dio_put_%(dataio_type)s(&dout, 
real_packet->%(name)s[i]);"%self.__dict__
             array_size_u=self.array_size1_u
 
@@ -422,7 +422,7 @@
 
         if self.dataio_type=="memory":
             return "dio_get_%(dataio_type)s(&din, real_packet->%(name)s, 
%(array_size_u)s);"%self.__dict__
-        if self.dataio_type in ["string","bit_string","city_map","memory"] and 
\
+        if self.dataio_type in 
["ascii_string","text_string","bit_string","city_map","memory"] and \
            self.is_array!=2:
             return "dio_get_%(dataio_type)s(&din, real_packet->%(name)s, 
sizeof(real_packet->%(name)s));"%self.__dict__
         if self.is_struct and self.is_array==0:
@@ -436,7 +436,7 @@
 
         if self.is_struct:
             c="dio_get_%(dataio_type)s(&din, 
&real_packet->%(name)s[i]);"%self.__dict__
-        elif self.dataio_type=="string":
+        elif self.dataio_type in ["ascii_string","text_string"]:
             c="dio_get_%(dataio_type)s(&din, real_packet->%(name)s[i], 
sizeof(real_packet->%(name)s[i]));"%self.__dict__
         elif self.struct_type=="float":
             c='''int tmp;
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.21
diff -u -r1.21 packets.def
--- common/packets.def  24 Apr 2004 17:32:47 -0000      1.21
+++ common/packets.def  26 Apr 2004 18:01:42 -0000
@@ -149,7 +149,8 @@
 
 # typedefs for arrays/structs
 type MEMORY            = memory(unsigned char)
-type STRING            = string(char)
+type ASCII             = ascii_string(char)
+type TEXT              = text_string(char)
 type BIT_STRING                = bit_string(char)
 type CITY_MAP          = city_map(char)
 type WORKLIST          = worklist(struct worklist)
@@ -235,29 +236,29 @@
 # This packet is the first real (freeciv specific) packet send by the
 # client. The player hasn't been accepted yet.
 PACKET_SERVER_JOIN_REQ=4; cs, dsend,no-delta,no-handle
-  STRING username[MAX_LEN_NAME];
-  STRING capability[MAX_LEN_CAPSTR];
-  STRING version_label[MAX_LEN_NAME];
+  TEXT username[MAX_LEN_NAME];
+  ASCII capability[MAX_LEN_CAPSTR];
+  ASCII version_label[MAX_LEN_NAME];
   UINT32 major_version, minor_version, patch_version;
 end
 
 # ... and the server replies.
 PACKET_SERVER_JOIN_REPLY=5; sc,no-delta
   BOOL you_can_join;
-  STRING message[MAX_LEN_MSG];
-  STRING capability[MAX_LEN_CAPSTR];
-  STRING challenge_file[MAX_LEN_PATH];
+  TEXT message[MAX_LEN_MSG];
+  ASCII capability[MAX_LEN_CAPSTR];
+  ASCII challenge_file[MAX_LEN_PATH];
   # clients conn id as known in server
   CONNECTION conn_id;
 end
 
 PACKET_AUTHENTICATION_REQ=6;sc,handle-per-conn,dsend
   AUTH_TYPE type;
-  STRING message[MAX_LEN_MSG]; /* explain to the client if there's a problem */
+  TEXT message[MAX_LEN_MSG]; /* explain to the client if there's a problem */
 end
 
 PACKET_AUTHENTICATION_REPLY=7;cs,no-handle
-  STRING password[MAX_LEN_NAME];
+  TEXT password[MAX_LEN_NAME];
 end
 
 
@@ -272,7 +273,7 @@
 PACKET_NATION_SELECT_REQ=10;cs,dsend
   NATION nation_no;
   BOOL is_male;
-  STRING name[MAX_LEN_NAME];
+  TEXT name[MAX_LEN_NAME];
   UINT8 city_style;
 end
 
@@ -311,7 +312,7 @@
   SPECIAL special;
   PLAYER owner;
   CONTINENT continent;
-  STRING spec_sprite[MAX_LEN_NAME];
+  ASCII spec_sprite[MAX_LEN_NAME];
 end
 
 PACKET_GAME_INFO=15; is-info,sc
@@ -357,13 +358,13 @@
 /************** Chat/event packets **********************/
 
 PACKET_CHAT_MSG=18;sc, pre-send, post-recv,lsend
-  STRING message[MAX_LEN_MSG];
+  TEXT message[MAX_LEN_MSG];
   COORD x, y;
   EVENT event;
 end
 
 PACKET_CHAT_MSG_REQ=19;cs,handle-per-conn,dsend
-  STRING message[MAX_LEN_MSG];
+  TEXT message[MAX_LEN_MSG];
 end
 
 /************** City packets **********************/
@@ -376,7 +377,7 @@
   CITY id; key
   PLAYER owner;
   COORD x,y;
-  STRING name[MAX_LEN_NAME];
+  TEXT name[MAX_LEN_NAME];
   UINT8 size;
 
   UINT8 ppl_happy[5], ppl_content[5], ppl_unhappy[5], ppl_angry[5];
@@ -421,7 +422,7 @@
   PLAYER owner;
   COORD x;
   COORD y;
-  STRING name[MAX_LEN_NAME];
+  TEXT name[MAX_LEN_NAME];
   UINT8 size;
   BOOL happy;
   BOOL unhappy;
@@ -468,7 +469,7 @@
 
 PACKET_CITY_RENAME=30;cs,dsend
   CITY city_id;
-  STRING name[MAX_LEN_NAME];
+  TEXT name[MAX_LEN_NAME];
 end
 
 PACKET_CITY_OPTIONS_REQ=31;cs,dsend
@@ -501,7 +502,7 @@
 
 PACKET_CITY_NAME_SUGGESTION_INFO=36;sc,dsend,lsend
   UNIT unit_id;
-  STRING name[MAX_LEN_NAME];
+  TEXT name[MAX_LEN_NAME];
 end
 
 PACKET_CITY_SABOTAGE_LIST=37;sc,lsend
@@ -518,7 +519,7 @@
 
 PACKET_PLAYER_INFO=39; is-info,sc
   PLAYER playerno; key 
-  STRING name[MAX_LEN_NAME];
+  TEXT name[MAX_LEN_NAME];
   BOOL is_male;
   GOVERNMENT government;
   UINT32 embassy;
@@ -648,7 +649,7 @@
 
 PACKET_UNIT_BUILD_CITY=53;cs,dsend
   UNIT unit_id;
-  STRING name[MAX_LEN_NAME];
+  TEXT name[MAX_LEN_NAME];
 end
 
 PACKET_UNIT_DISBAND=54;cs,dsend
@@ -813,7 +814,7 @@
 /**************  Report packets **********************/
 
 PACKET_PAGE_MSG=84;sc,lsend
-  STRING message[MAX_LEN_MSG];
+  TEXT message[MAX_LEN_MSG];
   EVENT event;
 end
 
@@ -836,9 +837,9 @@
   BOOL observer;
   PLAYER player_num;
   CMDLEVEL access_level;
-  STRING username[MAX_LEN_NAME];
-  STRING addr[MAX_LEN_ADDR];
-  STRING capability[MAX_LEN_CAPSTR];
+  TEXT username[MAX_LEN_NAME];
+  ASCII addr[MAX_LEN_ADDR];
+  ASCII capability[MAX_LEN_CAPSTR];
 end
 
 # Information about the ping times of the connections.
@@ -912,13 +913,13 @@
 
 PACKET_RULESET_UNIT=96;sc,lsend
   UNIT_TYPE id;
-  STRING name[MAX_LEN_NAME];
-  STRING graphic_str[MAX_LEN_NAME];
-  STRING graphic_alt[MAX_LEN_NAME];
-  STRING sound_move[MAX_LEN_NAME];
-  STRING sound_move_alt[MAX_LEN_NAME];
-  STRING sound_fight[MAX_LEN_NAME];
-  STRING sound_fight_alt[MAX_LEN_NAME];
+  ASCII name[MAX_LEN_NAME];
+  ASCII graphic_str[MAX_LEN_NAME];
+  ASCII graphic_alt[MAX_LEN_NAME];
+  ASCII sound_move[MAX_LEN_NAME];
+  ASCII sound_move_alt[MAX_LEN_NAME];
+  ASCII sound_fight[MAX_LEN_NAME];
+  ASCII sound_fight_alt[MAX_LEN_NAME];
   UINT8 move_type;
   UINT16 build_cost;
   UINT8 pop_cost;
@@ -943,13 +944,13 @@
   UINT8 paratroopers_mr_req;
   UINT8 paratroopers_mr_sub;
 
-  STRING veteran_name[MAX_VET_LEVELS][MAX_LEN_NAME]; add-cap(veteran)
+  ASCII veteran_name[MAX_VET_LEVELS][MAX_LEN_NAME]; add-cap(veteran)
   FLOAT power_fact[MAX_VET_LEVELS]; add-cap(veteran)
   UINT8 move_bonus[MAX_VET_LEVELS]; add-cap(veteran)
 
   UINT8 bombard_rate; add-cap(bombard)
 
-  STRING helptext[MAX_LEN_PACKET];
+  ASCII helptext[MAX_LEN_PACKET];
 
   bitvector(bv_flags) flags;
   bitvector(bv_roles) roles;
@@ -982,8 +983,8 @@
   GOVERNMENT gov;
   UINT8 id;
   NATION nation;
-  STRING male_title[MAX_LEN_NAME];
-  STRING female_title[MAX_LEN_NAME];
+  ASCII male_title[MAX_LEN_NAME];
+  ASCII female_title[MAX_LEN_NAME];
 end
 
 PACKET_RULESET_TECH=99;sc,lsend
@@ -991,10 +992,10 @@
   TECH req[2];
   TECH root_req;
   UINT32 flags, preset_cost, num_reqs;
-  STRING name[MAX_LEN_NAME];
-  STRING helptext[MAX_LEN_PACKET];
-  STRING graphic_str[MAX_LEN_NAME];
-  STRING graphic_alt[MAX_LEN_NAME];
+  ASCII name[MAX_LEN_NAME];
+  ASCII helptext[MAX_LEN_PACKET];
+  ASCII graphic_str[MAX_LEN_NAME];
+  ASCII graphic_alt[MAX_LEN_NAME];
 end
 
 PACKET_RULESET_GOVERNMENT=100;sc,lsend
@@ -1054,10 +1055,10 @@
       
   UINT8 num_ruler_titles;
        
-  STRING name[MAX_LEN_NAME];
-  STRING graphic_str[MAX_LEN_NAME];
-  STRING graphic_alt[MAX_LEN_NAME];
-  STRING helptext[MAX_LEN_PACKET];
+  ASCII name[MAX_LEN_NAME];
+  ASCII graphic_str[MAX_LEN_NAME];
+  ASCII graphic_alt[MAX_LEN_NAME];
+  ASCII helptext[MAX_LEN_PACKET];
 end
 
 PACKET_RULESET_TERRAIN_CONTROL=101;sc,lsend
@@ -1073,7 +1074,7 @@
 
   UINT16 river_defense_bonus;           /* % added to defense if Civ2 river */
   UINT16 river_trade_incr;              /* added to trade if Civ2 river */
-  STRING river_help_text[MAX_LEN_PACKET]; # help for Civ2-style rivers
+  ASCII river_help_text[MAX_LEN_PACKET]; # help for Civ2-style rivers
 
   UINT16 fortress_defense_bonus;        /* % added to defense if fortress */
   UINT16 road_superhighway_trade_bonus;  # % added to trade if road/s-highway
@@ -1092,37 +1093,37 @@
 PACKET_RULESET_NATION=102;sc,lsend
   NATION id;
 
-  STRING name[MAX_LEN_NAME];
-  STRING name_plural[MAX_LEN_NAME];
-  STRING graphic_str[MAX_LEN_NAME];
-  STRING graphic_alt[MAX_LEN_NAME];
-  STRING class[MAX_LEN_NAME];
-  STRING legend[MAX_LEN_MSG];
+  TEXT name[MAX_LEN_NAME];
+  TEXT name_plural[MAX_LEN_NAME];
+  ASCII graphic_str[MAX_LEN_NAME];
+  ASCII graphic_alt[MAX_LEN_NAME];
+  ASCII class[MAX_LEN_NAME];
+  ASCII legend[MAX_LEN_MSG];
 
   UINT8 city_style;
   TECH_LIST init_techs[MAX_NUM_TECH_LIST];
 
   UINT8 leader_count;
-  STRING leader_name[MAX_NUM_LEADERS:leader_count][MAX_LEN_NAME];
+  TEXT leader_name[MAX_NUM_LEADERS:leader_count][MAX_LEN_NAME];
   BOOL leader_sex[MAX_NUM_LEADERS:leader_count];
 end
 
 PACKET_RULESET_CITY=103;sc,lsend
   UINT8 style_id; 
   UINT8 techreq;
-  STRING name[MAX_LEN_NAME];
-  STRING citizens_graphic[MAX_LEN_NAME];
-  STRING citizens_graphic_alt[MAX_LEN_NAME];
-  STRING graphic[MAX_LEN_NAME];
-  STRING graphic_alt[MAX_LEN_NAME];
+  ASCII name[MAX_LEN_NAME];
+  ASCII citizens_graphic[MAX_LEN_NAME];
+  ASCII citizens_graphic_alt[MAX_LEN_NAME];
+  ASCII graphic[MAX_LEN_NAME];
+  ASCII graphic_alt[MAX_LEN_NAME];
   SINT8 replaced_by;
 end
 
 PACKET_RULESET_BUILDING=104;sc,lsend
   IMPROVEMENT id;
-  STRING name[MAX_LEN_NAME];
-  STRING graphic_str[MAX_LEN_NAME];
-  STRING graphic_alt[MAX_LEN_NAME];
+  ASCII name[MAX_LEN_NAME];
+  ASCII graphic_str[MAX_LEN_NAME];
+  ASCII graphic_alt[MAX_LEN_NAME];
   TECH tech_req, obsolete_by;
   IMPROVEMENT bldg_req;
   BOOL is_wonder;
@@ -1130,9 +1131,9 @@
   UINT16 build_cost;
   UINT8 upkeep, sabotage;
   UINT8 variant;               /* FIXME: remove when gen-impr obsoletes */
-  STRING soundtag[MAX_LEN_NAME];
-  STRING soundtag_alt[MAX_LEN_NAME];
-  STRING helptext[MAX_LEN_PACKET];
+  ASCII soundtag[MAX_LEN_NAME];
+  ASCII soundtag_alt[MAX_LEN_NAME];
+  ASCII helptext[MAX_LEN_PACKET];
   UINT8 terr_gate_count;
   TERRAIN terr_gate[255:terr_gate_count];
   UINT8 spec_gate_count;
@@ -1150,9 +1151,9 @@
 
   bitvector(bv_terrain_flags) flags;
 
-  STRING terrain_name[MAX_LEN_NAME];
-  STRING graphic_str[MAX_LEN_NAME];
-  STRING graphic_alt[MAX_LEN_NAME];
+  ASCII terrain_name[MAX_LEN_NAME];
+  ASCII graphic_str[MAX_LEN_NAME];
+  ASCII graphic_alt[MAX_LEN_NAME];
 
   UINT8 movement_cost;
   UINT8 defense_bonus;
@@ -1161,19 +1162,19 @@
   UINT8 shield;
   UINT8 trade;
 
-  STRING special_1_name[MAX_LEN_NAME];
+  ASCII special_1_name[MAX_LEN_NAME];
   UINT8 food_special_1;
   UINT8 shield_special_1;
   UINT8 trade_special_1;
-  STRING graphic_str_special_1[MAX_LEN_NAME];
-  STRING graphic_alt_special_1[MAX_LEN_NAME];
+  ASCII graphic_str_special_1[MAX_LEN_NAME];
+  ASCII graphic_alt_special_1[MAX_LEN_NAME];
 
-  STRING special_2_name[MAX_LEN_NAME];
+  ASCII special_2_name[MAX_LEN_NAME];
   UINT8 food_special_2;
   UINT8 shield_special_2;
   UINT8 trade_special_2;
-  STRING graphic_str_special_2[MAX_LEN_NAME];
-  STRING graphic_alt_special_2[MAX_LEN_NAME];
+  ASCII graphic_str_special_2[MAX_LEN_NAME];
+  ASCII graphic_alt_special_2[MAX_LEN_NAME];
 
   UINT8 road_trade_incr;
   UINT8 road_time;
@@ -1189,7 +1190,7 @@
   TERRAIN transform_result;
   UINT8 transform_time;
   
-  STRING helptext[MAX_LEN_PACKET];
+  ASCII helptext[MAX_LEN_PACKET];
 end
 
 /*********************************************************
@@ -1222,7 +1223,7 @@
   UINT8 borders;
   BOOL slow_invasions; add-cap(slow_invasions)
 
-  STRING team_name[MAX_NUM_TEAMS][MAX_LEN_NAME];
+  TEXT team_name[MAX_NUM_TEAMS][MAX_LEN_NAME];
 end
 
 
@@ -1242,11 +1243,11 @@
 
 PACKET_SINGLE_PLAYERLIST_REPLY=111;sc
   UINT8 nplayers;
-  STRING load_filename[MAX_LEN_PACKET];
-  STRING name[MAX_NUM_PLAYERS:nplayers][MAX_LEN_NAME]; 
-  STRING username[MAX_NUM_PLAYERS:nplayers][MAX_LEN_NAME]; 
-  STRING nation_name[MAX_NUM_PLAYERS:nplayers][MAX_LEN_NAME]; 
-  STRING nation_flag[MAX_NUM_PLAYERS:nplayers][MAX_LEN_NAME]; 
+  ASCII load_filename[MAX_LEN_PACKET];
+  TEXT name[MAX_NUM_PLAYERS:nplayers][MAX_LEN_NAME]; 
+  TEXT username[MAX_NUM_PLAYERS:nplayers][MAX_LEN_NAME]; 
+  TEXT nation_name[MAX_NUM_PLAYERS:nplayers][MAX_LEN_NAME]; 
+  ASCII nation_flag[MAX_NUM_PLAYERS:nplayers][MAX_LEN_NAME]; 
   BOOL is_alive[MAX_NUM_PLAYERS:nplayers];
   BOOL is_ai[MAX_NUM_PLAYERS:nplayers];
 end
@@ -1254,14 +1255,14 @@
 PACKET_OPTIONS_SETTABLE_CONTROL=112;sc,handle-via-packet
   UINT16 nids;
   UINT8 ncategories;
-  STRING category_names[256:ncategories][MAX_LEN_NAME];
+  ASCII category_names[256:ncategories][MAX_LEN_NAME];
 end
 
 PACKET_OPTIONS_SETTABLE=113;sc
   UINT16 id;
-  STRING name[MAX_LEN_NAME];
-  STRING short_help[MAX_LEN_PACKET];
-  STRING extra_help[MAX_LEN_PACKET];
+  ASCII name[MAX_LEN_NAME];
+  ASCII short_help[MAX_LEN_PACKET];
+  ASCII extra_help[MAX_LEN_PACKET];
   SSET_TYPE type;
 
   SINT32 val;                                  /* value for bool or int */
@@ -1269,8 +1270,8 @@
   SINT32 min;                                  /* min value for int */
   SINT32 max;                                  /* max value for int */
 
-  STRING strval[MAX_LEN_PACKET];               /* space for string */
-  STRING default_strval[MAX_LEN_PACKET];       /* space for string */
+  ASCII strval[MAX_LEN_PACKET];                        /* space for string */
+  ASCII default_strval[MAX_LEN_PACKET];                /* space for string */
 
   UINT8 category;                              /* which category this is in */
 end
Index: server/meta.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/meta.c,v
retrieving revision 1.59
diff -u -r1.59 meta.c
--- server/meta.c       25 Jan 2004 13:55:14 -0000      1.59
+++ server/meta.c       26 Apr 2004 18:01:42 -0000
@@ -140,8 +140,8 @@
 
   dio_put_uint16(&dout, 0);
   dio_put_uint8(&dout, PACKET_UDP_PCKT);
-  dio_put_string(&dout, desc);
-  dio_put_string(&dout, info);
+  dio_put_ascii_string(&dout, desc);
+  dio_put_ascii_string(&dout, info);
 
   size = dio_output_used(&dout);
 
Index: server/sernet.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sernet.c,v
retrieving revision 1.116
diff -u -r1.116 sernet.c
--- server/sernet.c     17 Mar 2004 00:22:44 -0000      1.116
+++ server/sernet.c     26 Apr 2004 18:01:42 -0000
@@ -1076,12 +1076,12 @@
 
   dio_output_init(&dout, buffer, sizeof(buffer));
   dio_put_uint8(&dout, SERVER_LAN_VERSION);
-  dio_put_string(&dout, hostname);
-  dio_put_string(&dout, port);
-  dio_put_string(&dout, version);
-  dio_put_string(&dout, status);
-  dio_put_string(&dout, players);
-  dio_put_string(&dout, srvarg.metaserver_info_line);
+  dio_put_ascii_string(&dout, hostname);
+  dio_put_ascii_string(&dout, port);
+  dio_put_ascii_string(&dout, version);
+  dio_put_ascii_string(&dout, status);
+  dio_put_ascii_string(&dout, players);
+  dio_put_ascii_string(&dout, srvarg.metaserver_info_line);
   size = dio_output_used(&dout);
 
   /* Sending packet to client with the information gathered above. */
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.159
diff -u -r1.159 srv_main.c
--- server/srv_main.c   25 Apr 2004 19:03:40 -0000      1.159
+++ server/srv_main.c   26 Apr 2004 18:01:43 -0000
@@ -751,11 +751,12 @@
     dio_put_uint8(&dout, 1);
 
     dio_put_bool32(&dout, FALSE);
-    dio_put_string(&dout, _("Your client is too old. To use this server "
-                           "please upgrade your client to a CVS version "
-                           "later than 2003-11-28 or Freeciv 1.15.0 or "
-                           "later."));
-    dio_put_string(&dout, "");
+    dio_put_text_string(&dout,
+                       _("Your client is too old. To use this server "
+                         "please upgrade your client to a CVS version "
+                         "later than 2003-11-28 or Freeciv 1.15.0 or "
+                         "later."));
+    dio_put_text_string(&dout, "");
 
     {
       size_t size = dio_output_used(&dout);

[Prev in Thread] Current Thread [Next in Thread]