home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / fonts / lib / fs / FSQXInfo.c.orig < prev    next >
Encoding:
Text File  |  1991-05-13  |  2.7 KB  |  79 lines

  1. /* $XConsortium: FSQXInfo.c,v 1.2 91/05/13 15:11:51 gildea Exp $ */
  2.  
  3. /* @(#)FSQXInfo.c    4.1    91/05/02
  4.  * Copyright 1990 Network Computing Devices;
  5.  * Portions Copyright 1987 by Digital Equipment Corporation and the
  6.  * Massachusetts Institute of Technology
  7.  *
  8.  * Permission to use, copy, modify, and distribute this protoype software
  9.  * and its documentation to Members and Affiliates of the MIT X Consortium
  10.  * any purpose and without fee is hereby granted, provided
  11.  * that the above copyright notice appear in all copies and that both that
  12.  * copyright notice and this permission notice appear in supporting
  13.  * documentation, and that the names of Network Computing Devices, Digital or
  14.  * MIT not be used in advertising or publicity pertaining to distribution of
  15.  * the software without specific, written prior permission.
  16.  *
  17.  * NETWORK COMPUTING DEVICES, DIGITAL AND MIT DISCLAIM ALL WARRANTIES WITH
  18.  * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  19.  * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, DIGITAL OR MIT BE
  20.  * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  21.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  22.  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  23.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  24.  */
  25.  
  26. #include    "FSlibint.h"
  27.  
  28. /*
  29.  * Note:  only the range in the first FSQuery is sent to the server.
  30.  * the others exist as return values only.
  31.  */
  32.  
  33. int
  34. FSQueryXInfo(svr, fid, info, props, offsets, prop_data)
  35.     FSServer   *svr;
  36.     Font        fid;
  37.     fsFontHeader *info;
  38.     fsPropInfo *props;
  39.     fsPropOffset **offsets;
  40.     unsigned char **prop_data;
  41. {
  42.     fsQueryXInfoReq *req;
  43.     fsQueryXInfoReply reply;
  44.     fsPropOffset *offset_data;
  45.     unsigned char *pdata;
  46.  
  47.     GetReq(QueryXInfo, req);
  48.     req->id = fid;
  49.  
  50.     /* get back the info */
  51.     if (!_FSReply(svr, (fsReply *) & reply, ((SIZEOF(fsQueryXInfoReply) -
  52.                 SIZEOF(fsGenericReply)) >> 2), fsFalse)) {
  53.     return FSBadAlloc;
  54.     }
  55.     bcopy((char *) &reply.header, (char *) info, sizeof(fsFontHeader));
  56.     /* get the prop header */
  57.     _FSReadPad(svr, (char *) props, sizeof(fsPropInfo));
  58.     /* prepare for prop data */
  59.     offset_data = (fsPropOffset *)
  60.     FSmalloc(props->num_offsets * sizeof(fsPropOffset));
  61.     if (!offset_data)
  62.     return FSBadAlloc;
  63.     pdata = (unsigned char *) FSmalloc(props->data_len);
  64.     if (!pdata) {
  65.     FSfree((char *) offset_data);
  66.     return FSBadAlloc;
  67.     }
  68.     /* get offsets */
  69.     _FSReadPad(svr, (char *) offset_data,
  70.            (props->num_offsets * sizeof(fsPropOffset)));
  71.     /* get data */
  72.     _FSReadPad(svr, (char *) pdata, props->data_len);
  73.     *offsets = offset_data;
  74.     *prop_data = pdata;
  75.  
  76.     SyncHandle();
  77.     return FSSuccess;
  78. }
  79.