fontxlfd.c   fontxlfd.c 
skipping to change at line 72 skipping to change at line 72
return ptr; return ptr;
return (char *) 0; return (char *) 0;
} }
#define minchar(p) ((p).min_char_low + ((p).min_char_high << 8)) #define minchar(p) ((p).min_char_low + ((p).min_char_high << 8))
#define maxchar(p) ((p).max_char_low + ((p).max_char_high << 8)) #define maxchar(p) ((p).max_char_low + ((p).max_char_high << 8))
#ifndef NO_LOCALE #ifndef NO_LOCALE
static struct lconv *locale = 0; static struct lconv *locale = 0;
#endif #endif
static char *radix = ".", *plus = "+", *minus = "-"; static const char *radix = ".", *plus = "+", *minus = "-";
static char * static char *
readreal(char *ptr, double *result) readreal(char *ptr, double *result)
{ {
char buffer[80], *p1, *p2; char buffer[80], *p1, *p2;
#ifndef NO_LOCALE #ifndef NO_LOCALE
/* Figure out what symbols apply in this locale */ /* Figure out what symbols apply in this locale */
if (!locale) if (!locale)
skipping to change at line 118 skipping to change at line 118
/* Now we have something that strtod() can interpret... do it. */ /* Now we have something that strtod() can interpret... do it. */
*result = strtod(buffer, &p1); *result = strtod(buffer, &p1);
/* Return NULL if failure, pointer past number if success */ /* Return NULL if failure, pointer past number if success */
return (p1 == buffer) ? (char *)0 : (ptr + (p1 - buffer)); return (p1 == buffer) ? (char *)0 : (ptr + (p1 - buffer));
} }
static char * static char *
xlfd_double_to_text(double value, char *buffer, int space_required) xlfd_double_to_text(double value, char *buffer, int space_required)
{ {
char formatbuf[40];
register char *p1; register char *p1;
int ndigits, exponent; int ndigits, exponent;
#ifndef NO_LOCALE #ifndef NO_LOCALE
if (!locale) if (!locale)
{ {
locale = localeconv(); locale = localeconv();
if (locale->decimal_point && *locale->decimal_point) if (locale->decimal_point && *locale->decimal_point)
radix = locale->decimal_point; radix = locale->decimal_point;
if (locale->positive_sign && *locale->positive_sign) if (locale->positive_sign && *locale->positive_sign)
plus = locale->positive_sign; plus = locale->positive_sign;
if (locale->negative_sign && *locale->negative_sign) if (locale->negative_sign && *locale->negative_sign)
minus = locale->negative_sign; minus = locale->negative_sign;
} }
#endif #endif
/* Compute a format to use to render the number */
sprintf(formatbuf, "%%.%dle", XLFD_NDIGITS);
if (space_required) if (space_required)
*buffer++ = ' '; *buffer++ = ' ';
/* Render the number using printf's idea of formatting */ /* 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 */ /* Find and read the exponent value */
for (p1 = buffer + strlen(buffer); for (p1 = buffer + strlen(buffer);
*p1-- != 'e' && p1[1] != 'E';); *p1-- != 'e' && p1[1] != 'E';);
exponent = atoi(p1 + 2); exponent = atoi(p1 + 2);
if (value == 0.0) exponent = 0; if (value == 0.0) exponent = 0;
/* Figure out how many digits are significant */ /* Figure out how many digits are significant */
while (p1 >= buffer && (!isdigit(*p1) || *p1 == '0')) p1--; while (p1 >= buffer && (!isdigit(*p1) || *p1 == '0')) p1--;
ndigits = 0; ndigits = 0;
while (p1 >= buffer) if (isdigit(*p1--)) ndigits++; while (p1 >= buffer) if (isdigit(*p1--)) ndigits++;
/* Figure out notation to use */ /* Figure out notation to use */
if (exponent >= XLFD_NDIGITS || ndigits - exponent > XLFD_NDIGITS + 1) if (exponent >= XLFD_NDIGITS || ndigits - exponent > XLFD_NDIGITS + 1)
{ {
/* Scientific */ /* Scientific */
sprintf(formatbuf, "%%.%dle", ndigits - 1); sprintf(buffer, "%.*le", ndigits - 1, value);
sprintf(buffer, formatbuf, value);
} }
else else
{ {
/* Fixed */ /* Fixed */
ndigits -= exponent + 1; ndigits -= exponent + 1;
if (ndigits < 0) ndigits = 0; if (ndigits < 0) ndigits = 0;
sprintf(formatbuf, "%%.%dlf", ndigits); sprintf(buffer, "%.*lf", ndigits, value);
sprintf(buffer, formatbuf, value);
if (exponent < 0) if (exponent < 0)
{ {
p1 = buffer; p1 = buffer;
while (*p1 && *p1 != '0') p1++; while (*p1 && *p1 != '0') p1++;
while (*p1++) p1[-1] = *p1; while (*p1++) p1[-1] = *p1;
} }
} }
/* Last step, convert the locale-specific sign and radix characters /* Last step, convert the locale-specific sign and radix characters
to our own. */ to our own. */
skipping to change at line 267 skipping to change at line 262
return d.d; return d.d;
} }
else else
#endif #endif
#endif /* i386 || __i386__ */ #endif /* i386 || __i386__ */
{ {
/* /*
* If not IEEE 754: Let printf() do it for you. * 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, "%.*lg", XLFD_NDIGITS, x);
sprintf(buffer, formatbuf, x);
return atof(buffer); return atof(buffer);
} }
} }
static char * static char *
GetMatrix(char *ptr, FontScalablePtr vals, int which) GetMatrix(char *ptr, FontScalablePtr vals, int which)
{ {
double *matrix; double *matrix;
if (which == PIXELSIZE_MASK) if (which == PIXELSIZE_MASK)
 End of changes. 8 change blocks. 
12 lines changed or deleted 6 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/