Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2006:
[Freeciv-Dev] (PR#12932) windows printf doesn't allow reordering argumen
Home

[Freeciv-Dev] (PR#12932) windows printf doesn't allow reordering argumen

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: aaron_talamasca@xxxxxxxx, chrisk@xxxxxxxxx, cyril.delalande@xxxxxxxxx, s_keishi@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#12932) windows printf doesn't allow reordering arguments
From: "Christian Prochaska" <cp.ml.freeciv.dev@xxxxxxxxxxxxxx>
Date: Thu, 2 Feb 2006 09:44:32 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12932 >

Here are some new patches:

utf8-3a.diff:

includes libutf8.h in any .c file that uses one of the replaced *printf
functions + adds underscores to format/printf

utf8-3b.diff:

includes libutf8.h only in utility/support.c which seems to be the only
place where argument reordering can actually happen in 2.0.7 + adds
underscores to format/printf

utf8-3c.diff:

similar to patch b, but without adding underscores (for the case that
this would introduce problems). With this patch libutf8.h gets included
after *all*
other header files have been included to avoid the compiler warnings.

diff -ur freeciv-2.0.7.orig/ai/ailog.h freeciv-2.0.7/ai/ailog.h
--- freeciv-2.0.7.orig/ai/ailog.h       Thu Oct 13 07:45:24 2005
+++ freeciv-2.0.7/ai/ailog.h    Thu Feb  2 16:18:40 2006
@@ -32,11 +32,11 @@
 
 void PLAYER_LOG(int level, struct player *pplayer, struct ai_data *ai,
                 const char *msg, ...)
-     fc__attribute((format (printf, 4, 5)));
+     fc__attribute((__format__ (__printf__, 4, 5)));
 void CITY_LOG(int level, struct city *pcity, const char *msg, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 void UNIT_LOG(int level, struct unit *punit, const char *msg, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 void BODYGUARD_LOG(int level, struct unit *punit, const char *msg);
 
 #endif  /* FC__AILOG_H */
diff -ur freeciv-2.0.7.orig/client/climisc.h freeciv-2.0.7/client/climisc.h
--- freeciv-2.0.7.orig/client/climisc.h Thu Oct 13 07:45:46 2005
+++ freeciv-2.0.7/client/climisc.h      Thu Feb  2 16:19:00 2006
@@ -106,7 +106,7 @@
                  enum event_type event, int conn_id);
 void create_event(struct tile *ptile, enum event_type event,
                  const char *format, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 void write_chatline_content(const char *txt);
 
 void reports_freeze(void);
diff -ur freeciv-2.0.7.orig/client/gui-ftwl/gui_text.c 
freeciv-2.0.7/client/gui-ftwl/gui_text.c
--- freeciv-2.0.7.orig/client/gui-ftwl/gui_text.c       Thu Oct 13 07:45:40 2005
+++ freeciv-2.0.7/client/gui-ftwl/gui_text.c    Thu Feb  2 14:13:44 2006
@@ -50,10 +50,10 @@
 
 static void real_add_line(char **buffer, size_t * buffer_size,
                          const char *format, ...)
-fc__attribute((format(printf, 3, 4)));
+fc__attribute((__format__(__printf__, 3, 4)));
 static void real_add(char **buffer, size_t * buffer_size,
                     const char *format, ...)
-fc__attribute((format(printf, 3, 4)));
+fc__attribute((__format__(__printf__, 3, 4)));
 
 #define add_line(...) real_add_line(&out,&out_size, __VA_ARGS__)
 #define add(...) real_add(&out,&out_size, __VA_ARGS__)
diff -ur freeciv-2.0.7.orig/client/text.c freeciv-2.0.7/client/text.c
--- freeciv-2.0.7.orig/client/text.c    Thu Oct 13 07:45:46 2005
+++ freeciv-2.0.7/client/text.c Thu Feb  2 14:13:26 2006
@@ -46,10 +46,10 @@
 
 static void real_add_line(char **buffer, size_t * buffer_size,
                          const char *format, ...)
-fc__attribute((format(printf, 3, 4)));
+fc__attribute((__format__(__printf__, 3, 4)));
 static void real_add(char **buffer, size_t * buffer_size,
                     const char *format, ...)
-fc__attribute((format(printf, 3, 4)));
+fc__attribute((__format__(__printf__, 3, 4)));
 
 #define add_line(...) real_add_line(&out,&out_size, __VA_ARGS__)
 #define add(...) real_add(&out,&out_size, __VA_ARGS__)
diff -ur freeciv-2.0.7.orig/configure.ac freeciv-2.0.7/configure.ac
--- freeciv-2.0.7.orig/configure.ac     Thu Oct 13 07:45:46 2005
+++ freeciv-2.0.7/configure.ac  Thu Feb  2 16:26:24 2006
@@ -321,6 +321,18 @@
   LIBS="$LIBS -lwsock32"
 fi
 
+dnl Check libUTF8
+AC_ARG_WITH(libutf8,
+            AC_HELP_STRING([--with-libutf8],
+               [Use the libutf8 library (needed for some systems)]),
+            [with_libutf8=$withval], [with_libutf8=no])
+if test "$MINGW32" = yes || test "$with_libutf8" = yes; then
+  AC_CHECK_HEADER(libutf8.h, [],
+                  AC_MSG_ERROR([Could not find libutf8 library (libutf8.h)]))
+  AC_DEFINE(HAVE_LIBUTF8_H, 1, [Use libutf8's stdio functions])
+  LIBS="$LIBS -lutf8"
+fi
+
 dnl Check for zlib (needed for libpng)
 AC_CHECK_LIB(z, gzgets, , 
   AC_MSG_ERROR([Could not find zlib library.]), )
diff -ur freeciv-2.0.7.orig/server/console.h freeciv-2.0.7/server/console.h
--- freeciv-2.0.7.orig/server/console.h Thu Oct 13 07:43:54 2005
+++ freeciv-2.0.7/server/console.h      Thu Feb  2 16:18:48 2006
@@ -55,7 +55,7 @@
 
 /* write to console and add line-break, and show prompt if required. */
 void con_write(enum rfc_status rfc_status, const char *message, ...)
-     fc__attribute((format (printf, 2, 3)));
+     fc__attribute((__format__ (__printf__, 2, 3)));
 
 /* write to console and add line-break, and show prompt if required.
    ie, same as con_write, but without the format string stuff. */
diff -ur freeciv-2.0.7.orig/server/plrhand.h freeciv-2.0.7/server/plrhand.h
--- freeciv-2.0.7.orig/server/plrhand.h Sat Oct 15 03:25:18 2005
+++ freeciv-2.0.7/server/plrhand.h      Thu Feb  2 16:18:54 2006
@@ -45,20 +45,20 @@
 
 void notify_conn_ex(struct conn_list *dest, struct tile *ptile,
                    enum event_type event, const char *format, ...)
-                    fc__attribute((format (printf, 4, 5)));
+                    fc__attribute((__format__ (__printf__, 4, 5)));
 void vnotify_conn_ex(struct conn_list *dest, struct tile *ptile,
                     enum event_type event, const char *format,
                     va_list vargs);
 void notify_conn(struct conn_list *dest, const char *format, ...) 
-                 fc__attribute((format (printf, 2, 3)));
+                 fc__attribute((__format__ (__printf__, 2, 3)));
 void notify_player_ex(const struct player *pplayer, struct tile *ptile,
                      enum event_type event, const char *format, ...)
-                      fc__attribute((format (printf, 4, 5)));
+                      fc__attribute((__format__ (__printf__, 4, 5)));
 void notify_player(const struct player *pplayer, const char *format, ...)
-                   fc__attribute((format (printf, 2, 3)));
+                   fc__attribute((__format__ (__printf__, 2, 3)));
 void notify_embassies(struct player *pplayer, struct player *exclude,
                      const char *format, ...)
-                     fc__attribute((format (printf, 3, 4)));
+                     fc__attribute((__format__ (__printf__, 3, 4)));
 
 struct conn_list *player_reply_dest(struct player *pplayer);
 
diff -ur freeciv-2.0.7.orig/server/stdinhand.c freeciv-2.0.7/server/stdinhand.c
--- freeciv-2.0.7.orig/server/stdinhand.c       Tue Oct 25 18:52:38 2005
+++ freeciv-2.0.7/server/stdinhand.c    Thu Feb  2 14:12:56 2006
@@ -420,7 +420,7 @@
 static void cmd_reply_prefix(enum command_id cmd, struct connection *caller,
                             enum rfc_status rfc_status, const char *prefix,
                             const char *format, ...)
-     fc__attribute((format (printf, 5, 6)));
+     fc__attribute((__format__ (__printf__, 5, 6)));
 static void cmd_reply_prefix(enum command_id cmd, struct connection *caller,
                             enum rfc_status rfc_status, const char *prefix,
                             const char *format, ...)
@@ -436,7 +436,7 @@
 **************************************************************************/
 static void cmd_reply(enum command_id cmd, struct connection *caller,
                      enum rfc_status rfc_status, const char *format, ...)
-     fc__attribute((format (printf, 4, 5)));
+     fc__attribute((__format__ (__printf__, 4, 5)));
 static void cmd_reply(enum command_id cmd, struct connection *caller,
                      enum rfc_status rfc_status, const char *format, ...)
 {
diff -ur freeciv-2.0.7.orig/utility/astring.h freeciv-2.0.7/utility/astring.h
--- freeciv-2.0.7.orig/utility/astring.h        Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/astring.h     Thu Feb  2 16:17:40 2006
@@ -40,6 +40,6 @@
 void astr_free(struct astring *astr);
 void astr_clear(struct astring *astr);
 void astr_add(struct astring *astr, const char *format, ...)
-      fc__attribute((format(printf, 2, 3)));
+      fc__attribute((__format__(__printf__, 2, 3)));
 
 #endif  /* FC__ASTRING_H */
diff -ur freeciv-2.0.7.orig/utility/fciconv.h freeciv-2.0.7/utility/fciconv.h
--- freeciv-2.0.7.orig/utility/fciconv.h        Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/fciconv.h     Thu Feb  2 16:17:50 2006
@@ -36,6 +36,6 @@
 
 #define fc_printf(...) fc_fprintf(stdout, __VA_ARGS__)
 void fc_fprintf(FILE *stream, const char *format, ...)
-      fc__attribute((format (printf, 2, 3)));
+      fc__attribute((__format__ (__printf__, 2, 3)));
 
 #endif /* FC__FCICONV_H */
diff -ur freeciv-2.0.7.orig/utility/ioz.h freeciv-2.0.7/utility/ioz.h
--- freeciv-2.0.7.orig/utility/ioz.h    Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/ioz.h Thu Feb  2 16:17:58 2006
@@ -36,7 +36,7 @@
 int fz_fclose(fz_FILE *fp);
 char *fz_fgets(char *buffer, int size, fz_FILE *fp);
 int fz_fprintf(fz_FILE *fp, const char *format, ...)
-     fc__attribute((format (printf, 2, 3)));
+     fc__attribute((__format__ (__printf__, 2, 3)));
 
 int fz_ferror(fz_FILE *fp);     
 const char *fz_strerror(fz_FILE *fp);
diff -ur freeciv-2.0.7.orig/utility/log.h freeciv-2.0.7/utility/log.h
--- freeciv-2.0.7.orig/utility/log.h    Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/log.h Thu Feb  2 16:18:08 2006
@@ -58,7 +58,7 @@
 void log_set_callback(log_callback_fn callback);
 
 void real_freelog(int level, const char *message, ...)
-                  fc__attribute((format (printf, 2, 3)));
+                  fc__attribute((__format__ (__printf__, 2, 3)));
 void vreal_freelog(int level, const char *message, va_list ap);
 
 
diff -ur freeciv-2.0.7.orig/utility/registry.h freeciv-2.0.7/utility/registry.h
--- freeciv-2.0.7.orig/utility/registry.h       Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/registry.h    Thu Feb  2 16:18:18 2006
@@ -44,68 +44,68 @@
 
 void secfile_insert_int(struct section_file *my_section_file, 
                        int val, const char *path, ...)
-                        fc__attribute((format (printf, 3, 4)));
+                        fc__attribute((__format__ (__printf__, 3, 4)));
 void secfile_insert_int_comment(struct section_file *my_section_file,
                                int val, const char *const comment, 
                                const char *path, ...)
-                                fc__attribute((format(printf, 4, 5)));
+                                fc__attribute((__format__(__printf__, 4, 5)));
 void secfile_insert_bool(struct section_file *my_section_file,
                         bool val, const char *path, ...)
-                         fc__attribute((format(printf, 3, 4)));
+                         fc__attribute((__format__(__printf__, 3, 4)));
 
 void secfile_insert_str(struct section_file *my_section_file, 
                        const char *sval, const char *path, ...)
-                        fc__attribute((format (printf, 3, 4)));
+                        fc__attribute((__format__ (__printf__, 3, 4)));
 void secfile_insert_str_comment(struct section_file *my_section_file,
                                char *sval, const char *const comment,
                                const char *path, ...)
-                                fc__attribute((format (printf, 4, 5)));
+                                fc__attribute((__format__ (__printf__, 4, 5)));
 void secfile_insert_str_vec(struct section_file *my_section_file, 
                            const char **values, int dim,
                            const char *path, ...)
-                            fc__attribute((format (printf, 4, 5)));
+                            fc__attribute((__format__ (__printf__, 4, 5)));
 
 bool section_file_lookup(struct section_file *my_section_file, 
                        const char *path, ...)
-                        fc__attribute((format (printf, 2, 3)));
+                        fc__attribute((__format__ (__printf__, 2, 3)));
 
 int secfile_lookup_int(struct section_file *my_section_file, 
                       const char *path, ...)
-                       fc__attribute((format (printf, 2, 3)));
+                       fc__attribute((__format__ (__printf__, 2, 3)));
 
 bool secfile_lookup_bool(struct section_file *my_section_file, 
                        const char *path, ...)
-                        fc__attribute((format (printf, 2, 3)));
+                        fc__attribute((__format__ (__printf__, 2, 3)));
                       
 char *secfile_lookup_str(struct section_file *my_section_file, 
                         const char *path, ...)
-                         fc__attribute((format (printf, 2, 3)));
+                         fc__attribute((__format__ (__printf__, 2, 3)));
 
 char *secfile_lookup_str_int(struct section_file *my_section_file, 
                             int *ival, const char *path, ...)
-                             fc__attribute((format (printf, 3, 4)));
+                             fc__attribute((__format__ (__printf__, 3, 4)));
 
 int secfile_lookup_int_default(struct section_file *my_section_file,
                                int def, const char *path, ...)
-                               fc__attribute((format (printf, 3, 4)));
+                               fc__attribute((__format__ (__printf__, 3, 4)));
 
 bool secfile_lookup_bool_default(struct section_file *my_section_file,
                                 bool def, const char *path, ...)
-                                 fc__attribute((format (printf, 3, 4)));
+                                 fc__attribute((__format__ (__printf__, 3, 
4)));
 
 char *secfile_lookup_str_default(struct section_file *my_section_file, 
                                 const char *def, const char *path, ...)
-                                 fc__attribute((format (printf, 3, 4)));
+                                 fc__attribute((__format__ (__printf__, 3, 
4)));
 
 int secfile_lookup_vec_dimen(struct section_file *my_section_file, 
                             const char *path, ...)
-                             fc__attribute((format (printf, 2, 3)));
+                             fc__attribute((__format__ (__printf__, 2, 3)));
 int *secfile_lookup_int_vec(struct section_file *my_section_file,
                            int *dimen, const char *path, ...)
-                            fc__attribute((format (printf, 3, 4)));
+                            fc__attribute((__format__ (__printf__, 3, 4)));
 char **secfile_lookup_str_vec(struct section_file *my_section_file,
                              int *dimen, const char *path, ...)
-                              fc__attribute((format (printf, 3, 4)));
+                              fc__attribute((__format__ (__printf__, 3, 4)));
 
 char **secfile_get_secnames_prefix(struct section_file *my_section_file,
                                   const char *prefix, int *num);
diff -ur freeciv-2.0.7.orig/utility/shared.h freeciv-2.0.7/utility/shared.h
--- freeciv-2.0.7.orig/utility/shared.h Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/shared.h      Thu Feb  2 16:18:28 2006
@@ -216,11 +216,11 @@
 
 char *end_of_strn(char *str, int *nleft);
 int cat_snprintf(char *str, size_t n, const char *format, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 
 #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)));
+      fc__attribute((__format__ (__printf__, 3, 4)));
 
 /**************************************************************************
 ...
diff -ur freeciv-2.0.7.orig/utility/support.c freeciv-2.0.7/utility/support.c
--- freeciv-2.0.7.orig/utility/support.c        Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/support.c     Thu Feb  2 16:17:14 2006
@@ -78,6 +78,9 @@
 #ifdef HAVE_WINSOCK
 #include <winsock.h>
 #endif
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
+#endif
 
 #include "fcintl.h"
 #include "mem.h"
diff -ur freeciv-2.0.7.orig/utility/support.h freeciv-2.0.7/utility/support.h
--- freeciv-2.0.7.orig/utility/support.h        Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/support.h     Thu Feb  2 16:18:34 2006
@@ -43,7 +43,7 @@
 #define sz_strlcat(dest,src) ((void)mystrlcat((dest),(src),sizeof(dest)))
 
 int my_snprintf(char *str, size_t n, const char *format, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 
 int my_vsnprintf(char *str, size_t n, const char *format, va_list ap );
 
diff -ur freeciv-2.0.7.orig/ai/ailog.h freeciv-2.0.7/ai/ailog.h
--- freeciv-2.0.7.orig/ai/ailog.h       Thu Oct 13 07:45:24 2005
+++ freeciv-2.0.7/ai/ailog.h    Thu Feb  2 16:18:40 2006
@@ -32,11 +32,11 @@
 
 void PLAYER_LOG(int level, struct player *pplayer, struct ai_data *ai,
                 const char *msg, ...)
-     fc__attribute((format (printf, 4, 5)));
+     fc__attribute((__format__ (__printf__, 4, 5)));
 void CITY_LOG(int level, struct city *pcity, const char *msg, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 void UNIT_LOG(int level, struct unit *punit, const char *msg, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 void BODYGUARD_LOG(int level, struct unit *punit, const char *msg);
 
 #endif  /* FC__AILOG_H */
diff -ur freeciv-2.0.7.orig/client/climisc.h freeciv-2.0.7/client/climisc.h
--- freeciv-2.0.7.orig/client/climisc.h Thu Oct 13 07:45:46 2005
+++ freeciv-2.0.7/client/climisc.h      Thu Feb  2 16:19:00 2006
@@ -106,7 +106,7 @@
                  enum event_type event, int conn_id);
 void create_event(struct tile *ptile, enum event_type event,
                  const char *format, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 void write_chatline_content(const char *txt);
 
 void reports_freeze(void);
diff -ur freeciv-2.0.7.orig/client/gui-ftwl/gui_text.c 
freeciv-2.0.7/client/gui-ftwl/gui_text.c
--- freeciv-2.0.7.orig/client/gui-ftwl/gui_text.c       Thu Oct 13 07:45:40 2005
+++ freeciv-2.0.7/client/gui-ftwl/gui_text.c    Thu Feb  2 14:13:44 2006
@@ -50,10 +50,10 @@
 
 static void real_add_line(char **buffer, size_t * buffer_size,
                          const char *format, ...)
-fc__attribute((format(printf, 3, 4)));
+fc__attribute((__format__(__printf__, 3, 4)));
 static void real_add(char **buffer, size_t * buffer_size,
                     const char *format, ...)
-fc__attribute((format(printf, 3, 4)));
+fc__attribute((__format__(__printf__, 3, 4)));
 
 #define add_line(...) real_add_line(&out,&out_size, __VA_ARGS__)
 #define add(...) real_add(&out,&out_size, __VA_ARGS__)
diff -ur freeciv-2.0.7.orig/client/text.c freeciv-2.0.7/client/text.c
--- freeciv-2.0.7.orig/client/text.c    Thu Oct 13 07:45:46 2005
+++ freeciv-2.0.7/client/text.c Thu Feb  2 14:13:26 2006
@@ -46,10 +46,10 @@
 
 static void real_add_line(char **buffer, size_t * buffer_size,
                          const char *format, ...)
-fc__attribute((format(printf, 3, 4)));
+fc__attribute((__format__(__printf__, 3, 4)));
 static void real_add(char **buffer, size_t * buffer_size,
                     const char *format, ...)
-fc__attribute((format(printf, 3, 4)));
+fc__attribute((__format__(__printf__, 3, 4)));
 
 #define add_line(...) real_add_line(&out,&out_size, __VA_ARGS__)
 #define add(...) real_add(&out,&out_size, __VA_ARGS__)
diff -ur freeciv-2.0.7.orig/configure.ac freeciv-2.0.7/configure.ac
--- freeciv-2.0.7.orig/configure.ac     Thu Oct 13 07:45:46 2005
+++ freeciv-2.0.7/configure.ac  Thu Feb  2 16:26:24 2006
@@ -321,6 +321,18 @@
   LIBS="$LIBS -lwsock32"
 fi
 
+dnl Check libUTF8
+AC_ARG_WITH(libutf8,
+            AC_HELP_STRING([--with-libutf8],
+               [Use the libutf8 library (needed for some systems)]),
+            [with_libutf8=$withval], [with_libutf8=no])
+if test "$MINGW32" = yes || test "$with_libutf8" = yes; then
+  AC_CHECK_HEADER(libutf8.h, [],
+                  AC_MSG_ERROR([Could not find libutf8 library (libutf8.h)]))
+  AC_DEFINE(HAVE_LIBUTF8_H, 1, [Use libutf8's stdio functions])
+  LIBS="$LIBS -lutf8"
+fi
+
 dnl Check for zlib (needed for libpng)
 AC_CHECK_LIB(z, gzgets, , 
   AC_MSG_ERROR([Could not find zlib library.]), )
diff -ur freeciv-2.0.7.orig/intl/localcharset.c 
freeciv-2.0.7/intl/localcharset.c
--- freeciv-2.0.7.orig/intl/localcharset.c      Thu Oct 13 07:43:54 2005
+++ freeciv-2.0.7/intl/localcharset.c   Thu Feb  2 16:19:38 2006
@@ -55,6 +55,10 @@
 # include <windows.h>
 #endif
 
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
+#endif
+
 #ifndef DIRECTORY_SEPARATOR
 # define DIRECTORY_SEPARATOR '/'
 #endif
diff -ur freeciv-2.0.7.orig/intl/plural.c freeciv-2.0.7/intl/plural.c
--- freeciv-2.0.7.orig/intl/plural.c    Thu Oct 13 07:43:54 2005
+++ freeciv-2.0.7/intl/plural.c Thu Feb  2 16:19:46 2006
@@ -50,6 +50,11 @@
 #endif
 
 #include <stdlib.h>
+
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
+#endif
+
 #include "gettextP.h"
 
 /* Names for the libintl functions are a problem.  They must not clash
diff -ur freeciv-2.0.7.orig/server/console.h freeciv-2.0.7/server/console.h
--- freeciv-2.0.7.orig/server/console.h Thu Oct 13 07:43:54 2005
+++ freeciv-2.0.7/server/console.h      Thu Feb  2 16:18:48 2006
@@ -55,7 +55,7 @@
 
 /* write to console and add line-break, and show prompt if required. */
 void con_write(enum rfc_status rfc_status, const char *message, ...)
-     fc__attribute((format (printf, 2, 3)));
+     fc__attribute((__format__ (__printf__, 2, 3)));
 
 /* write to console and add line-break, and show prompt if required.
    ie, same as con_write, but without the format string stuff. */
diff -ur freeciv-2.0.7.orig/server/plrhand.h freeciv-2.0.7/server/plrhand.h
--- freeciv-2.0.7.orig/server/plrhand.h Sat Oct 15 03:25:18 2005
+++ freeciv-2.0.7/server/plrhand.h      Thu Feb  2 16:18:54 2006
@@ -45,20 +45,20 @@
 
 void notify_conn_ex(struct conn_list *dest, struct tile *ptile,
                    enum event_type event, const char *format, ...)
-                    fc__attribute((format (printf, 4, 5)));
+                    fc__attribute((__format__ (__printf__, 4, 5)));
 void vnotify_conn_ex(struct conn_list *dest, struct tile *ptile,
                     enum event_type event, const char *format,
                     va_list vargs);
 void notify_conn(struct conn_list *dest, const char *format, ...) 
-                 fc__attribute((format (printf, 2, 3)));
+                 fc__attribute((__format__ (__printf__, 2, 3)));
 void notify_player_ex(const struct player *pplayer, struct tile *ptile,
                      enum event_type event, const char *format, ...)
-                      fc__attribute((format (printf, 4, 5)));
+                      fc__attribute((__format__ (__printf__, 4, 5)));
 void notify_player(const struct player *pplayer, const char *format, ...)
-                   fc__attribute((format (printf, 2, 3)));
+                   fc__attribute((__format__ (__printf__, 2, 3)));
 void notify_embassies(struct player *pplayer, struct player *exclude,
                      const char *format, ...)
-                     fc__attribute((format (printf, 3, 4)));
+                     fc__attribute((__format__ (__printf__, 3, 4)));
 
 struct conn_list *player_reply_dest(struct player *pplayer);
 
diff -ur freeciv-2.0.7.orig/server/stdinhand.c freeciv-2.0.7/server/stdinhand.c
--- freeciv-2.0.7.orig/server/stdinhand.c       Tue Oct 25 18:52:38 2005
+++ freeciv-2.0.7/server/stdinhand.c    Thu Feb  2 14:12:56 2006
@@ -420,7 +420,7 @@
 static void cmd_reply_prefix(enum command_id cmd, struct connection *caller,
                             enum rfc_status rfc_status, const char *prefix,
                             const char *format, ...)
-     fc__attribute((format (printf, 5, 6)));
+     fc__attribute((__format__ (__printf__, 5, 6)));
 static void cmd_reply_prefix(enum command_id cmd, struct connection *caller,
                             enum rfc_status rfc_status, const char *prefix,
                             const char *format, ...)
@@ -436,7 +436,7 @@
 **************************************************************************/
 static void cmd_reply(enum command_id cmd, struct connection *caller,
                      enum rfc_status rfc_status, const char *format, ...)
-     fc__attribute((format (printf, 4, 5)));
+     fc__attribute((__format__ (__printf__, 4, 5)));
 static void cmd_reply(enum command_id cmd, struct connection *caller,
                      enum rfc_status rfc_status, const char *format, ...)
 {
diff -ur freeciv-2.0.7.orig/utility/astring.h freeciv-2.0.7/utility/astring.h
--- freeciv-2.0.7.orig/utility/astring.h        Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/astring.h     Thu Feb  2 16:17:40 2006
@@ -40,6 +40,6 @@
 void astr_free(struct astring *astr);
 void astr_clear(struct astring *astr);
 void astr_add(struct astring *astr, const char *format, ...)
-      fc__attribute((format(printf, 2, 3)));
+      fc__attribute((__format__(__printf__, 2, 3)));
 
 #endif  /* FC__ASTRING_H */
diff -ur freeciv-2.0.7.orig/utility/fciconv.c freeciv-2.0.7/utility/fciconv.c
--- freeciv-2.0.7.orig/utility/fciconv.c        Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/fciconv.c     Thu Feb  2 16:19:52 2006
@@ -32,6 +32,10 @@
 #include <libcharset.h>
 #endif
 
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
+#endif
+
 #include "fciconv.h"
 #include "fcintl.h"
 #include "log.h"
diff -ur freeciv-2.0.7.orig/utility/fciconv.h freeciv-2.0.7/utility/fciconv.h
--- freeciv-2.0.7.orig/utility/fciconv.h        Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/fciconv.h     Thu Feb  2 16:17:50 2006
@@ -36,6 +36,6 @@
 
 #define fc_printf(...) fc_fprintf(stdout, __VA_ARGS__)
 void fc_fprintf(FILE *stream, const char *format, ...)
-      fc__attribute((format (printf, 2, 3)));
+      fc__attribute((__format__ (__printf__, 2, 3)));
 
 #endif /* FC__FCICONV_H */
diff -ur freeciv-2.0.7.orig/utility/ioz.c freeciv-2.0.7/utility/ioz.c
--- freeciv-2.0.7.orig/utility/ioz.c    Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/ioz.c Thu Feb  2 16:19:58 2006
@@ -38,6 +38,10 @@
 #include <stdio.h>
 #include <string.h>
 
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
+#endif
+
 #ifdef HAVE_LIBZ
 #include <zlib.h>
 #endif
diff -ur freeciv-2.0.7.orig/utility/ioz.h freeciv-2.0.7/utility/ioz.h
--- freeciv-2.0.7.orig/utility/ioz.h    Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/ioz.h Thu Feb  2 16:17:58 2006
@@ -36,7 +36,7 @@
 int fz_fclose(fz_FILE *fp);
 char *fz_fgets(char *buffer, int size, fz_FILE *fp);
 int fz_fprintf(fz_FILE *fp, const char *format, ...)
-     fc__attribute((format (printf, 2, 3)));
+     fc__attribute((__format__ (__printf__, 2, 3)));
 
 int fz_ferror(fz_FILE *fp);     
 const char *fz_strerror(fz_FILE *fp);
diff -ur freeciv-2.0.7.orig/utility/log.h freeciv-2.0.7/utility/log.h
--- freeciv-2.0.7.orig/utility/log.h    Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/log.h Thu Feb  2 16:18:08 2006
@@ -58,7 +58,7 @@
 void log_set_callback(log_callback_fn callback);
 
 void real_freelog(int level, const char *message, ...)
-                  fc__attribute((format (printf, 2, 3)));
+                  fc__attribute((__format__ (__printf__, 2, 3)));
 void vreal_freelog(int level, const char *message, va_list ap);
 
 
diff -ur freeciv-2.0.7.orig/utility/netintf.c freeciv-2.0.7/utility/netintf.c
--- freeciv-2.0.7.orig/utility/netintf.c        Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/netintf.c     Thu Feb  2 16:20:10 2006
@@ -49,6 +49,9 @@
 #ifdef WIN32_NATIVE
 #include <windows.h>   /* GetTempPath */
 #endif
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
+#endif
 
 #include "log.h"
 #include "shared.h"            /* TRUE, FALSE */
diff -ur freeciv-2.0.7.orig/utility/registry.h freeciv-2.0.7/utility/registry.h
--- freeciv-2.0.7.orig/utility/registry.h       Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/registry.h    Thu Feb  2 16:18:18 2006
@@ -44,68 +44,68 @@
 
 void secfile_insert_int(struct section_file *my_section_file, 
                        int val, const char *path, ...)
-                        fc__attribute((format (printf, 3, 4)));
+                        fc__attribute((__format__ (__printf__, 3, 4)));
 void secfile_insert_int_comment(struct section_file *my_section_file,
                                int val, const char *const comment, 
                                const char *path, ...)
-                                fc__attribute((format(printf, 4, 5)));
+                                fc__attribute((__format__(__printf__, 4, 5)));
 void secfile_insert_bool(struct section_file *my_section_file,
                         bool val, const char *path, ...)
-                         fc__attribute((format(printf, 3, 4)));
+                         fc__attribute((__format__(__printf__, 3, 4)));
 
 void secfile_insert_str(struct section_file *my_section_file, 
                        const char *sval, const char *path, ...)
-                        fc__attribute((format (printf, 3, 4)));
+                        fc__attribute((__format__ (__printf__, 3, 4)));
 void secfile_insert_str_comment(struct section_file *my_section_file,
                                char *sval, const char *const comment,
                                const char *path, ...)
-                                fc__attribute((format (printf, 4, 5)));
+                                fc__attribute((__format__ (__printf__, 4, 5)));
 void secfile_insert_str_vec(struct section_file *my_section_file, 
                            const char **values, int dim,
                            const char *path, ...)
-                            fc__attribute((format (printf, 4, 5)));
+                            fc__attribute((__format__ (__printf__, 4, 5)));
 
 bool section_file_lookup(struct section_file *my_section_file, 
                        const char *path, ...)
-                        fc__attribute((format (printf, 2, 3)));
+                        fc__attribute((__format__ (__printf__, 2, 3)));
 
 int secfile_lookup_int(struct section_file *my_section_file, 
                       const char *path, ...)
-                       fc__attribute((format (printf, 2, 3)));
+                       fc__attribute((__format__ (__printf__, 2, 3)));
 
 bool secfile_lookup_bool(struct section_file *my_section_file, 
                        const char *path, ...)
-                        fc__attribute((format (printf, 2, 3)));
+                        fc__attribute((__format__ (__printf__, 2, 3)));
                       
 char *secfile_lookup_str(struct section_file *my_section_file, 
                         const char *path, ...)
-                         fc__attribute((format (printf, 2, 3)));
+                         fc__attribute((__format__ (__printf__, 2, 3)));
 
 char *secfile_lookup_str_int(struct section_file *my_section_file, 
                             int *ival, const char *path, ...)
-                             fc__attribute((format (printf, 3, 4)));
+                             fc__attribute((__format__ (__printf__, 3, 4)));
 
 int secfile_lookup_int_default(struct section_file *my_section_file,
                                int def, const char *path, ...)
-                               fc__attribute((format (printf, 3, 4)));
+                               fc__attribute((__format__ (__printf__, 3, 4)));
 
 bool secfile_lookup_bool_default(struct section_file *my_section_file,
                                 bool def, const char *path, ...)
-                                 fc__attribute((format (printf, 3, 4)));
+                                 fc__attribute((__format__ (__printf__, 3, 
4)));
 
 char *secfile_lookup_str_default(struct section_file *my_section_file, 
                                 const char *def, const char *path, ...)
-                                 fc__attribute((format (printf, 3, 4)));
+                                 fc__attribute((__format__ (__printf__, 3, 
4)));
 
 int secfile_lookup_vec_dimen(struct section_file *my_section_file, 
                             const char *path, ...)
-                             fc__attribute((format (printf, 2, 3)));
+                             fc__attribute((__format__ (__printf__, 2, 3)));
 int *secfile_lookup_int_vec(struct section_file *my_section_file,
                            int *dimen, const char *path, ...)
-                            fc__attribute((format (printf, 3, 4)));
+                            fc__attribute((__format__ (__printf__, 3, 4)));
 char **secfile_lookup_str_vec(struct section_file *my_section_file,
                              int *dimen, const char *path, ...)
-                              fc__attribute((format (printf, 3, 4)));
+                              fc__attribute((__format__ (__printf__, 3, 4)));
 
 char **secfile_get_secnames_prefix(struct section_file *my_section_file,
                                   const char *prefix, int *num);
diff -ur freeciv-2.0.7.orig/utility/shared.h freeciv-2.0.7/utility/shared.h
--- freeciv-2.0.7.orig/utility/shared.h Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/shared.h      Thu Feb  2 16:18:28 2006
@@ -216,11 +216,11 @@
 
 char *end_of_strn(char *str, int *nleft);
 int cat_snprintf(char *str, size_t n, const char *format, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 
 #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)));
+      fc__attribute((__format__ (__printf__, 3, 4)));
 
 /**************************************************************************
 ...
diff -ur freeciv-2.0.7.orig/utility/support.c freeciv-2.0.7/utility/support.c
--- freeciv-2.0.7.orig/utility/support.c        Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/support.c     Thu Feb  2 16:17:14 2006
@@ -78,6 +78,9 @@
 #ifdef HAVE_WINSOCK
 #include <winsock.h>
 #endif
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
+#endif
 
 #include "fcintl.h"
 #include "mem.h"
diff -ur freeciv-2.0.7.orig/utility/support.h freeciv-2.0.7/utility/support.h
--- freeciv-2.0.7.orig/utility/support.h        Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/support.h     Thu Feb  2 16:18:34 2006
@@ -43,7 +43,7 @@
 #define sz_strlcat(dest,src) ((void)mystrlcat((dest),(src),sizeof(dest)))
 
 int my_snprintf(char *str, size_t n, const char *format, ...)
-     fc__attribute((format (printf, 3, 4)));
+     fc__attribute((__format__ (__printf__, 3, 4)));
 
 int my_vsnprintf(char *str, size_t n, const char *format, va_list ap );
 
diff -ur freeciv-2.0.7.orig/configure.ac freeciv-2.0.7/configure.ac
--- freeciv-2.0.7.orig/configure.ac     Thu Oct 13 07:45:46 2005
+++ freeciv-2.0.7/configure.ac  Thu Feb  2 17:05:44 2006
@@ -321,6 +321,18 @@
   LIBS="$LIBS -lwsock32"
 fi
 
+dnl Check libUTF8
+AC_ARG_WITH(libutf8,
+            AC_HELP_STRING([--with-libutf8],
+               [Use the libutf8 library (needed for some systems)]),
+            [with_libutf8=$withval], [with_libutf8=no])
+if test "$MINGW32" = yes || test "$with_libutf8" = yes; then
+  AC_CHECK_HEADER(libutf8.h, [],
+                  AC_MSG_ERROR([Could not find libutf8 library (libutf8.h)]))
+  AC_DEFINE(HAVE_LIBUTF8_H, 1, [Use libutf8's stdio functions])
+  LIBS="$LIBS -lutf8"
+fi
+
 dnl Check for zlib (needed for libpng)
 AC_CHECK_LIB(z, gzgets, , 
   AC_MSG_ERROR([Could not find zlib library.]), )
diff -ur freeciv-2.0.7.orig/utility/support.c freeciv-2.0.7/utility/support.c
--- freeciv-2.0.7.orig/utility/support.c        Thu Oct 13 07:43:44 2005
+++ freeciv-2.0.7/utility/support.c     Thu Feb  2 17:06:34 2006
@@ -85,6 +85,10 @@
 
 #include "support.h"
 
+#ifdef HAVE_LIBUTF8_H
+#include <libutf8.h>
+#endif
+
 /***************************************************************
   Compare strings like strcmp(), but ignoring case.
 ***************************************************************/

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