Add some prototype to silence silly warnings.
[sxemacs] / src / mule / file-coding.c
index a64a0a9..b2dcd9a 100644 (file)
@@ -1228,6 +1228,7 @@ and `coding-system-canonical-name-p'.
 
        /* Checks that aliasee names a coding-system */
        real_coding_system = Fget_coding_system(aliasee);
+       SXE_SET_UNUSED(real_coding_system);
 
        /* Check for coding system alias loops */
        if (EQ(alias, aliasee))
@@ -1851,9 +1852,13 @@ static Lisp_Object coding_system_from_mask(int mask)
 
 void
 autodetect_real_coding_system(lstream_t stream, Lisp_Object * codesys_in_out,
-                            eol_type_t * eol_type_in_out)
+                             eol_type_t * eol_type_in_out);
+
+void
+autodetect_real_coding_system(lstream_t stream, Lisp_Object * codesys_in_out,
+                             eol_type_t * eol_type_in_out)
 {
-       static const char mime_name_valid_chars[] = 
+       static const char mime_name_valid_chars[] =
                "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                "abcdefghijklmnopqrstuvwxyz"
                "0123456789"
@@ -1932,7 +1937,7 @@ autodetect_real_coding_system(lstream_t stream, Lisp_Object * codesys_in_out,
                                while (*p == ' ' || *p == '\t') {
                                        p++;
                                }
-                                       
+
                                /* Get coding system name */
                                save = *suffix;
                                *suffix = '\0';
@@ -1950,6 +1955,42 @@ autodetect_real_coding_system(lstream_t stream, Lisp_Object * codesys_in_out,
                                }
                                break;
                        }
+                       /* Try " coding:" */
+                       if (NILP(coding_system)) {
+                               for (p = local_vars_beg, scan_end = suffix - LENGTH(" coding:?");
+                                    p <= scan_end; p++) {
+                                       Extbyte save;
+                                       int n;
+
+                                       if (memcmp(" coding:", p, LENGTH(" coding:")) != 0) {
+                                               continue;
+                                       }
+                                       if (p != local_vars_beg && strchr(" \t;", *p) == NULL ) {
+                                               continue;
+                                       }
+                                       p += LENGTH(" coding:");
+                                       while (*p == ' ' || *p == '\t') {
+                                               p++;
+                                       }
+
+                                       /* Get coding system name */
+                                       save = *suffix;
+                                       *suffix = '\0';
+                                       /* Characters valid in a MIME charset
+                                          name (rfc 1521), and in a Lisp
+                                          symbol name. */
+                                       n = strspn((char *)p, mime_name_valid_chars);
+                                       *suffix = save;
+                                       if (n > 0) {
+                                               save = p[n];
+                                               p[n] = '\0';
+                                               coding_system = Ffind_coding_system(
+                                                       intern((char *)p));
+                                               p[n] = save;
+                                       }
+                                       break;
+                               }
+                       }
                        break;
                }
                break;