Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] Re: (PR#8664) gettext and const char *'s
Home

[Freeciv-Dev] Re: (PR#8664) gettext and const char *'s

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#8664) gettext and const char *'s
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 13 May 2004 11:16:29 -0700
Reply-to: rt@xxxxxxxxxxx

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

This patch makes strings returned by N_() const.  Only the gtk2 client 
is modified.

Note that N_() is a no-op so a cast is not permitted here.  For instance

   "/" N_("Game") "/" N_("Local _Options")

is a legal string.

However it would be an error to modify these strings (gettext would be 
thwarted), so they should be const.

jason


? eff
Index: client/gui-gtk-2.0/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/helpdlg.c,v
retrieving revision 1.31
diff -u -r1.31 helpdlg.c
--- client/gui-gtk-2.0/helpdlg.c        1 May 2004 17:28:47 -0000       1.31
+++ client/gui-gtk-2.0/helpdlg.c        13 May 2004 18:13:17 -0000
@@ -84,13 +84,13 @@
 static int       help_history_pos;
 
 
-static char *help_ilabel_name[6] =
+static const char *help_ilabel_name[6] =
 { N_("Cost:"), NULL, N_("Upkeep:"), NULL, N_("Requirement:"), NULL };
 
-static char *help_wlabel_name[6] =
+static const char *help_wlabel_name[6] =
 { N_("Cost:"), NULL, N_("Requirement:"), NULL, N_("Obsolete by:"), NULL };
 
-static char *help_ulabel_name[5][5] =
+static const char *help_ulabel_name[5][5] =
 {
     { N_("Cost:"),             NULL, NULL, N_("Attack:"),      NULL },
     { N_("Defense:"),          NULL, NULL, N_("Move:") ,       NULL },
@@ -99,7 +99,7 @@
     { N_("Requirement:"),      NULL, NULL, N_("Obsolete by:"), NULL }
 };
 
-static char *help_tlabel_name[4][5] =
+static const char *help_tlabel_name[4][5] =
 {
     { N_("Move/Defense:"),     NULL, NULL, N_("Food/Res/Trade:"),      NULL },
     { N_("Sp1 F/R/T:"),                NULL, NULL, N_("Sp2 F/R/T:"),           
NULL },
Index: client/gui-gtk-2.0/inteldlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/inteldlg.c,v
retrieving revision 1.12
diff -u -r1.12 inteldlg.c
--- client/gui-gtk-2.0/inteldlg.c       1 May 2004 17:28:47 -0000       1.12
+++ client/gui-gtk-2.0/inteldlg.c       13 May 2004 18:13:17 -0000
@@ -75,7 +75,7 @@
   struct city *pcity;
 
   int i;
-  static char *table_text[] = {
+  static const char *table_text[] = {
     N_("Ruler:"),
     N_("Government:"),
     N_("Capital:"),
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.316
diff -u -r1.316 stdinhand.c
--- server/stdinhand.c  11 May 2004 17:59:34 -0000      1.316
+++ server/stdinhand.c  13 May 2004 18:13:20 -0000
@@ -142,14 +142,14 @@
   SSET_NUM_CATEGORIES
 };
 
-char *sset_category_names[]= { N_("Geological"),
-                              N_("Ecological"),
-                              N_("Sociological"),
-                              N_("Economic"),
-                              N_("Military"),
-                              N_("Scientific"),
-                              N_("Internal"),
-                              N_("Networking") };
+const char *sset_category_names[]= { N_("Geological"),
+                                    N_("Ecological"),
+                                    N_("Sociological"),
+                                    N_("Economic"),
+                                    N_("Military"),
+                                    N_("Scientific"),
+                                    N_("Internal"),
+                                    N_("Networking") };
 
 #define SSET_MAX_LEN  16             /* max setting name length (plus nul) */
 #define TOKEN_DELIMITERS " \t\n,"

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