diff options
Diffstat (limited to 'xorg-server/dix/dixfonts.c')
-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 2e34d370f..341ca3f95 100644 --- 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; @@ -139,7 +139,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) return FALSE; @@ -197,7 +197,7 @@ RemoveFontWakeup(FontPathElementPtr fpe) } void -FontWakeup(pointer data, int count, pointer LastSelectMask) +FontWakeup(void *data, int count, void *LastSelectMask) { int i; FontPathElementPtr fpe; @@ -224,7 +224,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); } } @@ -267,7 +267,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; @@ -275,7 +275,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 | @@ -288,7 +288,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; @@ -350,7 +350,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; } @@ -368,14 +368,14 @@ 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; } int OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, - char *pfontname) + const char *pfontname) { OFclosurePtr c; int i; @@ -404,7 +404,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; @@ -426,7 +426,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; } @@ -453,7 +453,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; @@ -571,7 +571,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; @@ -588,7 +588,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); @@ -615,7 +615,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) { @@ -635,7 +635,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)) @@ -687,7 +687,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; @@ -869,7 +869,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; @@ -1118,12 +1118,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; @@ -1144,7 +1144,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; } } @@ -1165,7 +1165,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) */ @@ -1399,7 +1399,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; } @@ -1413,7 +1413,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; } @@ -1537,7 +1537,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; @@ -1633,21 +1633,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) @@ -1660,7 +1662,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); } } @@ -1712,9 +1714,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; @@ -1816,7 +1819,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); } } @@ -1934,7 +1937,7 @@ FreeFonts(void) FontPtr find_old_font(XID id) { - pointer pFont; + void *pFont; dixLookupResourceByType(&pFont, id, RT_NONE, serverClient, DixReadAccess); return (FontPtr) pFont; @@ -1951,7 +1954,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 @@ -1982,7 +1985,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++; } @@ -1999,7 +2002,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); |