diff options
Diffstat (limited to 'xorg-server/dix/dixfonts.c')
-rwxr-xr-x[-rw-r--r--] | xorg-server/dix/dixfonts.c | 81 |
1 files changed, 42 insertions, 39 deletions
diff --git a/xorg-server/dix/dixfonts.c b/xorg-server/dix/dixfonts.c index dd7700860..6260f48b9 100644..100755 --- a/xorg-server/dix/dixfonts.c +++ b/xorg-server/dix/dixfonts.c @@ -70,7 +70,7 @@ Equipment Corporation. #include "xf86bigfontsrv.h" #endif -extern pointer fosNaturalParams; +extern void *fosNaturalParams; extern FontPtr defaultFont; static FontPathElementPtr *font_path_elements = (FontPathElementPtr *) 0; @@ -128,7 +128,7 @@ dixGetGlyphs(FontPtr font, unsigned long count, unsigned char *chars, * adding RT_FONT prevents conflict with default cursor font */ Bool -SetDefaultFont(char *defaultfontname) +SetDefaultFont(const char *defaultfontname) { int err; FontPtr pf; @@ -140,7 +140,7 @@ SetDefaultFont(char *defaultfontname) (unsigned) strlen(defaultfontname), defaultfontname); if (err != Success) return FALSE; - err = dixLookupResourceByType((pointer *) &pf, fid, RT_FONT, serverClient, + err = dixLookupResourceByType((void **) &pf, fid, RT_FONT, serverClient, DixReadAccess); if (err == Success) last_pf = pf; if (last_pf == (FontPtr) NULL) @@ -199,7 +199,7 @@ RemoveFontWakeup(FontPathElementPtr fpe) } void -FontWakeup(pointer data, int count, pointer LastSelectMask) +FontWakeup(void *data, int count, void *LastSelectMask) { int i; FontPathElementPtr fpe; @@ -226,7 +226,7 @@ FreeFPE(FontPathElementPtr fpe) fpe->refcount--; if (fpe->refcount == 0) { (*fpe_functions[fpe->type].free_fpe) (fpe); - free(fpe->name); + free((void *) fpe->name); free(fpe); } } @@ -272,7 +272,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c) if (client->clientGone) { if (c->current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current_fpe]; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); } err = Successful; goto bail; @@ -280,7 +280,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c) while (c->current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current_fpe]; err = (*fpe_functions[fpe->type].open_font) - ((pointer) client, fpe, c->flags, + ((void *) client, fpe, c->flags, c->fontname, c->fnamelen, FontFormat, BitmapFormatMaskByte | BitmapFormatMaskBit | @@ -293,7 +293,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c) if (err == FontNameAlias && alias) { newlen = strlen(alias); - newname = (char *) realloc(c->fontname, newlen); + newname = (char *) realloc((char *) c->fontname, newlen); if (!newname) { err = AllocError; break; @@ -355,7 +355,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c) } } } - if (!AddResource(c->fontid, RT_FONT, (pointer) pfont)) { + if (!AddResource(c->fontid, RT_FONT, (void *) pfont)) { err = AllocError; goto bail; } @@ -375,7 +375,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c) FreeFPE(c->fpe_list[i]); } free(c->fpe_list); - free(c->fontname); + free((void *) c->fontname); free(c); } return TRUE; @@ -383,7 +383,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c) int OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, - char *pfontname) + const char *pfontname) { OFclosurePtr c; int i; @@ -412,7 +412,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, cached = FindCachedFontPattern(patternCache, pfontname, lenfname); if (cached && cached->info.cachable) { - if (!AddResource(fid, RT_FONT, (pointer) cached)) + if (!AddResource(fid, RT_FONT, (void *) cached)) return BadAlloc; cached->refcnt++; return Success; @@ -434,7 +434,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, */ c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes); if (!c->fpe_list) { - free(c->fontname); + free((void *) c->fontname); free(c); return BadAlloc; } @@ -462,7 +462,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, * \param value must conform to DeleteType */ int -CloseFont(pointer value, XID fid) +CloseFont(void *value, XID fid) { int nscr; ScreenPtr pscr; @@ -584,7 +584,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) if (client->clientGone) { if (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); } err = Successful; goto bail; @@ -601,7 +601,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) /* This FPE doesn't support/require list_fonts_and_aliases */ err = (*fpe_functions[fpe->type].list_fonts) - ((pointer) c->client, fpe, c->current.pattern, + ((void *) c->client, fpe, c->current.pattern, c->current.patlen, c->current.max_names - c->names->nnames, c->names); @@ -628,7 +628,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) if (!c->current.list_started) { err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases) - ((pointer) c->client, fpe, c->current.pattern, + ((void *) c->client, fpe, c->current.pattern, c->current.patlen, c->current.max_names - c->names->nnames, &c->current.private); if (err == Suspended) { @@ -648,7 +648,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) name = 0; err = (*fpe_functions[fpe->type].list_next_font_or_alias) - ((pointer) c->client, fpe, &name, &namelen, &tmpname, + ((void *) c->client, fpe, &name, &namelen, &tmpname, &resolvedlen, c->current.private); if (err == Suspended) { if (!ClientIsAsleep(client)) @@ -700,7 +700,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) tmpname = 0; (void) (*fpe_functions[fpe->type].list_next_font_or_alias) - ((pointer) c->client, fpe, &tmpname, &tmpnamelen, + ((void *) c->client, fpe, &tmpname, &tmpnamelen, &tmpname, &tmpnamelen, c->current.private); if (--aliascount <= 0) { err = BadFontName; @@ -889,7 +889,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) if (client->clientGone) { if (c->current.current_fpe < c->num_fpes) { fpe = c->fpe_list[c->current.current_fpe]; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); } err = Successful; goto bail; @@ -1145,12 +1145,12 @@ doPolyText(ClientPtr client, PTclosurePtr c) if (client->clientGone) { fpe = c->pGC->font->fpe; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); if (ClientIsAsleep(client)) { /* Client has died, but we cannot bail out right now. We need to clean up after the work we did when going to - sleep. Setting the drawable pointer to 0 makes this + sleep. Setting the drawable poiner to 0 makes this happen without any attempts to render or perform other unnecessary activities. */ c->pDraw = (DrawablePtr) 0; @@ -1171,7 +1171,7 @@ doPolyText(ClientPtr client, PTclosurePtr c) the FPE code to clean up after client and avoid further rendering while we clean up after ourself. */ fpe = c->pGC->font->fpe; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); c->pDraw = (DrawablePtr) 0; } } @@ -1192,7 +1192,7 @@ doPolyText(ClientPtr client, PTclosurePtr c) fid = ((Font) *(c->pElt + 4)) /* big-endian */ |((Font) *(c->pElt + 3)) << 8 | ((Font) *(c->pElt + 2)) << 16 | ((Font) *(c->pElt + 1)) << 24; - err = dixLookupResourceByType((pointer *) &pFont, fid, RT_FONT, + err = dixLookupResourceByType((void **) &pFont, fid, RT_FONT, client, DixUseAccess); if (err != Success) { /* restore pFont for step 4 (described below) */ @@ -1433,7 +1433,7 @@ doImageText(ClientPtr client, ITclosurePtr c) if (client->clientGone) { fpe = c->pGC->font->fpe; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); err = Success; goto bail; } @@ -1447,7 +1447,7 @@ doImageText(ClientPtr client, ITclosurePtr c) /* Our drawable has disappeared. Treat like client died... ask the FPE code to clean up after client. */ fpe = c->pGC->font->fpe; - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); err = Success; goto bail; } @@ -1574,7 +1574,7 @@ ImageText(ClientPtr client, DrawablePtr pDraw, GC * pGC, int nChars, /* does the necessary magic to figure out the fpe type */ static int -DetermineFPEType(char *pathname) +DetermineFPEType(const char *pathname) { int i; @@ -1670,21 +1670,23 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist) } /* if error or can't do it, act like it's a new one */ if (!fpe) { + char *name; fpe = malloc(sizeof(FontPathElementRec)); if (!fpe) { err = BadAlloc; goto bail; } - fpe->name = malloc(len + 1); - if (!fpe->name) { + name = malloc(len + 1); + if (!name) { free(fpe); err = BadAlloc; goto bail; } fpe->refcount = 1; - strncpy(fpe->name, (char *) cp, (int) len); - fpe->name[len] = '\0'; + strncpy(name, (char *) cp, (int) len); + name[len] = '\0'; + fpe->name = name; fpe->name_length = len; fpe->type = DetermineFPEType(fpe->name); if (fpe->type == -1) @@ -1697,7 +1699,7 @@ SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist) ("[dix] Could not init font path element %s, removing from list!\n", fpe->name); } - free(fpe->name); + free((void *) fpe->name); free(fpe); } } @@ -1749,9 +1751,10 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths) } int -SetDefaultFontPath(char *path) +SetDefaultFontPath(const char *path) { - char *temp_path, *start, *end; + const char *start, *end; + char *temp_path; unsigned char *cp, *pp, *nump, *newpath; int num = 1, len, err, size = 0, bad; @@ -1853,7 +1856,7 @@ DeleteClientFontStuff(ClientPtr client) for (i = 0; i < num_fpes; i++) { fpe = font_path_elements[i]; if (fpe_functions[fpe->type].client_died) - (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + (*fpe_functions[fpe->type].client_died) ((void *) client, fpe); } } @@ -1971,7 +1974,7 @@ FreeFonts(void) FontPtr find_old_font(XID id) { - pointer pFont; + void *pFont; dixLookupResourceByType(&pFont, id, RT_NONE, serverClient, DixReadAccess); return (FontPtr) pFont; @@ -1988,7 +1991,7 @@ _X_EXPORT int StoreFontClientFont(FontPtr pfont, Font id) { - return AddResource(id, RT_NONE, (pointer) pfont); + return AddResource(id, RT_NONE, (void *) pfont); } _X_EXPORT @@ -2019,7 +2022,7 @@ init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler) } if (fs_handlers_installed == 0) { if (!RegisterBlockAndWakeupHandlers(block_handler, - FontWakeup, (pointer) 0)) + FontWakeup, (void *) 0)) return AllocError; fs_handlers_installed++; } @@ -2036,7 +2039,7 @@ remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler, /* remove the handlers if no one else is using them */ if (--fs_handlers_installed == 0) { RemoveBlockAndWakeupHandlers(block_handler, FontWakeup, - (pointer) 0); + (void *) 0); } } RemoveFontWakeup(fpe); |