[stsf-commit] stsf/stsflib fscomm.c, 1.2, 1.3 fscomm.h, 1.2, 1.3 stsfutil.c, 1.8, 1.9 stsfutil.h, 1.4, 1.5

Alexander Gelfenbain stsf-commit at pdx.freedesktop.org
Mon May 24 19:47:28 PDT 2004


Committed by: adg


Index: fscomm.c
===================================================================
RCS file: /cvs/stsf/stsf/stsflib/fscomm.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/fscomm.c	9 May 2004 23:20:37 -0000	1.2
+++ b/fscomm.c	25 May 2004 02:47:25 -0000	1.3
@@ -70,7 +70,7 @@
  * [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][] 
  */
 
-uint32_t safe_strlen(const char *str)
+static uint32_t safe_strlen(const char *str)
 {
     uint32_t ret = str == NULL ? 0 : strlen(str);
 
@@ -881,7 +881,7 @@
     uint32_t n = sizeof(fsc_newfontinstance_out);
 
     if (s < n) return n;
-    q->opcode = FS_NEWFONTINSTANCE_IN;
+    q->opcode = FS_NEWFONTINSTANCE_OUT;
     q->instanceID = instanceID;
     return 0;
 }
@@ -1013,7 +1013,7 @@
     fsc_getfontrenderingparams_in *q = (fsc_getfontrenderingparams_in *) p;
     uint32_t n = sizeof(fsc_getinstancemetrics_out);
     if (s < n) return n;
-    q->opcode = FS_GETINSTANCEMETRICS_OUT;
+    q->opcode = FS_GETFONTRENDERINGPARAMS_IN;;
     q->instanceID = instanceID;
     return 0;
 }
@@ -1026,16 +1026,16 @@
                                   uint32_t s,
                                   uint32_t scalerID,
                                   FSRenderingMode mode,
-                                  uint32_t bitPerPixel,
+                                  uint32_t bitsPerPixel,
                                   STLookupTable *clut)
 {
     fsc_getfontrenderingparams_out *q = (fsc_getfontrenderingparams_out *) p;
     uint32_t n = sizeof(fsc_getinstancemetrics_out);
     if (s < n) return n;
-    q->opcode =  FS_GETINSTANCEMETRICS_OUT;
+    q->opcode =  FS_GETFONTRENDERINGPARAMS_OUT;
     q->scalerID = scalerID;
     q->mode = mode;
-    q->bitPerPixel = bitPerPixel;
+    q->bitsPerPixel = bitsPerPixel;
     memcpy(&q->clut, clut, sizeof(STLookupTable));
     return 0;
 }
@@ -1116,7 +1116,7 @@
     uint32_t curoffs = sizeof(fsc_getextfontinfo_out);
     
     if (s < n) return n;
-    q->opcode = FS_GETEXTFONTINFO_IN;
+    q->opcode = FS_GETEXTFONTINFO_OUT;
     if (fontname_strlen != 0) {
         q->fontname = (char *) curoffs;
         memcpy(p+curoffs, fontname, fontname_strlen);
@@ -1651,10 +1651,9 @@
                       STScaler scaler,
                       STLayoutEngine le,
                       STLocale locale,
-                      uint32_t ucount,
+                      uint32_t charCount,
                       utf16 *chars,
                       STPosition offset,
-                      STCount charCount,
                       STCount charMax,
                       STBoolean rightToLeft,
                       double x,
@@ -1662,7 +1661,7 @@
 {
     fsc_layoutchars_in *q = (fsc_layoutchars_in *) p;
     uint32_t curoffs = sizeof(fsc_layoutchars_in);
-    uint32_t n = sizeof(fsc_layoutchars_in) + ucount * sizeof(utf16);
+    uint32_t n = sizeof(fsc_layoutchars_in) + charCount * sizeof(utf16);
 
     if (s < n) return n;
     q->opcode = FS_LAYOUTCHARS_IN;
@@ -1670,11 +1669,11 @@
     q->scaler = scaler;
     q->le = le;
     q->locale = locale;
-    q->ucount = ucount;
-    if (ucount != 0) {
+    q->charCount = charCount;
+    if (charCount != 0) {
         q->chars = (utf16 *) curoffs;
-        memcpy(p+curoffs, chars, ucount * sizeof(utf16));
-        /* curoffs += ucount * sizeof(utf16) */
+        memcpy(p+curoffs, chars, charCount * sizeof(utf16));
+        /* curoffs += charCount * sizeof(utf16) */
     } else {
         q->chars = NULL;
     }
@@ -2180,7 +2179,7 @@
 
 /*      GETNAMESTRING
  */
-int ci_getnamesting_in(byte *p,
+int ci_getnamestring_in(byte *p,
                        uint32_t s,
                        STFont font,
                        STNameTag *tag)

Index: fscomm.h
===================================================================
RCS file: /cvs/stsf/stsf/stsflib/fscomm.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/fscomm.h	9 May 2004 23:20:37 -0000	1.2
+++ b/fscomm.h	25 May 2004 02:47:25 -0000	1.3
@@ -451,7 +451,7 @@
 
     uint32_t scalerID;
     FSRenderingMode mode;
-    uint32_t bitPerPixel;
+    uint32_t bitsPerPixel;
     STLookupTable clut;
 } fsc_getfontrenderingparams_out;
 
@@ -643,10 +643,9 @@
     STScaler scaler;
     STLayoutEngine le;
     STLocale locale;
-    uint32_t ucount;
-    utf16 *chars;   /* [len] */
+    uint32_t charCount;
+    utf16 *chars;   /* [charCount] */
     STPosition offset;
-    STCount charCount;
     STCount charMax;
     STBoolean rightToLeft;
     double x;
@@ -1134,10 +1133,9 @@
                       STScaler scaler,
                       STLayoutEngine le,
                       STLocale locale,
-                      uint32_t ucount,
+                      uint32_t charCount,
                       utf16 *chars,
                       STPosition offset,
-                      STCount charCount,
                       STCount charMax,
                       STBoolean rightToLeft,
                       double x,
@@ -1248,7 +1246,14 @@
     
 /* Initial handshake */
 
+typedef enum {
+    HANDSHAKE_VERIFY = 0,
+    HANDSHAKE_CONNECT = 1,
+    HANDSHAKE_VERIFY_REPLY = 74
+} HSOpcode;
+
 typedef struct {
+    HSOpcode opcode;            
     uint64_t cid;
     int major;                  /* Client STSF version major */
     int minor;                  /* Client STSF version minor */  
@@ -1257,6 +1262,7 @@
 } DoorHandshakeIn;
 
 typedef struct {
+    HSOpcode opcode;
     STStatus ret;
     int major;                  /* Server STSF version major */
     int minor;                  /* Server STSF version minor */  
@@ -1305,6 +1311,7 @@
 typedef struct {
     uint64_t cid;           /* font server always returns client's CID */
     STStatus ret;
+    FSProtoState state;
     union {
         ConnectOut  c;
         VerifyOut   v;

Index: stsfutil.c
===================================================================
RCS file: /cvs/stsf/stsf/stsflib/stsfutil.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- a/stsfutil.c	9 May 2004 23:20:37 -0000	1.8
+++ b/stsfutil.c	25 May 2004 02:47:25 -0000	1.9
@@ -62,6 +62,7 @@
 #include <sys/types.h>
 #include <sys/uio.h>
 #include <ctype.h>
+#include <dirent.h>
 #ifdef _WIN32
 /* XXX Is there ZLIB for Windows? */
 #else
@@ -1341,6 +1342,45 @@
     return ret;
 }
 
+void DelTree(char *path)
+{
+    DIR *dirp = opendir(path);
+    struct dirent *dp;
+    struct stat st;
+
+    if (!dirp) {
+        if (stat(path, &st) == 0 && !S_ISDIR(st.st_mode)) {
+            // printf("- %s\n", path);
+            unlink(path);
+        }
+        return;
+    }
+
+    // printf("+ %s\n", path);
+
+    while(1) {
+        char *cp;
+
+        if ((dp = readdir(dirp)) == NULL) break;
+        if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) continue;
+        cp = malloc(strlen(path) + strlen(dp->d_name) + 2);
+        strcpy(cp, path); strcat(cp, "/"); strcat(cp, dp->d_name);
+        if (stat(cp, &st) == 0) {
+            if (!S_ISDIR(st.st_mode)) {
+                // printf("- %s\n", cp);
+                unlink(cp);
+            } else {
+                DelTree(cp);
+                rmdir(cp);
+            }
+        }
+        free(cp);
+    }
+    closedir(dirp);
+    rmdir(path);
+}
+
+
 byte *savestring(const char *str, size_t len, int expandToUCS2)
 {
     byte *res;

Index: stsfutil.h
===================================================================
RCS file: /cvs/stsf/stsf/stsflib/stsfutil.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- a/stsfutil.h	9 May 2004 23:20:37 -0000	1.4
+++ b/stsfutil.h	25 May 2004 02:47:25 -0000	1.5
@@ -191,6 +191,10 @@
 /* creates a directory, returns 0 on success */
 int CreateDir(char *path, mode_t mode);
 
+/* removes a file or a directory tree */
+void DelTree(char *path);
+
+
 /* strdup() with an option to convert it to UCS-2 */
 byte *savestring(const char *str, size_t len, int expandToUCS2);
 




More information about the stsf-commit mailing list