Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] (PR#9433) Patch: MSVC compile fixes
Home

[Freeciv-Dev] (PR#9433) Patch: MSVC compile fixes

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9433) Patch: MSVC compile fixes
From: "res" <resqu@xxxxxx>
Date: Mon, 19 Jul 2004 19:11:40 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9433 >

A few changes to the server and the GTK 2.0 client to allow compilation 
with MSVC:
- VC doesn't know dynamic array sizes; instead, alloca() has to be used. 
Added a macro(FC_DYNSIZE_ARRAY) to utility/mem.h that wraps GCC's 
dynamic sized resp. alloca() as appopriate.
- VC doesn't know variable argument macros; for now, the patch 
effectively disables all functionality provided by such macros.
- In the GTK2 client, a struct initialization flavor was used that VC 
doesn't support.
- Added some includes needed by VC resp. disabled some not supported.
- The Win32 constant for the maximum path length is MAX_PATH, not PATH_MAX.

NB: To compile FreeCiv with MSVC those changes alone aren't enough. 
Project files and a special config.h are needed, too.

-f.r.

Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.389
diff -u -r1.389 packhand.c
--- client/packhand.c   18 Jul 2004 04:19:26 -0000      1.389
+++ client/packhand.c   20 Jul 2004 01:03:30 -0000
@@ -1494,7 +1494,7 @@
     government_selected = FALSE;
   } else if (!client_is_observer()) {
     int i = 0, governments = game.government_count - 1;
-    struct government *government[governments];
+    FC_DYNSIZE_ARRAY(struct government*, government, governments);
 
     assert(game.government_when_anarchy >= 0
           && game.government_when_anarchy < game.government_count);
Index: client/text.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/text.c,v
retrieving revision 1.7
diff -u -r1.7 text.c
--- client/text.c       16 Jul 2004 19:37:57 -0000      1.7
+++ client/text.c       20 Jul 2004 01:01:55 -0000
@@ -51,8 +51,13 @@
                     const char *format, ...)
 fc__attribute((format(printf, 3, 4)));
 
+#ifdef _MSC_VER
+#define        add_line  (void)
+#define add      (void)
+#else
 #define add_line(...) real_add_line(&out,&out_size, __VA_ARGS__)
 #define add(...) real_add(&out,&out_size, __VA_ARGS__)
+#endif
 
 #define INIT                   \
   static char *out = NULL;     \
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.185
diff -u -r1.185 tilespec.c
--- client/tilespec.c   18 Jul 2004 19:07:28 -0000      1.185
+++ client/tilespec.c   20 Jul 2004 01:11:35 -0000
@@ -521,7 +521,8 @@
   /* Try out all supported file extensions to find one that works. */
   while ((gfx_fileext = *gfx_fileexts++)) {
     char *real_full_name;
-    char full_name[strlen(gfx_filename) + strlen(gfx_fileext) + 2];
+    FC_DYNSIZE_ARRAY(char, full_name, 
+      strlen(gfx_filename) + strlen(gfx_fileext) + 2);
 
     sprintf(full_name, "%s.%s", gfx_filename, gfx_fileext);
     if ((real_full_name = datafilename(full_name))) {
@@ -1103,8 +1104,8 @@
   for (i = 0; i < num_cardinal_tileset_dirs; i++) {
     int value = (idx >> i) & 1;
 
-    snprintf(c + strlen(c), sizeof(c) - strlen(c), "%s%d",
-            dir_get_tileset_name(cardinal_tileset_dirs[i]), value);
+    my_snprintf(c + strlen(c), sizeof(c) - strlen(c), "%s%d",
+               dir_get_tileset_name(cardinal_tileset_dirs[i]), value);
   }
 
   return c;
@@ -1162,11 +1163,15 @@
 {
   /* Load the specialist sprite graphics. */
   specialist_type_iterate(i) {
-    struct citizen_type c = {.type = CITIZEN_SPECIALIST, .spec_type = i};
-    const char *name = get_citizen_name(c);
+    struct citizen_type c;
+    const char *name;
     char buffer[512];
     int j;
 
+    c.type = CITIZEN_SPECIALIST;
+    c.spec_type = i;
+    name = get_citizen_name(c);
+
     for (j = 0; j < NUM_TILES_CITIZEN; j++) {
       my_snprintf(buffer, sizeof(buffer), "specialist.%s_%d", name, j);
       sprites.specialist[i].sprite[j] = load_sprite(buffer);
@@ -1192,8 +1197,10 @@
 
   /* Load the citizen sprite graphics. */
   for (i = 0; i < NUM_TILES_CITIZEN; i++) {
-    struct citizen_type c = {.type = i};
-    const char *name = get_citizen_name(c);
+    struct citizen_type c;
+    const char *name;
+    c.type = i;
+    name = get_citizen_name(c);
 
     if (i == CITIZEN_SPECIALIST) {
       continue; /* Handled separately. */
Index: client/agents/cma_core.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/agents/cma_core.c,v
retrieving revision 1.56
diff -u -r1.56 cma_core.c
--- client/agents/cma_core.c    18 Jul 2004 01:16:05 -0000      1.56
+++ client/agents/cma_core.c    20 Jul 2004 01:03:57 -0000
@@ -17,7 +17,9 @@
 
 #include <assert.h>
 #include <string.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 
 #include "city.h"
 #include "dataio.h"
Index: client/gui-gtk-2.0/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/citydlg.c,v
retrieving revision 1.90
diff -u -r1.90 citydlg.c
--- client/gui-gtk-2.0/citydlg.c        17 Jul 2004 05:53:20 -0000      1.90
+++ client/gui-gtk-2.0/citydlg.c        20 Jul 2004 01:02:39 -0000
@@ -1375,8 +1375,9 @@
 *****************************************************************/
 static void city_dialog_update_map(struct city_dialog *pdialog)
 {
-  struct canvas store = {.type = CANVAS_PIXMAP,
-                        .v.pixmap = pdialog->map_canvas_store};
+  struct canvas store;
+  store.type = CANVAS_PIXMAP;
+  store.v.pixmap = pdialog->map_canvas_store;
 
   city_dialog_redraw_map(pdialog->pcity, &store);
 
Index: client/gui-gtk-2.0/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/dialogs.c,v
retrieving revision 1.70
diff -u -r1.70 dialogs.c
--- client/gui-gtk-2.0/dialogs.c        13 Jul 2004 22:52:16 -0000      1.70
+++ client/gui-gtk-2.0/dialogs.c        20 Jul 2004 01:02:26 -0000
@@ -1355,7 +1355,9 @@
       UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
 
   {
-    struct canvas canvas_store = {.type = CANVAS_PIXBUF, .v.pixbuf = pix};
+    struct canvas canvas_store;
+    canvas_store.type = CANVAS_PIXBUF;
+    canvas_store.v.pixbuf = pix;
 
     gdk_pixbuf_fill(pix, 0x00000000);
     put_unit_full(punit, &canvas_store, 0, 0);
Index: client/gui-gtk-2.0/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.c,v
retrieving revision 1.74
diff -u -r1.74 gui_main.c
--- client/gui-gtk-2.0/gui_main.c       10 Jul 2004 18:48:18 -0000      1.74
+++ client/gui-gtk-2.0/gui_main.c       20 Jul 2004 01:02:16 -0000
@@ -823,7 +823,8 @@
   {
     /* HACK: the UNHAPPY citizen is used for the government
      * when we don't know any better. */
-    struct citizen_type c = {.type = CITIZEN_UNHAPPY};
+    struct citizen_type c;
+    c.type = CITIZEN_UNHAPPY;
 
     sprite = get_citizen_sprite(c, 0, NULL);
   }
Index: client/gui-gtk-2.0/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapview.c,v
retrieving revision 1.131
diff -u -r1.131 mapview.c
--- client/gui-gtk-2.0/mapview.c        10 Jul 2004 18:48:18 -0000      1.131
+++ client/gui-gtk-2.0/mapview.c        20 Jul 2004 01:01:05 -0000
@@ -248,7 +248,8 @@
   if (game.government_count==0) {
     /* HACK: the UNHAPPY citizen is used for the government
      * when we don't know any better. */
-    struct citizen_type c = {.type = CITIZEN_UNHAPPY};
+    struct citizen_type c;
+    c.type = CITIZEN_UNHAPPY;
 
     gov_sprite = get_citizen_sprite(c, 0, NULL);
   } else {
@@ -612,7 +613,9 @@
 **************************************************************************/
 void put_unit_gpixmap(struct unit *punit, GtkPixcomm *p)
 {
-  struct canvas canvas_store = {.type = CANVAS_PIXCOMM, .v.pixcomm = p};
+  struct canvas canvas_store;
+  canvas_store.type = CANVAS_PIXCOMM;
+  canvas_store.v.pixcomm = p;
 
   gtk_pixcomm_freeze(p);
   gtk_pixcomm_clear(p);
@@ -631,7 +634,9 @@
 **************************************************************************/
 void put_unit_gpixmap_city_overlays(struct unit *punit, GtkPixcomm *p)
 {
-  struct canvas store = {.type = CANVAS_PIXCOMM, .v.pixcomm = p};
+  struct canvas store;
+  store.type = CANVAS_PIXCOMM;
+  store.v.pixcomm = p;
  
   gtk_pixcomm_freeze(p);
 
@@ -1010,7 +1015,9 @@
   int count, i;
   bool solid_bg, fog;
   enum color_std bg_color;
-  struct canvas canvas_store = {.type = CANVAS_PIXMAP, .v.pixmap = pm};
+  struct canvas canvas_store;
+  canvas_store.type = CANVAS_PIXMAP;
+  canvas_store.v.pixmap = pm;
 
   count = fill_tile_sprite_array(tile_sprs, &solid_bg, &bg_color,
                                 x, y, citymode);
Index: client/gui-gtk-2.0/plrdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/plrdlg.c,v
retrieving revision 1.39
diff -u -r1.39 plrdlg.c
--- client/gui-gtk-2.0/plrdlg.c 1 May 2004 17:28:47 -0000       1.39
+++ client/gui-gtk-2.0/plrdlg.c 20 Jul 2004 00:56:47 -0000
@@ -189,7 +189,7 @@
 **************************************************************************/
 static void create_store(void)
 {
-  GType model_types[num_player_dlg_columns + 2];
+  FC_DYNSIZE_ARRAY(GType, model_types, num_player_dlg_columns + 2);
   int i;
 
   for (i = 0; i < num_player_dlg_columns; i++) {
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.180
diff -u -r1.180 map.c
--- common/map.c        18 Jul 2004 17:09:39 -0000      1.180
+++ common/map.c        20 Jul 2004 00:11:28 -0000
@@ -1610,7 +1610,8 @@
   /* If that fails, count all available spots and pick one.
    * Slow but reliable. */
   if (tries == max_tries) {
-    int count = 0, positions[map.xsize * map.ysize];
+    int count = 0;
+    FC_DYNSIZE_ARRAY(int, positions, map.xsize * map.ysize);
 
     whole_map_iterate(x1, y1) {
       if (filter(x1, y1, data)) {
Index: common/unit.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.h,v
retrieving revision 1.119
diff -u -r1.119 unit.h
--- common/unit.h       18 Jul 2004 04:08:21 -0000      1.119
+++ common/unit.h       20 Jul 2004 01:38:45 -0000
@@ -214,7 +214,7 @@
 { \
   int _size = unit_list_size(&unitlist); \
   if (_size > 0) { \
-    int _ids[_size]; \
+    FC_DYNSIZE_ARRAY(int, _ids, _size); \
     int _i = 0; \
     unit_list_iterate(unitlist, punit) { \
       _ids[_i++] = punit->id; \
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.263
diff -u -r1.263 citytools.c
--- server/citytools.c  15 Jul 2004 20:43:32 -0000      1.263
+++ server/citytools.c  20 Jul 2004 00:01:02 -0000
@@ -276,8 +276,9 @@
 char *city_name_suggestion(struct player *pplayer, int x, int y)
 {
   int i = 0, j;
-  bool nations_selected[game.nation_count];
-  Nation_Type_id nation_list[game.nation_count], n;
+  FC_DYNSIZE_ARRAY(bool, nations_selected, game.nation_count);
+  FC_DYNSIZE_ARRAY(Nation_Type_id, nation_list, game.nation_count);
+  Nation_Type_id n;
   int queue_size;
 
   static const int num_tiles = MAP_MAX_WIDTH * MAP_MAX_HEIGHT; 
Index: server/gamehand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamehand.c,v
retrieving revision 1.136
diff -u -r1.136 gamehand.c
--- server/gamehand.c   3 Jul 2004 17:11:35 -0000       1.136
+++ server/gamehand.c   20 Jul 2004 00:01:45 -0000
@@ -113,8 +113,8 @@
 void init_new_game(void)
 {
   const int NO_START_POS = -1;
-  int start_pos[game.nplayers];
-  bool pos_used[map.num_start_positions];
+  FC_DYNSIZE_ARRAY(int, start_pos, game.nplayers);
+  FC_DYNSIZE_ARRAY(bool, pos_used, map.num_start_positions);
   int i, num_used = 0;
 
   init_game_id();
Index: server/gamelog.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamelog.c,v
retrieving revision 1.33
diff -u -r1.33 gamelog.c
--- server/gamelog.c    18 Jul 2004 04:08:21 -0000      1.33
+++ server/gamelog.c    20 Jul 2004 00:02:13 -0000
@@ -142,7 +142,8 @@
   int i, count = 0, highest = -1;
   struct player *highest_plr = NULL;
   char buffer[4096];
-  struct player_score_entry size[game.nplayers], rank[game.nplayers];
+  FC_DYNSIZE_ARRAY(struct player_score_entry, size, game.nplayers);
+  FC_DYNSIZE_ARRAY(struct player_score_entry, rank, game.nplayers);
 
   players_iterate(pplayer) {
     if (!is_barbarian(pplayer)) {
Index: server/mapgen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/mapgen.c,v
retrieving revision 1.139
diff -u -r1.139 mapgen.c
--- server/mapgen.c     9 Jul 2004 19:30:58 -0000       1.139
+++ server/mapgen.c     20 Jul 2004 01:45:52 -0000
@@ -1307,7 +1307,7 @@
     /* number of different continents seen from (x,y) */
     int seen_conts = 0;
     /* list of seen continents */
-    int conts[CITY_TILES]; 
+    FC_DYNSIZE_ARRAY(int, conts, CITY_TILES);
     int j;
     
     /* add tile's value to each continent that is within city 
Index: server/report.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/report.c,v
retrieving revision 1.52
diff -u -r1.52 report.c
--- server/report.c     18 Jul 2004 04:08:21 -0000      1.52
+++ server/report.c     20 Jul 2004 00:03:30 -0000
@@ -162,7 +162,7 @@
   int i, j = 0, rank = 0;
   char buffer[4096];
   char title[1024];
-  struct player_score_entry size[game.nplayers];
+  FC_DYNSIZE_ARRAY(struct player_score_entry, size, game.nplayers);
 
   players_iterate(pplayer) {
     if (pplayer->is_alive && !is_barbarian(pplayer)) {
@@ -230,7 +230,7 @@
   const int NUM_BEST_CITIES = 5;
   /* a wonder equals WONDER_FACTOR citizen */
   const int WONDER_FACTOR = 5;
-  struct city_score_entry size[NUM_BEST_CITIES];
+  FC_DYNSIZE_ARRAY(struct city_score_entry, size, NUM_BEST_CITIES);
   int i;
   char buffer[4096];
 
@@ -1077,7 +1077,7 @@
 {
   int i, j = 0;
   char buffer[4096];
-  struct player_score_entry size[game.nplayers];
+  FC_DYNSIZE_ARRAY(struct player_score_entry, size, game.nplayers);
 
   players_iterate(pplayer) {
     if (!is_barbarian(pplayer)) {
@@ -1110,7 +1110,7 @@
 void report_final_scores(void)
 {
   int i, j = 0;
-  struct player_score_entry size[game.nplayers];
+  FC_DYNSIZE_ARRAY(struct player_score_entry, size, game.nplayers);
   struct packet_endgame_report packet;
 
   players_iterate(pplayer) {
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.181
diff -u -r1.181 ruleset.c
--- server/ruleset.c    14 Jul 2004 18:50:00 -0000      1.181
+++ server/ruleset.c    20 Jul 2004 01:46:27 -0000
@@ -2431,7 +2431,7 @@
 
   /* Calculate parent nations.  O(n^2) algorithm. */
   for (i = 0; i < game.nation_count; i++) {
-    Nation_Type_id parents[game.nation_count];
+    FC_DYNSIZE_ARRAY(Nation_Type_id, parents, game.nation_count);
     int count = 0;
 
     pl = get_nation_by_idx(i);
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.167
diff -u -r1.167 savegame.c
--- server/savegame.c   18 Jul 2004 04:08:21 -0000      1.167
+++ server/savegame.c   20 Jul 2004 00:04:51 -0000
@@ -72,8 +72,8 @@
  */
 #define SAVE_MAP_DATA(map_x, map_y, nat_x, nat_y, line,                     \
                       GET_XY_CHAR, SECFILE_INSERT_LINE)                     \
-{                                                                           \
-  char line[map.xsize + 1];                                                 \
+{                                                                          \
+  FC_DYNSIZE_ARRAY(char, line, map.xsize + 1);                             \
   int nat_x, nat_y, map_x, map_y;                                           \
                                                                             \
   for (nat_y = 0; nat_y < map.ysize; nat_y++) {                             \
@@ -1978,7 +1978,8 @@
                       "player%d.u%d.transported_by", plrno, i);
     if (punit->has_orders) {
       int len = punit->orders.length, j;
-      char orders_buf[len + 1], dir_buf[len + 1];
+      FC_DYNSIZE_ARRAY(char, orders_buf, len + 1);
+      FC_DYNSIZE_ARRAY(char, dir_buf, len + 1);
 
       secfile_insert_int(file, len, "player%d.u%d.orders_length", plrno, i);
       secfile_insert_int(file, punit->orders.index,
@@ -2757,7 +2758,7 @@
 
   if (secfile_lookup_int_default(file, -1,
                                 "game.shuffled_player_%d", 0) >= 0) {
-    int shuffled_players[game.nplayers];
+    FC_DYNSIZE_ARRAY(int, shuffled_players, game.nplayers);
 
     for (i = 0; i < game.nplayers; i++) {
       shuffled_players[i]
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.176
diff -u -r1.176 srv_main.c
--- server/srv_main.c   18 Jul 2004 05:47:22 -0000      1.176
+++ server/srv_main.c   20 Jul 2004 01:43:25 -0000
@@ -1134,7 +1134,8 @@
 **************************************************************************/
 static Nation_Type_id select_random_nation(const char* class)
 {
-  Nation_Type_id i, available[game.playable_nation_count];
+  Nation_Type_id i;
+  FC_DYNSIZE_ARRAY(Nation_Type_id, available, game.playable_nation_count);
   int count = 0;
 
   /* Determine which nations are available. */
Index: utility/log.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/log.h,v
retrieving revision 1.22
diff -u -r1.22 log.h
--- utility/log.h       1 May 2004 03:22:11 -0000       1.22
+++ utility/log.h       19 Jul 2004 23:32:39 -0000
@@ -80,6 +80,9 @@
 }
 #endif
 
+#ifdef _MSC_VER
+#  define freelog (void)
+#else
 #ifdef DEBUG
 #  define freelog(level, ...)                                             \
   do {                                                                      \
@@ -95,5 +98,6 @@
     }                                                                       \
   } while(FALSE) 
 #endif  /* DEBUG */
+#endif
 
 #endif  /* FC__LOG_H */
Index: mem.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/mem.h,v
retrieving revision 1.2
diff -u -r1.2 mem.h
--- mem.h       1 May 1999 03:57:23 -0000       1.2
+++ mem.h       20 Jul 2004 01:50:47 -0000
@@ -48,4 +48,23 @@
 char *real_mystrdup(const char *str, 
                    const char *called_as, int line, const char *file);
 
+#ifdef _MSC_VER
+#include <malloc.h>    /* alloca */
+#endif
+
+/*
+ * MSVC doesn't provide dynamic sized array variables (ie stuff like
+ * "char someArray[someVar];" where someVar is not a constant). However,
+ * alloca() is available there. The FC_DYNSIZE_ARRAY specifies dynamic sized
+ * arrays, GCC-style for GCC and via alloca() otherwise.
+ */                
+#if defined(__GNUC__)
+# define FC_DYNSIZE_ARRAY(type, identifier, size)      type identifier[size]
+#elif defined(HAVE_ALLOCA)
+# define FC_DYNSIZE_ARRAY(type, identifier, size)      \
+    type* identifier = alloca ((size) * sizeof (type))
+#else
+# error Mayday! Don't know how to dynamically alloc arrays.
+#endif
+                   
 #endif /* FC__MEM_H */
Index: utility/shared.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/shared.c,v
retrieving revision 1.114
diff -u -r1.114 shared.c
--- utility/shared.c    25 May 2004 00:41:17 -0000      1.114
+++ utility/shared.c    20 Jul 2004 01:29:14 -0000
@@ -40,6 +40,9 @@
 #ifdef WIN32_NATIVE
 #include <windows.h>
 #include <lmcons.h>    /* UNLEN */
+#ifdef _MSC_VER
+#include <direct.h>    /* getcwd() */
+#endif
 #endif
 
 #include "astring.h"
@@ -690,8 +693,8 @@
       freelog(LOG_VERBOSE, "HOME is %s", home_dir);
     } else {
 #ifdef WIN32_NATIVE
-      home_dir=fc_malloc(PATH_MAX);
-      if (!getcwd(home_dir,PATH_MAX)) {
+      home_dir=fc_malloc(MAX_PATH);
+      if (!getcwd(home_dir,MAX_PATH)) {
        free(home_dir);
        home_dir=NULL;
        freelog(LOG_ERROR, "Could not find home directory (HOME is not set)");
Index: utility/shared.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/shared.h,v
retrieving revision 1.126
diff -u -r1.126 shared.h
--- utility/shared.h    18 May 2004 16:29:30 -0000      1.126
+++ utility/shared.h    19 Jul 2004 23:32:03 -0000
@@ -194,9 +194,13 @@
 int cat_snprintf(char *str, size_t n, const char *format, ...)
      fc__attribute((format (printf, 3, 4)));
 
+#ifdef _MSC_VER
+#define die (void)
+#else
 #define die(...) real_die(__FILE__, __LINE__, __VA_ARGS__)
 void real_die(const char *file, int line, const char *format, ...)
       fc__attribute((format (printf, 3, 4)));
+#endif
 
 char *user_home_dir(void);
 const char *user_username(void);
Index: utility/support.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/support.c,v
retrieving revision 1.28
diff -u -r1.28 support.c
--- utility/support.c   17 May 2004 02:16:15 -0000      1.28
+++ utility/support.c   20 Jul 2004 00:30:54 -0000
@@ -74,6 +74,9 @@
 #ifdef WIN32_NATIVE
 #include <process.h>
 #include <windows.h>
+#ifdef _MSC_VER
+#define S_ISREG(x)    ((x) && _S_IFREG)
+#endif
 #endif
 #ifdef HAVE_WINSOCK
 #include <winsock.h>

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