summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Cristau <jcristau@debian.org>2015-07-26 18:32:23 +0200
committerJulien Cristau <jcristau@debian.org>2015-09-24 19:28:18 +0200
commit8bbc9af3ef1160f16f176be07c917f9cccf229b2 (patch)
treed47b6d7bc65778fb64c654a370b12bfc66151338
parent42f3a39c3085afd9ef904ae39102fd49bbc2e4a5 (diff)
make FontEncDirectory return a const string
Its comment already said "This string is static and should not be modified". encparse.c: In function 'FontEncDirectory': encparse.c:844:17: warning: assignment discards 'const' qualifier from pointer target type dir = FONT_ENCODINGS_DIRECTORY; ^ Signed-off-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--include/X11/fonts/fontenc.h2
-rw-r--r--src/encparse.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/include/X11/fonts/fontenc.h b/include/X11/fonts/fontenc.h
index 709f97f..6c35c93 100644
--- a/include/X11/fonts/fontenc.h
+++ b/include/X11/fonts/fontenc.h
@@ -109,7 +109,7 @@ char *FontEncName(unsigned, FontMapPtr);
/* Return a pointer to the name of the system encodings directory. */
/* This string is static and should not be modified. */
-char *FontEncDirectory(void);
+const char *FontEncDirectory(void);
/* Identify an encoding file. If fileName doesn't exist, or is not an
encoding file, return NULL, otherwise returns a NULL-terminated
diff --git a/src/encparse.c b/src/encparse.c
index f47454a..548110e 100644
--- a/src/encparse.c
+++ b/src/encparse.c
@@ -827,13 +827,13 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
return NULL;
}
-char *
+const char *
FontEncDirectory(void)
{
- static char *dir = NULL;
+ static const char *dir = NULL;
if (dir == NULL) {
- char *c = getenv("FONT_ENCODINGS_DIRECTORY");
+ const char *c = getenv("FONT_ENCODINGS_DIRECTORY");
if (c) {
dir = strdup(c);
@@ -941,7 +941,7 @@ FontEncReallyLoad(const char *charset, const char *fontFileName)
{
FontEncPtr encoding;
char dir[MAXFONTFILENAMELEN], dirname[MAXFONTFILENAMELEN];
- char *d;
+ const char *d;
if (fontFileName) {
parseFontFileName(fontFileName, dirname, dir);