bdfutils.c | bdfutils.c | |||
---|---|---|---|---|
skipping to change at line 71 | skipping to change at line 71 | |||
#include <X11/fonts/fontstruct.h> | #include <X11/fonts/fontstruct.h> | |||
/* use bitmap structure */ | /* use bitmap structure */ | |||
#include <X11/fonts/bitmap.h> | #include <X11/fonts/bitmap.h> | |||
#include <X11/fonts/bdfint.h> | #include <X11/fonts/bdfint.h> | |||
int bdfFileLineNum; | int bdfFileLineNum; | |||
/***====================================================================*** / | /***====================================================================*** / | |||
void | void | |||
bdfError(char* message, ...) | bdfError(const char* message, ...) | |||
{ | { | |||
va_list args; | va_list args; | |||
va_start (args, message); | va_start (args, message); | |||
fprintf(stderr, "BDF Error on line %d: ", bdfFileLineNum); | fprintf(stderr, "BDF Error on line %d: ", bdfFileLineNum); | |||
vfprintf(stderr, message, args); | vfprintf(stderr, message, args); | |||
va_end (args); | va_end (args); | |||
} | } | |||
/***====================================================================*** / | /***====================================================================*** / | |||
void | void | |||
bdfWarning(char *message, ...) | bdfWarning(const char *message, ...) | |||
{ | { | |||
va_list args; | va_list args; | |||
va_start (args, message); | va_start (args, message); | |||
fprintf(stderr, "BDF Warning on line %d: ", bdfFileLineNum); | fprintf(stderr, "BDF Warning on line %d: ", bdfFileLineNum); | |||
vfprintf(stderr, message, args); | vfprintf(stderr, message, args); | |||
va_end (args); | va_end (args); | |||
} | } | |||
/* | /* | |||
skipping to change at line 130 | skipping to change at line 130 | |||
return NULL; | return NULL; | |||
if (b != buf && !bdfIsPrefix(buf, "COMMENT")) | if (b != buf && !bdfIsPrefix(buf, "COMMENT")) | |||
break; | break; | |||
} | } | |||
return buf; | return buf; | |||
} | } | |||
/***====================================================================*** / | /***====================================================================*** / | |||
Atom | Atom | |||
bdfForceMakeAtom(char *str, int *size) | bdfForceMakeAtom(const char *str, int *size) | |||
{ | { | |||
register int len = strlen(str); | register int len = strlen(str); | |||
Atom the_atom; | Atom the_atom; | |||
if (size != NULL) | if (size != NULL) | |||
*size += len + 1; | *size += len + 1; | |||
the_atom = MakeAtom(str, len, TRUE); | the_atom = MakeAtom(str, len, TRUE); | |||
if (the_atom == None) | if (the_atom == None) | |||
bdfError("Atom allocation failed\n"); | bdfError("Atom allocation failed\n"); | |||
return the_atom; | return the_atom; | |||
skipping to change at line 177 | skipping to change at line 177 | |||
if (*pp == ' ' || *pp == '\t' || *pp == '\015' || *pp == '\n') { | if (*pp == ' ' || *pp == '\t' || *pp == '\015' || *pp == '\n') { | |||
*pp = 0; | *pp = 0; | |||
break; | break; | |||
} | } | |||
return bdfForceMakeAtom(s, NULL); | return bdfForceMakeAtom(s, NULL); | |||
} | } | |||
/* quoted string: strip outer quotes and undouble inner quotes */ | /* quoted string: strip outer quotes and undouble inner quotes */ | |||
s++; | s++; | |||
pp = p = malloc((unsigned) strlen(s) + 1); | pp = p = malloc((unsigned) strlen(s) + 1); | |||
if (pp == NULL) { | if (pp == NULL) { | |||
bdfError("Couldn't allocate property value string (%d)\n", strlen(s) + 1) | bdfError("Couldn't allocate property value string (%d)\n", | |||
; | (int) strlen(s) + 1); | |||
return None; | return None; | |||
} | } | |||
while (*s) { | while (*s) { | |||
if (*s == '"') { | if (*s == '"') { | |||
if (*(s + 1) != '"') { | if (*(s + 1) != '"') { | |||
*p++ = 0; | *p++ = 0; | |||
atom = bdfForceMakeAtom(pp, NULL); | atom = bdfForceMakeAtom(pp, NULL); | |||
free(pp); | free(pp); | |||
return atom; | return atom; | |||
} else { | } else { | |||
s++; | s++; | |||
} | } | |||
} | } | |||
*p++ = *s++; | *p++ = *s++; | |||
} | } | |||
free (pp); | free (pp); | |||
bdfError("unterminated quoted string property: %s\n", (pointer) orig_s) ; | bdfError("unterminated quoted string property: %s\n", orig_s); | |||
return None; | return None; | |||
} | } | |||
/***====================================================================*** / | /***====================================================================*** / | |||
/* | /* | |||
* return TRUE if string is a valid integer | * return TRUE if string is a valid integer | |||
*/ | */ | |||
int | int | |||
bdfIsInteger(char *str) | bdfIsInteger(char *str) | |||
skipping to change at line 252 | skipping to change at line 253 | |||
} | } | |||
return b; | return b; | |||
} | } | |||
/***====================================================================*** / | /***====================================================================*** / | |||
/* | /* | |||
* check for known special property values | * check for known special property values | |||
*/ | */ | |||
static char *SpecialAtoms[] = { | static const char *SpecialAtoms[] = { | |||
"FONT_ASCENT", | "FONT_ASCENT", | |||
#define BDF_FONT_ASCENT 0 | #define BDF_FONT_ASCENT 0 | |||
"FONT_DESCENT", | "FONT_DESCENT", | |||
#define BDF_FONT_DESCENT 1 | #define BDF_FONT_DESCENT 1 | |||
"DEFAULT_CHAR", | "DEFAULT_CHAR", | |||
#define BDF_DEFAULT_CHAR 2 | #define BDF_DEFAULT_CHAR 2 | |||
"POINT_SIZE", | "POINT_SIZE", | |||
#define BDF_POINT_SIZE 3 | #define BDF_POINT_SIZE 3 | |||
"RESOLUTION", | "RESOLUTION", | |||
#define BDF_RESOLUTION 4 | #define BDF_RESOLUTION 4 | |||
skipping to change at line 282 | skipping to change at line 283 | |||
#define BDF_RESOLUTION_X 9 | #define BDF_RESOLUTION_X 9 | |||
"RESOLUTION_Y", | "RESOLUTION_Y", | |||
#define BDF_RESOLUTION_Y 10 | #define BDF_RESOLUTION_Y 10 | |||
0, | 0, | |||
}; | }; | |||
Bool | Bool | |||
bdfSpecialProperty(FontPtr pFont, FontPropPtr prop, | bdfSpecialProperty(FontPtr pFont, FontPropPtr prop, | |||
char isString, bdfFileState *bdfState) | char isString, bdfFileState *bdfState) | |||
{ | { | |||
char **special; | const char **special; | |||
char *name; | const char *name; | |||
name = NameForAtom(prop->name); | name = NameForAtom(prop->name); | |||
for (special = SpecialAtoms; *special; special++) | for (special = SpecialAtoms; *special; special++) | |||
if (!strcmp(name, *special)) | if (!strcmp(name, *special)) | |||
break; | break; | |||
switch (special - SpecialAtoms) { | switch (special - SpecialAtoms) { | |||
case BDF_FONT_ASCENT: | case BDF_FONT_ASCENT: | |||
if (!isString) { | if (!isString) { | |||
pFont->info.fontAscent = prop->value; | pFont->info.fontAscent = prop->value; | |||
End of changes. 7 change blocks. | ||||
10 lines changed or deleted | 10 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/ |