qemacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemacs-devel] Changes to qemacs/unicode_join.c


From: Charlie Gordon
Subject: [Qemacs-devel] Changes to qemacs/unicode_join.c
Date: Wed, 11 May 2005 08:04:30 -0400

Index: qemacs/unicode_join.c
diff -u qemacs/unicode_join.c:1.3 qemacs/unicode_join.c:1.4
--- qemacs/unicode_join.c:1.3   Wed May  4 19:27:36 2005
+++ qemacs/unicode_join.c       Wed May 11 12:04:30 2005
@@ -47,7 +47,7 @@
     tab = malloc(n * sizeof(unsigned short));
     if (!tab) 
         return NULL;
-    for(i=0;i<n;i++) {
+    for (i = 0; i < n; i++) {
         tab[i] = uni_get_be16(f);
     }
     return tab;
@@ -56,13 +56,14 @@
 void load_ligatures(void)
 {
     FILE *f;
+    char filename[MAX_FILENAME_SIZE];
     unsigned char buf[1024];
     int long_count;
 
-    if (find_resource_file(buf, sizeof(buf), "ligatures") < 0)
+    if (find_resource_file(filename, sizeof(filename), "ligatures") < 0)
         return;
 
-    f = fopen(buf, "r");
+    f = fopen(filename, "r");
     if (!f)
         return;
     if (fread(buf, 1, 4, f) != 4 ||
@@ -128,7 +129,7 @@
     memcpy(buf, buf_out, len * sizeof(int));
 
     q = buf_out;
-    for(i=0;i<len;) {
+    for (i = 0; i < len;) {
         l1 = buf[i];
         /* eliminate invisible chars */
         if (l1 >= 0x202a && l1 <= 0x202e) {
@@ -155,19 +156,19 @@
         } else {
             /* generic case : use ligature_long[] table */
             lig = ligature_long;
-            for(;;) {
+            for (;;) {
                 len1 = *lig++;
                 if (len1 == 0)
                     break;
                 len2 = *lig++;
                 if (i + len1 <= len) {
-                    for(j=0;j<len1;j++) {
+                    for (j = 0; j < len1; j++) {
                         if (buf[i+j] != lig[j])
                             goto notfound;
                     }
-                    for(j=0;j<len1;j++)
+                    for (j = 0; j < len1; j++)
                         pos_L_to_V[i + j] = q - buf_out;
-                    for(j=0;j<len2;j++) {
+                    for (j = 0; j < len2; j++) {
                         *q++ = lig[len1 + j];
                     }
                     i += len1;
@@ -198,7 +199,7 @@
     int i, mask, c;
 
     mask = 0;
-    for(i=0;i<len;i++) {
+    for (i = 0; i < len; i++) {
         c = buf[i];
         if (c <= 0x7f) /* latin1 fast handling */
             continue;
@@ -216,7 +217,7 @@
 static void compose_char_to_glyph(unsigned int *ctog, int len, unsigned *ctog1)
 {
     int i;
-    for(i=0;i<len;i++)
+    for (i = 0; i < len; i++)
         ctog[i] = ctog1[ctog[i]];
 }
 
@@ -225,9 +226,9 @@
     int i, len2 = len / 2;
     
     for (i = 0; i < len2; i++) {
-       unsigned int tmp = str[i];
-       str[i] = fribidi_get_mirror_char(str[len - 1 - i]);
-       str[len - 1 - i] = fribidi_get_mirror_char(tmp);
+        unsigned int tmp = str[i];
+        str[i] = fribidi_get_mirror_char(str[len - 1 - i]);
+        str[len - 1 - i] = fribidi_get_mirror_char(tmp);
     }
     /* do not forget central char ! */
     if (len & 1) {
@@ -243,7 +244,7 @@
    buffer. */
 int unicode_to_glyphs(unsigned int *dst, unsigned int *char_to_glyph_pos,
                       int dst_size, unsigned int *src, int src_size,
-                     int reverse)
+                      int reverse)
 {
     int len, i;
     unsigned int ctog[src_size];
@@ -290,7 +291,7 @@
 
         if (reverse) {
             bidi_reverse_buf(buf, len);
-            for(i=0;i<src_size;i++) {
+            for (i = 0; i < src_size; i++) {
                 ctog[i] = len - 1 - ctog[i];
             }
         }
@@ -325,7 +326,7 @@
         len = dst_size;
     memcpy(dst, src, len * sizeof(unsigned int));
     if (char_to_glyph_pos) {
-        for(i=0;i<len;i++)
+        for (i = 0; i < len; i++)
             char_to_glyph_pos[i] = i;
     }
     return len;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]