X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Ffc%2Ffserve.c;h=a4451448fc33feea3dda55606073518f7da95c7c;hb=3e1969f2133dfd2fac68f01b2b2aa460d86174d7;hp=b02b0b7493e0e59655878af5959b353d1a10a24a;hpb=45d55832022c5ce693e99f8de99480ab968e5ff0;p=framework%2Fuifw%2Fxorg%2Flib%2Flibxfont.git diff --git a/src/fc/fserve.c b/src/fc/fserve.c old mode 100755 new mode 100644 index b02b0b7..a445144 --- a/src/fc/fserve.c +++ b/src/fc/fserve.c @@ -84,7 +84,7 @@ in this Software without prior written authorization from The Open Group. #define MIN(a,b) ((a)<(b)?(a):(b)) #endif #define TimeCmp(a,c,b) ((int) ((a) - (b)) c 0) - + #define NONZEROMETRICS(pci) ((pci)->leftSideBearing || \ (pci)->rightSideBearing || \ (pci)->ascent || \ @@ -95,17 +95,17 @@ extern void ErrorF(const char *f, ...); static int fs_read_glyphs ( FontPathElementPtr fpe, FSBlockDataPtr blockrec ); static int fs_read_list ( FontPathElementPtr fpe, FSBlockDataPtr blockrec ); -static int fs_read_list_info ( FontPathElementPtr fpe, +static int fs_read_list_info ( FontPathElementPtr fpe, FSBlockDataPtr blockrec ); extern fd_set _fs_fd_mask; -static void fs_block_handler ( pointer data, OSTimePtr wt, +static void fs_block_handler ( pointer data, OSTimePtr wt, pointer LastSelectMask ); static int fs_wakeup ( FontPathElementPtr fpe, unsigned long *mask ); /* - * List of all FPEs + * List of all FPEs */ static FSFpePtr fs_fpes; /* @@ -114,7 +114,7 @@ static FSFpePtr fs_fpes; static CARD32 fs_blockState; static int _fs_restart_connection ( FSFpePtr conn ); -static void fs_send_query_bitmaps ( FontPathElementPtr fpe, +static void fs_send_query_bitmaps ( FontPathElementPtr fpe, FSBlockDataPtr blockrec ); static int fs_send_close_font ( FontPathElementPtr fpe, Font id ); static void fs_client_died ( pointer client, FontPathElementPtr fpe ); @@ -240,7 +240,7 @@ _fs_client_resolution(FSFpePtr conn) } } -/* +/* * close font server and remove any state associated with * this connection - this includes any client records. */ @@ -251,8 +251,8 @@ fs_close_conn(FSFpePtr conn) FSClientPtr client, nclient; _fs_close_server (conn); - - for (client = conn->clients; client; client = nclient) + + for (client = conn->clients; client; client = nclient) { nclient = client->next; free (client); @@ -308,7 +308,7 @@ fs_init_fpe(FontPathElementPtr fpe) err = Successful; } } - + if (err == Successful) { #ifdef NCD @@ -348,7 +348,7 @@ static int fs_free_fpe(FontPathElementPtr fpe) { FSFpePtr conn = (FSFpePtr) fpe->private, *prev; - + /* unhook from chain of all font servers */ for (prev = &fs_fpes; *prev; prev = &(*prev)->next) { @@ -410,7 +410,7 @@ fs_new_block_rec(FontPathElementPtr fpe, pointer client, int type) blockrec->type = type; blockrec->depending = 0; blockrec->next = (FSBlockDataPtr) 0; - + /* stick it on the end of the list (since its expected last) */ for (prev = &conn->blockedRequests; *prev; prev = &(*prev)->next) ; @@ -423,7 +423,7 @@ static void _fs_set_pending_reply (FSFpePtr conn) { FSBlockDataPtr blockrec; - + for (blockrec = conn->blockedRequests; blockrec; blockrec = blockrec->next) if (blockrec->errcode == StillWorking) break; @@ -442,7 +442,7 @@ _fs_remove_block_rec(FSFpePtr conn, FSBlockDataPtr blockrec) FSBlockDataPtr *prev; for (prev = &conn->blockedRequests; *prev; prev = &(*prev)->next) - if (*prev == blockrec) + if (*prev == blockrec) { *prev = blockrec->next; break; @@ -461,7 +461,7 @@ static void _fs_signal_clients_depending(FSClientsDependingPtr *clients_depending) { FSClientsDependingPtr p; - + while ((p = *clients_depending)) { *clients_depending = p->next; @@ -474,14 +474,14 @@ static int _fs_add_clients_depending(FSClientsDependingPtr *clients_depending, pointer client) { FSClientsDependingPtr new, cd; - - for (; (cd = *clients_depending); + + for (; (cd = *clients_depending); clients_depending = &(*clients_depending)->next) { - if (cd->client == client) + if (cd->client == client) return Suspended; } - + new = malloc (sizeof (FSClientsDependingRec)); if (!new) return BadAlloc; @@ -503,17 +503,17 @@ _fs_clean_aborted_blockrec(FSFpePtr conn, FSBlockDataPtr blockrec) switch(blockrec->type) { case FS_OPEN_FONT: { FSBlockedFontPtr bfont = (FSBlockedFontPtr)blockrec->data; - + fs_cleanup_bfont (bfont); _fs_signal_clients_depending(&bfont->clients_depending); break; } case FS_LOAD_GLYPHS: { FSBlockedGlyphPtr bglyph = (FSBlockedGlyphPtr)blockrec->data; - + _fs_clean_aborted_loadglyphs(bglyph->pfont, bglyph->num_expected_ranges, - bglyph->expected_ranges); + bglyph->expected_ranges); _fs_signal_clients_depending(&bglyph->clients_depending); break; } @@ -550,12 +550,12 @@ fs_cleanup_bfont (FSBlockedFontPtr bfont) if (bfont->pfont) { fsd = (FSFontDataRec *) bfont->pfont->fpePrivate; - + /* make sure the FS knows we choked on it */ fs_send_close_font(bfont->pfont->fpe, bfont->fontid); - + /* - * Either unload the font if it's being opened for + * Either unload the font if it's being opened for * the first time, or smash the generation field to * mark this font as an orphan */ @@ -590,14 +590,14 @@ fs_get_reply (FSFpePtr conn, int *error) *error = FSIO_BLOCK; return 0; } - + ret = _fs_start_read (conn, sizeof (fsGenericReply), &buf); if (ret != FSIO_READY) { *error = FSIO_BLOCK; return 0; } - + rep = (fsGenericReply *) buf; ret = _fs_start_read (conn, rep->length << 2, &buf); @@ -608,7 +608,7 @@ fs_get_reply (FSFpePtr conn, int *error) } *error = FSIO_READY; - + return (fsGenericReply *) buf; } @@ -616,7 +616,7 @@ static Bool fs_reply_ready (FSFpePtr conn) { fsGenericReply *rep; - + if (conn->fs_fd == -1 || !FD_ISSET (conn->fs_fd, &_fs_fd_mask)) return FALSE; if (fs_data_read (conn) < sizeof (fsGenericReply)) @@ -651,10 +651,10 @@ static int fs_await_reply (FSFpePtr conn) { int ret; - + if (conn->blockState & FS_COMPLETE_REPLY) return FSIO_READY; - + while (!fs_get_reply (conn, &ret)) { if (ret != FSIO_BLOCK) @@ -691,7 +691,7 @@ fs_read_open_font(FontPathElementPtr fpe, FSBlockDataPtr blockrec) fs_cleanup_bfont (bfont); return BadFontName; } - + /* If we're not reopening a font and FS detected a duplicate font open request, replace our reference to the new font with a reference to an existing font (possibly one not finished @@ -701,10 +701,10 @@ fs_read_open_font(FontPathElementPtr fpe, FSBlockDataPtr blockrec) if we we decide (in fs_read_query_info()) that we don't like what we got. */ - if (rep->otherid && !(bfont->flags & FontReopen)) + if (rep->otherid && !(bfont->flags & FontReopen)) { fs_cleanup_bfont (bfont); - + /* Find old font if we're completely done getting it from server. */ bfont->pfont = find_old_font(rep->otherid); bfont->freeFont = FALSE; @@ -715,12 +715,12 @@ fs_read_open_font(FontPathElementPtr fpe, FSBlockDataPtr blockrec) */ for (blockOrig = conn->blockedRequests; blockOrig; - blockOrig = blockOrig->next) + blockOrig = blockOrig->next) { - if (blockOrig != blockrec && blockOrig->type == FS_OPEN_FONT) + if (blockOrig != blockrec && blockOrig->type == FS_OPEN_FONT) { origBfont = (FSBlockedFontPtr) blockOrig->data; - if (origBfont->fontid == rep->otherid) + if (origBfont->fontid == rep->otherid) { blockrec->depending = blockOrig->depending; blockOrig->depending = blockrec; @@ -757,7 +757,7 @@ static Bool fs_fonts_match (FontInfoPtr pInfo1, FontInfoPtr pInfo2) { int i; - + if (pInfo1->firstCol != pInfo2->firstCol || pInfo1->lastCol != pInfo2->lastCol || pInfo1->firstRow != pInfo2->firstRow || @@ -833,7 +833,7 @@ fs_read_query_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) fs_cleanup_bfont (bfont); return BadFontName; } - + /* If this is a reopen, accumulate the query info into a dummy font and compare to our original data. */ if (bfont->flags & FontReopen) @@ -843,27 +843,27 @@ fs_read_query_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) buf = (char *) rep; buf += SIZEOF(fsQueryXInfoReply); - + /* move the data over */ fsUnpack_XFontInfoHeader(rep, pInfo); - + /* compute accelerators */ _fs_init_fontinfo(conn, pInfo); /* Compute offsets into the reply */ pi = (fsPropInfo *) buf; buf += SIZEOF (fsPropInfo); - + po = (fsPropOffset *) buf; buf += pi->num_offsets * SIZEOF(fsPropOffset); pd = (pointer) buf; buf += pi->data_len; - + /* convert the properties and step over the reply */ ret = _fs_convert_props(pi, po, pd, pInfo); _fs_done_read (conn, rep->length << 2); - + if (ret == -1) { fs_cleanup_bfont (bfont); @@ -889,7 +889,7 @@ fs_read_query_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) err = BadFontName; } _fs_free_props (pInfo); - + return err; } @@ -904,14 +904,14 @@ fs_read_query_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) * Figure out if the whole font should get loaded right now. */ if (glyphCachingMode == CACHING_OFF || - (glyphCachingMode == CACHE_16_BIT_GLYPHS + (glyphCachingMode == CACHE_16_BIT_GLYPHS && !bfont->pfont->info.lastRow)) { bfont->flags |= FontLoadAll; } - + /* - * Ready to send the query bitmaps; the terminal font bit has + * Ready to send the query bitmaps; the terminal font bit has * been computed and glyphCaching has been considered */ if (bfont->flags & FontLoadBitmaps) @@ -927,7 +927,7 @@ fs_read_query_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) */ blockrec->sequenceNumber = bfont->queryExtentsSequence; conn->blockedReplyTime = GetTimeInMillis () + FontServerRequestTimeout; - + return StillWorking; } @@ -960,7 +960,7 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) fs_cleanup_bfont (bfont); return BadFontName; } - + /* move the data over */ /* need separate inkMetrics for fixed font server protocol version */ numExtents = rep->num_extents; @@ -972,7 +972,7 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) } ci = pCI = malloc(sizeof(CharInfoRec) * numInfos); - if (!pCI) + if (!pCI) { _fs_done_read (conn, rep->length << 2); fs_cleanup_bfont(bfont); @@ -987,10 +987,10 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) buf = (char *) rep; buf += SIZEOF (fsQueryXExtents16Reply); fsci = buf; - + fsd->glyphs_to_get = 0; ci = fsfont->inkMetrics; - for (i = 0; i < numExtents; i++) + for (i = 0; i < numExtents; i++) { memcpy(&fscilocal, fsci, SIZEOF(fsXCharInfo)); /* align it */ _fs_convert_char_info(&fscilocal, &ci->metrics); @@ -1030,7 +1030,7 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) /* Done with reply */ _fs_done_read (conn, rep->length << 2); - + /* build bitmap metrics, ImageRectMax style */ if (haveInk) { @@ -1098,7 +1098,7 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) } bfont->state = FS_GLYPHS_REPLY; - if (bfont->flags & FontLoadBitmaps) + if (bfont->flags & FontLoadBitmaps) { /* * Reset the blockrec for the next reply @@ -1129,7 +1129,7 @@ fs_do_open_font(FontPathElementPtr fpe, FSBlockDataPtr blockrec) #ifdef DEBUG fprintf (stderr, "fs_do_open_font state %s %s\n", - fs_open_states[bfont->state], + fs_open_states[bfont->state], ((FSFontDataPtr) (bfont->pfont->fpePrivate))->name); #endif err = BadFontName; @@ -1165,10 +1165,10 @@ fs_do_open_font(FontPathElementPtr fpe, FSBlockDataPtr blockrec) #ifdef DEBUG fprintf (stderr, "fs_do_open_font err %d\n", err); #endif - if (err != StillWorking) + if (err != StillWorking) { bfont->state = FS_DONE_REPLY; /* for _fs_load_glyphs() */ - while ((blockrec = blockrec->depending)) + while ((blockrec = blockrec->depending)) { bfont = (FSBlockedFontPtr) blockrec->data; bfont->state = FS_DONE_REPLY; /* for _fs_load_glyphs() */ @@ -1188,7 +1188,7 @@ void _fs_unmark_block (FSFpePtr conn, CARD32 mask) { FSFpePtr c; - + if (conn->blockState & mask) { conn->blockState &= ~mask; @@ -1207,7 +1207,7 @@ fs_block_handler(pointer data, OSTimePtr wt, pointer LastSelectMask) int soonest; FSFpePtr conn; - XFD_ORSET((fd_set *)LastSelectMask, (fd_set *)LastSelectMask, + XFD_ORSET((fd_set *)LastSelectMask, (fd_set *)LastSelectMask, &_fs_fd_mask); /* * Flush all pending output @@ -1280,7 +1280,7 @@ fs_block_handler(pointer data, OSTimePtr wt, pointer LastSelectMask) static void fs_handle_unexpected(FSFpePtr conn, fsGenericReply *rep) { - if (rep->type == FS_Event && rep->data1 == KeepAlive) + if (rep->type == FS_Event && rep->data1 == KeepAlive) { fsNoopReq req; @@ -1302,27 +1302,27 @@ fs_read_reply (FontPathElementPtr fpe, pointer client) int ret; int err; fsGenericReply *rep; - + if ((rep = fs_get_reply (conn, &ret))) { _fs_add_rep_log (conn, rep); - for (blockrec = conn->blockedRequests; - blockrec; - blockrec = blockrec->next) + for (blockrec = conn->blockedRequests; + blockrec; + blockrec = blockrec->next) { if (blockrec->sequenceNumber == rep->sequenceNumber) break; } err = Successful; - if (!blockrec) + if (!blockrec) { fs_handle_unexpected(conn, rep); } else { - /* - * go read it, and if we're done, - * wake up the appropriate client + /* + * go read it, and if we're done, + * wake up the appropriate client */ switch (blockrec->type) { case FS_OPEN_FONT: @@ -1343,7 +1343,7 @@ fs_read_reply (FontPathElementPtr fpe, pointer client) err = blockrec->errcode; if (err != StillWorking) { - while (blockrec) + while (blockrec) { blockrec->errcode = err; if (client != blockrec->client) @@ -1366,7 +1366,7 @@ fs_wakeup(FontPathElementPtr fpe, unsigned long *mask) fd_set *LastSelectMask = (fd_set *) mask; FSFpePtr conn = (FSFpePtr) fpe->private; - /* + /* * Don't continue if the fd is -1 (which will be true when the * font server terminates */ @@ -1400,7 +1400,7 @@ fs_wakeup(FontPathElementPtr fpe, unsigned long *mask) blockrec->errcode, blockrec->sequenceNumber, fs_open_states[bfont->state], - bfont->pfont ? + bfont->pfont ? ((FSFontDataPtr) (bfont->pfont->fpePrivate))->name : ""); break; @@ -1418,7 +1418,7 @@ fs_wakeup(FontPathElementPtr fpe, unsigned long *mask) } } } -#endif +#endif return FALSE; } @@ -1446,7 +1446,7 @@ _fs_restart_connection(FSFpePtr conn) FSBlockDataPtr block; _fs_unmark_block (conn, FS_GIVE_UP); - while ((block = (FSBlockDataPtr) conn->blockedRequests)) + while ((block = (FSBlockDataPtr) conn->blockedRequests)) { if (block->errcode == StillWorking) { @@ -1471,7 +1471,7 @@ _fs_giveup (FSFpePtr conn) fprintf (stderr, "give up on FS \"%s\"\n", conn->servername); #endif _fs_mark_block (conn, FS_GIVE_UP); - while ((block = (FSBlockDataPtr) conn->blockedRequests)) + while ((block = (FSBlockDataPtr) conn->blockedRequests)) { if (block->errcode == StillWorking) { @@ -1494,7 +1494,7 @@ _fs_do_blocked (FSFpePtr conn) { _fs_giveup (conn); } - else + else { if (conn->blockState & FS_BROKEN_CONNECTION) { @@ -1516,9 +1516,9 @@ _fs_do_blocked (FSFpePtr conn) */ /* ARGSUSED */ static int -fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, - char *name, int namelen, - fsBitmapFormat format, fsBitmapFormatMask fmask, +fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, + char *name, int namelen, + fsBitmapFormat format, fsBitmapFormatMask fmask, XID id, FontPtr *ppfont) { FSFpePtr conn = (FSFpePtr) fpe->private; @@ -1534,10 +1534,10 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, if (conn->blockState & FS_GIVE_UP) return BadFontName; - + if (namelen <= 0 || namelen > sizeof (buf) - 1) return BadFontName; - + /* * Get the font structure put together, either by reusing * the existing one or creating a new one @@ -1574,10 +1574,10 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, font = fs_create_font (fpe, name, namelen, format, fmask); if (!font) return AllocError; - + fsd = (FSFontDataPtr)font->fpePrivate; } - + /* make a new block record, and add it to the end of the list */ blockrec = fs_new_block_rec(font->fpe, client, FS_OPEN_FONT); if (!blockrec) @@ -1586,7 +1586,7 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, (*font->unload_font) (font); return AllocError; } - + /* * Must check this before generating any protocol, otherwise we'll * mess up a reconnect in progress @@ -1596,7 +1596,7 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, _fs_pending_reply (conn); return Suspended; } - + fsd->generation = conn->generation; bfont = (FSBlockedFontPtr) blockrec->data; @@ -1626,17 +1626,17 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, _fs_write_pad(conn, (char *) buf, namelen + 1); blockrec->sequenceNumber = conn->current_seq; - + inforeq.reqType = FS_QueryXInfo; inforeq.pad = 0; inforeq.id = fsd->fontid; inforeq.length = SIZEOF(fsQueryXInfoReq) >> 2; bfont->queryInfoSequence = conn->current_seq + 1; - + _fs_add_req_log(conn, FS_QueryXInfo); _fs_write(conn, (char *) &inforeq, SIZEOF(fsQueryXInfoReq)); - + if (!(bfont->flags & FontReopen)) { extreq.reqType = FS_QueryXExtents16; @@ -1644,15 +1644,15 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, extreq.fid = fsd->fontid; extreq.num_ranges = 0; extreq.length = SIZEOF(fsQueryXExtents16Req) >> 2; - + bfont->queryExtentsSequence = conn->current_seq + 1; - + _fs_add_req_log(conn, FS_QueryXExtents16); _fs_write(conn, (char *) &extreq, SIZEOF(fsQueryXExtents16Req)); } - + #ifdef NCD - if (configData.ExtendedFontDiags) + if (configData.ExtendedFontDiags) { memcpy(buf, name, MIN(256, namelen)); buf[MIN(256, namelen)] = '\0'; @@ -1661,7 +1661,7 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, } #endif _fs_prepare_for_reply (conn); - + err = blockrec->errcode; if (bfont->flags & FontOpenSync) { @@ -1701,16 +1701,16 @@ fs_send_query_bitmaps(FontPathElementPtr fpe, FSBlockDataPtr blockrec) bitreq.num_ranges = 0; bfont->queryBitmapsSequence = conn->current_seq + 1; - + _fs_add_req_log(conn, FS_QueryXBitmaps16); _fs_write(conn, (char *) &bitreq, SIZEOF(fsQueryXBitmaps16Req)); } /* ARGSUSED */ static int -fs_open_font(pointer client, FontPathElementPtr fpe, Mask flags, - char *name, int namelen, - fsBitmapFormat format, fsBitmapFormatMask fmask, +fs_open_font(pointer client, FontPathElementPtr fpe, Mask flags, + char *name, int namelen, + fsBitmapFormat format, fsBitmapFormatMask fmask, XID id, FontPtr *ppfont, char **alias, FontPtr non_cachable_font) { @@ -1725,12 +1725,12 @@ fs_open_font(pointer client, FontPathElementPtr fpe, Mask flags, *alias = (char *) 0; for (blockrec = conn->blockedRequests; blockrec; blockrec = blockrec->next) { - if (blockrec->type == FS_OPEN_FONT && blockrec->client == client) + if (blockrec->type == FS_OPEN_FONT && blockrec->client == client) { err = blockrec->errcode; if (err == StillWorking) return Suspended; - + bfont = (FSBlockedFontPtr) blockrec->data; if (err == Successful) *ppfont = bfont->pfont; @@ -1871,21 +1871,21 @@ fs_read_glyphs(FontPathElementPtr fpe, FSBlockDataPtr blockrec) } off_adr = (char *)ppbits; - + allbits = fs_alloc_glyphs (pfont, rep->nbytes); - + if (!allbits) { err = AllocError; goto bail; } - + #ifdef DEBUG origallbits = allbits; fprintf (stderr, "Reading %d glyphs in %d bytes for %s\n", (int) rep->num_chars, (int) rep->nbytes, fsd->name); #endif - + for (i = 0; i < rep->num_chars; i++) { memcpy(&local_off, off_adr, SIZEOF(fsOffset32)); /* align it */ @@ -1945,7 +1945,7 @@ bail: } static int -fs_send_load_glyphs(pointer client, FontPtr pfont, +fs_send_load_glyphs(pointer client, FontPtr pfont, int nranges, fsRange *ranges) { FontPathElementPtr fpe = pfont->fpe; @@ -1956,7 +1956,7 @@ fs_send_load_glyphs(pointer client, FontPtr pfont, if (conn->blockState & FS_GIVE_UP) return BadCharRange; - + /* make a new block record, and add it to the end of the list */ blockrec = fs_new_block_rec(fpe, client, FS_LOAD_GLYPHS); if (!blockrec) @@ -1973,7 +1973,7 @@ fs_send_load_glyphs(pointer client, FontPtr pfont, _fs_pending_reply (conn); return Suspended; } - + /* send the request */ req.reqType = FS_QueryXBitmaps16; req.fid = ((FSFontDataPtr) pfont->fpePrivate)->fontid; @@ -1989,7 +1989,7 @@ fs_send_load_glyphs(pointer client, FontPtr pfont, _fs_write(conn, (char *) &req, SIZEOF(fsQueryXBitmaps16Req)); blockrec->sequenceNumber = conn->current_seq; - + /* Send ranges to the server... pack into a char array by hand to avoid structure-packing portability problems and to handle swapping for version1 protocol */ @@ -2039,7 +2039,7 @@ extern pointer serverClient; /* This could be any number that client values. */ static int -_fs_load_glyphs(pointer client, FontPtr pfont, Bool range_flag, +_fs_load_glyphs(pointer client, FontPtr pfont, Bool range_flag, unsigned int nchars, int item_size, unsigned char *data) { FSFpePtr conn = (FSFpePtr) pfont->fpe->private; @@ -2095,7 +2095,7 @@ _fs_load_glyphs(pointer client, FontPtr pfont, Bool range_flag, err = blockrec->errcode; if (err == StillWorking) return Suspended; - + _fs_signal_clients_depending(&bfont->clients_depending); _fs_remove_block_rec(conn, blockrec); if (err != Successful) @@ -2246,7 +2246,7 @@ fs_read_list(FontPathElementPtr fpe, FSBlockDataPtr blockrec) err = Successful; /* copy data into FontPathRecord */ - for (i = 0; i < rep->nFonts; i++) + for (i = 0; i < rep->nFonts; i++) { length = *(unsigned char *)data++; err = AddFontNamesName(blist->names, data, length); @@ -2259,7 +2259,7 @@ fs_read_list(FontPathElementPtr fpe, FSBlockDataPtr blockrec) } static int -fs_send_list_fonts(pointer client, FontPathElementPtr fpe, char *pattern, +fs_send_list_fonts(pointer client, FontPathElementPtr fpe, char *pattern, int patlen, int maxnames, FontNamesPtr newnames) { FSFpePtr conn = (FSFpePtr) fpe->private; @@ -2269,7 +2269,7 @@ fs_send_list_fonts(pointer client, FontPathElementPtr fpe, char *pattern, if (conn->blockState & FS_GIVE_UP) return BadFontName; - + /* make a new block record, and add it to the end of the list */ blockrec = fs_new_block_rec(fpe, client, FS_LIST_FONTS); if (!blockrec) @@ -2282,7 +2282,7 @@ fs_send_list_fonts(pointer client, FontPathElementPtr fpe, char *pattern, _fs_pending_reply (conn); return Suspended; } - + _fs_client_access (conn, client, FALSE); _fs_client_resolution(conn); @@ -2297,7 +2297,7 @@ fs_send_list_fonts(pointer client, FontPathElementPtr fpe, char *pattern, _fs_write_pad(conn, (char *) pattern, patlen); blockrec->sequenceNumber = conn->current_seq; - + #ifdef NCD if (configData.ExtendedFontDiags) { char buf[256]; @@ -2314,7 +2314,7 @@ fs_send_list_fonts(pointer client, FontPathElementPtr fpe, char *pattern, } static int -fs_list_fonts(pointer client, FontPathElementPtr fpe, +fs_list_fonts(pointer client, FontPathElementPtr fpe, char *pattern, int patlen, int maxnames, FontNamesPtr newnames) { FSFpePtr conn = (FSFpePtr) fpe->private; @@ -2324,7 +2324,7 @@ fs_list_fonts(pointer client, FontPathElementPtr fpe, /* see if the result is already there */ for (blockrec = conn->blockedRequests; blockrec; blockrec = blockrec->next) { - if (blockrec->type == FS_LIST_FONTS && blockrec->client == client) + if (blockrec->type == FS_LIST_FONTS && blockrec->client == client) { err = blockrec->errcode; if (err == StillWorking) @@ -2380,7 +2380,7 @@ fs_read_list_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) } buf = (char *) rep + SIZEOF (fsListFontsWithXInfoReply); - + /* * The original FS implementation didn't match * the spec, version 1 was respecified to match the FS. @@ -2417,18 +2417,18 @@ fs_read_list_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) binfo->remaining = rep->nReplies; binfo->status = FS_LFWI_REPLY; - + /* disable this font server until we've processed this response */ _fs_unmark_block (conn, FS_COMPLETE_REPLY); FD_CLR(conn->fs_fd, &_fs_fd_mask); -done: +done: _fs_done_read (conn, rep->length << 2); return err; } /* ARGSUSED */ static int -fs_start_list_with_info(pointer client, FontPathElementPtr fpe, +fs_start_list_with_info(pointer client, FontPathElementPtr fpe, char *pattern, int len, int maxnames, pointer *pdata) { FSFpePtr conn = (FSFpePtr) fpe->private; @@ -2443,7 +2443,7 @@ fs_start_list_with_info(pointer client, FontPathElementPtr fpe, blockrec = fs_new_block_rec(fpe, client, FS_LIST_WITH_INFO); if (!blockrec) return AllocError; - + binfo = (FSBlockedListInfoPtr) blockrec->data; bzero((char *) binfo, sizeof(FSBlockedListInfoRec)); binfo->status = FS_LFWI_WAITING; @@ -2453,7 +2453,7 @@ fs_start_list_with_info(pointer client, FontPathElementPtr fpe, _fs_pending_reply (conn); return Suspended; } - + _fs_client_access (conn, client, FALSE); _fs_client_resolution(conn); @@ -2468,7 +2468,7 @@ fs_start_list_with_info(pointer client, FontPathElementPtr fpe, (void) _fs_write_pad(conn, pattern, len); blockrec->sequenceNumber = conn->current_seq; - + #ifdef NCD if (configData.ExtendedFontDiags) { char buf[256]; @@ -2486,8 +2486,8 @@ fs_start_list_with_info(pointer client, FontPathElementPtr fpe, /* ARGSUSED */ static int -fs_next_list_with_info(pointer client, FontPathElementPtr fpe, - char **namep, int *namelenp, +fs_next_list_with_info(pointer client, FontPathElementPtr fpe, + char **namep, int *namelenp, FontInfoPtr *pFontInfo, int *numFonts, pointer private) { @@ -2498,7 +2498,7 @@ fs_next_list_with_info(pointer client, FontPathElementPtr fpe, /* see if the result is already there */ for (blockrec = conn->blockedRequests; blockrec; blockrec = blockrec->next) - if (blockrec->type == FS_LIST_WITH_INFO && blockrec->client == client) + if (blockrec->type == FS_LIST_WITH_INFO && blockrec->client == client) break; if (!blockrec) @@ -2513,7 +2513,7 @@ fs_next_list_with_info(pointer client, FontPathElementPtr fpe, } binfo = (FSBlockedListInfoPtr) blockrec->data; - + if (binfo->status == FS_LFWI_WAITING) return Suspended; @@ -2521,12 +2521,12 @@ fs_next_list_with_info(pointer client, FontPathElementPtr fpe, *namelenp = binfo->namelen; *pFontInfo = &binfo->info; *numFonts = binfo->remaining; - + /* Restart reply processing from this font server */ FD_SET(conn->fs_fd, &_fs_fd_mask); if (fs_reply_ready (conn)) _fs_mark_block (conn, FS_COMPLETE_REPLY); - + err = blockrec->errcode; switch (binfo->status) { case FS_LFWI_FINISHED: @@ -2539,7 +2539,7 @@ fs_next_list_with_info(pointer client, FontPathElementPtr fpe, _fs_mark_block (conn, FS_PENDING_REPLY); break; } - + return err; } @@ -2574,12 +2574,12 @@ fs_client_died(pointer client, FontPathElementPtr fpe) for (blockrec = conn->blockedRequests; blockrec; blockrec = blockrec->next) if (blockrec->client == client) break; - + if (!blockrec) return; - + /* replace the client pointers in this block rec with the chained one */ - if ((depending = blockrec->depending)) + if ((depending = blockrec->depending)) { blockrec->client = depending->client; blockrec->depending = depending->depending; @@ -2681,7 +2681,7 @@ static int _fs_check_connect (FSFpePtr conn) { int ret; - + ret = _fs_poll_connect (conn->trans_conn, 0); switch (ret) { case FSIO_READY: @@ -2715,7 +2715,7 @@ _fs_get_conn_setup (FSFpePtr conn, int *error, int *setup_len) *error = ret; return 0; } - + setup = (fsConnSetup *) data; if (setup->major_version > FS_PROTOCOL) { @@ -2789,7 +2789,7 @@ _fs_recv_conn_setup (FSFpePtr conn) int i, alt_len; int setup_len; char *alt_save, *alt_names; - + setup = _fs_get_conn_setup (conn, &ret, &setup_len); if (!setup) return ret; @@ -2845,7 +2845,7 @@ _fs_open_server (FSFpePtr conn) { int ret; char *servername; - + if (conn->alternate == 0) servername = conn->servername; else @@ -2877,13 +2877,13 @@ _fs_send_init_packets (FSFpePtr conn) char *cat; char len; char *end; - int num_res; + int num_res; FontResolutionPtr res; #define CATALOGUE_SEP '+' res = GetClientResolutions(&num_res); - if (num_res) + if (num_res) { srreq.reqType = FS_SetResolution; srreq.num_resolutions = num_res; @@ -2902,14 +2902,14 @@ _fs_send_init_packets (FSFpePtr conn) catalogues = _fs_catalog_name (conn->alts[conn->alternate-1].name); if (!catalogues) catalogues = _fs_catalog_name (conn->servername); - + if (!catalogues) { conn->has_catalogues = FALSE; return FSIO_READY; } conn->has_catalogues = TRUE; - + /* turn cats into counted list */ catalogues++; @@ -2929,11 +2929,11 @@ _fs_send_init_packets (FSFpePtr conn) screq.reqType = FS_SetCatalogues; screq.num_catalogues = num_cats; screq.length = (SIZEOF(fsSetCataloguesReq) + clen + 3) >> 2; - + _fs_add_req_log(conn, FS_SetCatalogues); if (_fs_write(conn, (char *) &screq, SIZEOF(fsSetCataloguesReq)) != FSIO_READY) return FSIO_ERROR; - + while (*cat) { num_cats++; @@ -2947,10 +2947,10 @@ _fs_send_init_packets (FSFpePtr conn) return FSIO_ERROR; cat = end; } - + if (_fs_write (conn, "....", _fs_pad_length (clen) - clen) != FSIO_READY) return FSIO_ERROR; - + return FSIO_READY; } @@ -2958,7 +2958,7 @@ static int _fs_send_cat_sync (FSFpePtr conn) { fsListCataloguesReq lcreq; - + /* * now sync up with the font server, to see if an error was generated * by a bogus catalogue @@ -2986,7 +2986,7 @@ _fs_recv_cat_sync (FSFpePtr conn) reply = fs_get_reply (conn, &err); if (!reply) return err; - + ret = FSIO_READY; if (reply->type == FS_Error) { @@ -3020,7 +3020,7 @@ static int _fs_do_setup_connection (FSFpePtr conn) { int ret; - + do { #ifdef DEBUG @@ -3113,7 +3113,7 @@ static void _fs_check_reconnect (FSFpePtr conn) { int ret; - + ret = _fs_do_setup_connection (conn); switch (ret) { case FSIO_READY: