[stsf-commit] stsf/stsflib fscomm.c, 1.4, 1.5 fscomm.h, 1.3,
1.4 stsfutil.c, 1.10, 1.11
Alexander Gelfenbain
stsf-commit at pdx.freedesktop.org
Sun May 30 16:07:21 PDT 2004
Committed by: adg
Index: fscomm.c
===================================================================
RCS file: /cvs/stsf/stsf/stsflib/fscomm.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- a/fscomm.c 26 May 2004 02:58:50 -0000 1.4
+++ b/fscomm.c 30 May 2004 23:07:18 -0000 1.5
@@ -1614,32 +1614,19 @@
}
int ci_getfontdata_out(byte *p,
uint32_t s,
- STSize nbytes,
- byte *rawdata)
+ STSize nbytes)
{
fsc_getfontdata_out *q = (fsc_getfontdata_out *) p;
- uint32_t curoffs = sizeof(fsc_getfontdata_out);
- uint32_t n = sizeof(fsc_getfontdata_out) + nbytes;
+ uint32_t n = sizeof(fsc_getfontdata_out);
if (s < n) return n;
q->opcode = FS_GETFONTDATA_OUT;
q->nbytes = nbytes;
- if (nbytes != 0 && rawdata != NULL) {
- q->rawdata = (byte *) curoffs;
- memcpy(p+curoffs, rawdata, nbytes);
- /* curoffs += nbytes */
- } else {
- q->rawdata = NULL;
- }
return 0;
}
int co_getfontdata_out(byte *p,
uint32_t s)
{
- fsc_getfontdata_out *q = (fsc_getfontdata_out *) p;
- if (q->rawdata != NULL) {
- q->rawdata = (byte *) (p + (uintptr_t) q->rawdata);
- }
return 0;
}
@@ -1859,44 +1846,27 @@
uint64_t cid,
STCount streamcount,
uint32_t *streamsizes,
- byte **data)
+ size_t totalsize)
{
fsc_createfonts_in *q = (fsc_createfonts_in *) p;
uint32_t curoffs = sizeof(fsc_createfonts_in);
uint32_t n = sizeof(fsc_createfonts_in) + streamcount * sizeof(uint32_t) + streamcount * sizeof(byte *);
STCount i;
- for (i=0; i<streamcount; i++) {
- n += streamsizes[i];
- }
-
if (s < n) return n;
q->opcode = FS_CREATEFONTS_IN;
q->cid = cid;
q->streamcount = streamcount;
+ q->totalsize = totalsize;
if (streamcount != 0) {
byte **l;
- if (streamsizes == NULL || data == NULL) {
+ if (streamsizes == NULL) {
return -1;
}
q->streamsizes = (uint32_t *) curoffs;
memcpy(p+curoffs, streamsizes, streamcount * sizeof(uint32_t));
- curoffs += streamcount * sizeof(uint32_t);
-
- q->data = (byte **) curoffs;
- l = (byte **) (p + curoffs);
- curoffs += streamcount * sizeof(byte *);
-
- for (i=0; i<streamcount; i++) {
- if (streamsizes[i] != 0) {
- *l++ = (byte *) curoffs;
- memcpy(p+curoffs, data[i], streamsizes[i]);
- curoffs += streamsizes[i];
- } else {
- *l++ = NULL;
- }
- }
+ // curoffs += streamcount * sizeof(uint32_t);
}
return 0;
}
@@ -1906,15 +1876,10 @@
fsc_createfonts_in *q = (fsc_createfonts_in *) p;
if (q->streamcount != 0) {
STCount i;
- if (q->streamsizes == NULL || q->data == NULL) {
+ if (q->streamsizes == NULL) {
return -1;
}
q->streamsizes = (uint32_t *) (p + (uintptr_t) q->streamsizes);
- for (i=0; i<q->streamcount; i++) {
- if (q->data[i] != NULL) {
- q->data[i] = (byte *) (p + (uintptr_t) q->data[i]);
- }
- }
}
return 0;
}
@@ -2210,8 +2175,17 @@
if (s < n) return n;
q->opcode = FS_GETNAMESTRING_OUT;
q->count = count;
- if (count == 0) {
- if (str != NULL) {
+
+#ifdef STSF_DEBUG
+ if (DebugLevel > 5) {
+ DebugStr(-1, "%s: count: %d, str: [", __func__, count);
+ DumpData(str, count);
+ DebugStr(-1, "]\n");
+ }
+#endif
+
+ if (count != 0) {
+ if (str == NULL) {
return -1;
}
q->str = (byte *) curoffs;
@@ -2229,6 +2203,13 @@
if (q->str != NULL) {
q->str = (byte *) (p + (uint32_t) q->str);
}
+#ifdef STSF_DEBUG
+ if (DebugLevel > 5) {
+ DebugStr(-1, "%s: count: %d, str: [", __func__, q->count);
+ DumpData(q->str, q->count);
+ DebugStr(-1, "]\n");
+ }
+#endif
return 0;
}
@@ -2351,6 +2332,7 @@
case FS_GETNAMETAGS_IN: return FS_GETNAMETAGS_OUT;
case FS_GETNAMESTRING_IN: return FS_GETNAMESTRING_OUT;
case FS_PREFETCHGLYPHS_IN: return FS_PREFETCHGLYPHS_OUT;
+ case FS_TERMINATE_IN: return FS_TERMINATE_IN;
default: return FS_PROTO_ERROR;
}
}
@@ -2444,6 +2426,7 @@
case FS_GETNAMESTRING_OUT: return "FS_GETNAMESTRING_OUT";
case FS_PREFETCHGLYPHS_IN: return "FS_PREFETCHGLYPHS_IN";
case FS_PREFETCHGLYPHS_OUT: return "FS_PREFETCHGLYPHS_OUT";
+ case FS_TERMINATE_IN: return "FS_TERMINATE_IN";
default: return "*** UNKNOWN ***";
}
}
@@ -2545,6 +2528,7 @@
case FS_GETNAMESTRING_OUT: return co_getnamestring_out(p, s);
case FS_PREFETCHGLYPHS_IN: return co_prefetchglyphs_in(p, s);
case FS_PREFETCHGLYPHS_OUT: return co_prefetchglyphs_out(p, s);
+ case FS_TERMINATE_IN: return co_terminate_in(p, s);
default: return -2;
}
}
Index: fscomm.h
===================================================================
RCS file: /cvs/stsf/stsf/stsflib/fscomm.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- a/fscomm.h 25 May 2004 02:47:25 -0000 1.3
+++ b/fscomm.h 30 May 2004 23:07:18 -0000 1.4
@@ -631,7 +631,7 @@
STFSProtoOpcode opcode;
STSize nbytes;
- byte *rawdata; /* [nbytes] */
+ /* data is passed in the shared memory allocated by the server */
} fsc_getfontdata_out;
/* LAYOUTCHARS
@@ -686,7 +686,8 @@
uint64_t cid;
STCount streamcount;
uint32_t *streamsizes; /* [streamcount] */
- byte **data; /* [streamcount] [streamsizes[i]] */
+ uint32_t totalsize;
+ /* streams are passed in a file descriptor */
} fsc_createfonts_in;
typedef struct {
@@ -1124,8 +1125,7 @@
int ci_getfontdata_out(byte *p,
uint32_t s,
- STSize nbytes,
- byte *rawdata);
+ STSize nbytes);
int ci_layoutchars_in(byte *p,
uint32_t s,
@@ -1164,7 +1164,7 @@
uint64_t cid,
STCount streamcount,
uint32_t *streamsizes,
- byte **data);
+ uint32_t totalsize);
int ci_createfonts_out(byte *p,
uint32_t s,
Index: stsfutil.c
===================================================================
RCS file: /cvs/stsf/stsf/stsflib/stsfutil.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- a/stsfutil.c 26 May 2004 02:58:50 -0000 1.10
+++ b/stsfutil.c 30 May 2004 23:07:18 -0000 1.11
@@ -226,15 +226,15 @@
int i;
if (p == NULL) {
- fprintf(DebugFile,"(nil)\n");
+ DebugStr(-1,"(nil)");
return;
}
for (i=0; i<len; i++) {
if (isprint(p[i])) {
- fputc(p[i], DebugFile);
+ DebugStr(-1, "%c", p[i]);
} else {
- fputc('.', DebugFile);
+ DebugStr(-1, ".");
}
}
}
@@ -246,31 +246,31 @@
abuf[16] = 0;
if (ptr == NULL) {
- fprintf(DebugFile, "(nil)\n");
+ DebugStr(-1, "(nil)\n");
return;
}
for (i = 0; i < len; i++) {
if (!(i % 16)) {
- fprintf(DebugFile, "%010d: ", i);
+ DebugStr(-1, "%010d: ", i);
}
- fprintf(DebugFile, "%02X ", ptr[i]);
+ DebugStr(-1, "%02X ", ptr[i]);
abuf[i & 15] = isprint(ptr[i]) ? ptr[i] : '.';
if ((i % 16) == 7) {
- fprintf(DebugFile, " ");
+ DebugStr(-1, " ");
} else if ((i % 16) == 15) {
- fprintf(DebugFile, "%s\n", (char *)abuf);
+ DebugStr(-1, "%s\n", (char *)abuf);
}
}
if ((k = i % 16) != 0) {
j = 3 * (16 - k);
if (k < 8) j++;
- while (j--) fprintf(DebugFile, " ");
+ while (j--) DebugStr(-1, " ");
abuf[k] = 0;
- fprintf(DebugFile, "%s\n", (char *)abuf);
+ DebugStr(-1, "%s\n", (char *)abuf);
}
}
@@ -389,9 +389,6 @@
}
-
-
-
/**
* Calculates the 128-bit checksum of the file
*/
@@ -435,9 +432,6 @@
}
-
-
-
#if 0
/* XXX figure out why uncompress returns -3 */
@@ -761,38 +755,6 @@
if (familyname_pos != NULL) free(familyname_pos);
}
-#if 0
-void PHeaderDump(STFSDirection direction, void *pheader)
-{
- uint16_t *c16 = (uint16_t*) pheader;
-
- switch(direction) {
- case STFS_OUTGOING:
- fprintf(DebugFile, ">>>\t");
- break;
-
- case STFS_INCOMING:
- fprintf(DebugFile, "<<<\t");
- break;
- }
-
-
- fprintf(DebugFile, "[");
- if ((c16[OPCODE] >> 8) != 0) {
- fprintf(DebugFile, "ctx: %X ", c16[OPCODE]); /* context ID */
- }
- fprintf(DebugFile, "%s (%X) ", ProtoOpcodeName(c16[OPCODE] & OPCODEMASK), c16[OPCODE] & OPCODEMASK);
-
- fprintf(DebugFile, "len: %d]\n", c16[PACLEN]);
-}
-#endif
-
-
-
-
-
-
-
const char *ErrorCodeName(STStatus s)
{
More information about the stsf-commit
mailing list