// Copyright status: this file is in the public domain. #include #include #include "lx.h" #include "proto.h" #include "internal.h" /* * We could do this with a header and then many lx__just_send calls, * two per string. My judgement call is that this way is better. */ void lx_SetFontPath(LX_CONN *xc, int nstrs, const char * const *strs) { unsigned char *req; int reqlen; int i; int l; int o; if ( (xc->flags & XCF_FAIL) || (nstrs < 0) || (nstrs > 65535) ) { lx__bad_call(xc,"lx_SetFontPath"); return; } lx__nochain(xc); reqlen = 8; for (i=nstrs-1;i>=0;i--) { l = strlen(strs[i]); if (l > 255) { lx__bad_call(xc,"lx_SetFontPath"); return; } reqlen += 1 + l; } reqlen = (reqlen + 3) & ~3; if (reqlen > 65535*4) { lx__bad_call(xc,"lx_SetFontPath"); return; } req = malloc(reqlen); if (! reqlen) { lx__nomem_fail(xc); return; } req[0] = XP_REQ_SetFontPath; req[1] = 0; // unused w_card16(&req[2],reqlen>>2); w_card16(&req[4],nstrs); req[6] = 0; // unused req[7] = 0; // unused o = 8; for (i=0;i