[libfontenc PATCH] make FontEncDirectory return a const string
Julien Cristau
jcristau at debian.org
Sun Jul 26 10:21:03 PDT 2015
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 at debian.org>
---
include/X11/fonts/fontenc.h | 2 +-
src/encparse.c | 8 ++++----
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);
--
2.1.4
More information about the xorg-devel
mailing list