summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2019-03-19 20:31:29 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2019-04-15 19:43:52 -0400
commit965bc251c1d8391e672f277686254299627d4e3c (patch)
treeefc7e9715a0453270a0ef4e21c04a6943972ebaa
parentc131d277ef061716b97e27cccc094bf1c0ae222f (diff)
downloadxorg-lib-libXt-965bc251c1d8391e672f277686254299627d4e3c.tar.gz
Referring to the xterm FAQ
https://invisible-island.net/xterm/xterm.faq.html#building_it I would like to add an optional feature which makes the String typedef "const" if _CONST_X_STRING is defined. Modifying the Intrinsic.h header is only a partial solution because the library has not been modified to take advantage of this (if it had, most of the const-warnings from gcc would go away). This change modifies the header file as well as the makestrs.c program which generates Shell.h and StringDefs.h so that they use String-casts rather than char*-casts (reducing the warnings seen when compiling with Xt's header files). Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
-rw-r--r--include/X11/Intrinsic.h9
-rw-r--r--util/makestrs.c4
2 files changed, 11 insertions, 2 deletions
diff --git a/include/X11/Intrinsic.h b/include/X11/Intrinsic.h
index 794b820..85afbf1 100644
--- a/include/X11/Intrinsic.h
+++ b/include/X11/Intrinsic.h
@@ -63,7 +63,16 @@ in this Software without prior written authorization from The Open Group.
#define XtSpecificationRelease 6
+/*
+ * As used in its function interface, the String type of libXt can be readonly.
+ * But compiling libXt with this feature may require some internal changes,
+ * e.g., casts and occasionally using a plain "char*".
+ */
+#ifdef _CONST_X_STRING
+typedef const char *String;
+#else
typedef char *String;
+#endif
/* We do this in order to get "const" declarations to work right. We
* use _XtString instead of String so that C++ applications can
diff --git a/util/makestrs.c b/util/makestrs.c
index e626dee..774faa4 100644
--- a/util/makestrs.c
+++ b/util/makestrs.c
@@ -151,7 +151,7 @@ static void IntelABIWriteHeader (FILE *f, File *phile)
externrefstr, conststr ? conststr : fileprotstr, t->name);
for (te = t->tableent; te; te = te->next) {
(void) fprintf (f,
- "#ifndef %s%s\n#define %s%s ((char*)&%s[%lu])\n#endif\n",
+ "#ifndef %s%s\n#define %s%s ((String)&%s[%lu])\n#endif\n",
prefixstr, te->left, prefixstr, te->left, t->name,
(unsigned long) te->offset);
}
@@ -230,7 +230,7 @@ static void DefaultWriteHeader (FILE *f, File *phile)
for (t = phile->table; t; t = t->next) {
for (te = t->tableent; te; te = te->next) {
(void) fprintf (f,
- "#ifndef %s%s\n#define %s%s ((char*)&%s[%lu])\n#endif\n",
+ "#ifndef %s%s\n#define %s%s ((String)&%s[%lu])\n#endif\n",
prefixstr, te->left, prefixstr, te->left, phile->table->name,
(unsigned long) te->offset);
}