aboutsummaryrefslogtreecommitdiff
path: root/libXfont/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'libXfont/src/util')
-rw-r--r--libXfont/src/util/Makefile.in1
-rw-r--r--libXfont/src/util/atom.c8
-rw-r--r--libXfont/src/util/fontxlfd.c18
3 files changed, 11 insertions, 16 deletions
diff --git a/libXfont/src/util/Makefile.in b/libXfont/src/util/Makefile.in
index 5b0d85e40..802d9fb27 100644
--- a/libXfont/src/util/Makefile.in
+++ b/libXfont/src/util/Makefile.in
@@ -97,6 +97,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
diff --git a/libXfont/src/util/atom.c b/libXfont/src/util/atom.c
index f15e3d8de..c47cb5c80 100644
--- a/libXfont/src/util/atom.c
+++ b/libXfont/src/util/atom.c
@@ -54,7 +54,7 @@ static int reverseMapSize;
static Atom lastAtom;
static int
-Hash(char *string, int len)
+Hash(const char *string, int len)
{
int h;
@@ -146,8 +146,8 @@ NameEqual (const char *a, const char *b, int l)
#pragma weak MakeAtom
#endif
-weak Atom
-MakeAtom(char *string, unsigned len, int makeit)
+weak Atom
+MakeAtom(const char *string, unsigned len, int makeit)
{
AtomListPtr a;
int hash;
@@ -223,7 +223,7 @@ MakeAtom(char *string, unsigned len, int makeit)
#pragma weak ValidAtom
#endif
-weak int
+weak int
ValidAtom(Atom atom)
{
return (atom != None) && (atom <= lastAtom);
diff --git a/libXfont/src/util/fontxlfd.c b/libXfont/src/util/fontxlfd.c
index 2bd56c07d..ace87809b 100644
--- a/libXfont/src/util/fontxlfd.c
+++ b/libXfont/src/util/fontxlfd.c
@@ -71,7 +71,7 @@ GetInt(char *ptr, int *val)
#ifndef NO_LOCALE
static struct lconv *locale = 0;
#endif
-static char *radix = ".", *plus = "+", *minus = "-";
+static const char *radix = ".", *plus = "+", *minus = "-";
static char *
readreal(char *ptr, double *result)
@@ -117,7 +117,6 @@ readreal(char *ptr, double *result)
static char *
xlfd_double_to_text(double value, char *buffer, int space_required)
{
- char formatbuf[40];
register char *p1;
int ndigits, exponent;
@@ -133,14 +132,12 @@ xlfd_double_to_text(double value, char *buffer, int space_required)
minus = locale->negative_sign;
}
#endif
- /* Compute a format to use to render the number */
- sprintf(formatbuf, "%%.%dle", XLFD_NDIGITS);
if (space_required)
*buffer++ = ' ';
/* Render the number using printf's idea of formatting */
- sprintf(buffer, formatbuf, value);
+ sprintf(buffer, "%.*le", XLFD_NDIGITS, value);
/* Find and read the exponent value */
for (p1 = buffer + strlen(buffer);
@@ -157,16 +154,14 @@ xlfd_double_to_text(double value, char *buffer, int space_required)
if (exponent >= XLFD_NDIGITS || ndigits - exponent > XLFD_NDIGITS + 1)
{
/* Scientific */
- sprintf(formatbuf, "%%.%dle", ndigits - 1);
- sprintf(buffer, formatbuf, value);
+ sprintf(buffer, "%.*le", ndigits - 1, value);
}
else
{
/* Fixed */
ndigits -= exponent + 1;
if (ndigits < 0) ndigits = 0;
- sprintf(formatbuf, "%%.%dlf", ndigits);
- sprintf(buffer, formatbuf, value);
+ sprintf(buffer, "%.*lf", ndigits, value);
if (exponent < 0)
{
p1 = buffer;
@@ -265,10 +260,9 @@ xlfd_round_double(double x)
* If not IEEE 754: Let printf() do it for you.
*/
- char formatbuf[40], buffer[40];
+ char buffer[40];
- sprintf(formatbuf, "%%.%dlg", XLFD_NDIGITS);
- sprintf(buffer, formatbuf, x);
+ sprintf(buffer, "%.*lg", XLFD_NDIGITS, x);
return atof(buffer);
}
}