[PATCH app/fonttosfnt 1/5] Constify a few string arguments

Peter Hutterer peter.hutterer at who-t.net
Tue Jul 31 01:53:14 UTC 2018


Cuts down on compiler warning by at least 64%, what a bargain!

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 fonttosfnt.h |  8 ++++----
 util.c       | 10 +++++-----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fonttosfnt.h b/fonttosfnt.h
index d6aa004..159535f 100644
--- a/fonttosfnt.h
+++ b/fonttosfnt.h
@@ -166,10 +166,10 @@ int writeFile(char *filename, FontPtr);
 #define PROP_INTEGER 2
 #define PROP_CARDINAL 3
 
-char *sprintf_alloc(char *f, ...);
-char *vsprintf_alloc(char *f, va_list args);
-char *makeUTF16(char *);
-unsigned makeName(char*);
+char *sprintf_alloc(const char *f, ...);
+char *vsprintf_alloc(const char *f, va_list args);
+char *makeUTF16(const char *);
+unsigned makeName(const char*);
 int macTime(int *, unsigned *);
 unsigned faceFoundry(FT_Face);
 char *faceEncoding(FT_Face);
diff --git a/util.c b/util.c
index 72ca9b9..81c0489 100644
--- a/util.c
+++ b/util.c
@@ -69,7 +69,7 @@ extern void unsetenv(const char *name);
 #endif
 
 char*
-sprintf_alloc(char *f, ...)
+sprintf_alloc(const char *f, ...)
 {
     char *s;
     va_list args;
@@ -81,7 +81,7 @@ sprintf_alloc(char *f, ...)
 
 #if HAVE_VASPRINTF
 char*
-vsprintf_alloc(char *f, va_list args)
+vsprintf_alloc(const char *f, va_list args)
 {
     char *r;
     int rc;
@@ -93,7 +93,7 @@ vsprintf_alloc(char *f, va_list args)
 }
 #else
 char*
-vsprintf_alloc(char *f, va_list args)
+vsprintf_alloc(const char *f, va_list args)
 {
     int n, size = 12;
     char *string;
@@ -127,7 +127,7 @@ vsprintf_alloc(char *f, va_list args)
 /* Build a UTF-16 string from a Latin-1 string.  
    Result is not NUL-terminated. */
 char *
-makeUTF16(char *string)
+makeUTF16(const char *string)
 {
     int i;
     int n = strlen(string);
@@ -142,7 +142,7 @@ makeUTF16(char *string)
 }
 
 unsigned
-makeName(char *s)
+makeName(const char *s)
 {
     return s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3];
 }
-- 
2.17.1



More information about the xorg-devel mailing list