]> code.delx.au - gnu-emacs/blobdiff - src/fns.c
(struct redisplay_interface): Add active_p argument to
[gnu-emacs] / src / fns.c
index 69c7418845ee5cbf57b1c5f91aa9b90bd0a207e6..fe3e0f82a3f9b06ce32d10f0f8fd47ee6485a435 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -1047,16 +1047,15 @@ string_to_multibyte (string)
 {
   unsigned char *buf;
   int nbytes;
-  int i;
 
   if (STRING_MULTIBYTE (string))
     return string;
 
   nbytes = parse_str_to_multibyte (SDATA (string), SBYTES (string));
-  /* If all the chars are ASCII, they won't need any more bytes
-     once converted.  In that case, we can return STRING itself.  */
+  /* If all the chars are ASCII or eight-bit-graphic, they won't need
+     any more bytes once converted.  */
   if (nbytes == SBYTES (string))
-    return string;
+    return make_multibyte_string (SDATA (string), nbytes, nbytes);
 
   buf = (unsigned char *) alloca (nbytes);
   bcopy (SDATA (string), buf, SBYTES (string));
@@ -2699,6 +2698,14 @@ map_char_table (c_function, function, subtable, arg, depth, indices)
     }
 }
 
+static void void_call2 P_ ((Lisp_Object a, Lisp_Object b, Lisp_Object c));
+static void
+void_call2 (a, b, c)
+     Lisp_Object a, b, c;
+{
+  call2 (a, b, c);
+}
+
 DEFUN ("map-char-table", Fmap_char_table, Smap_char_table,
        2, 2, 0,
        doc: /* Call FUNCTION for each (normal and generic) characters in CHAR-TABLE.
@@ -2712,7 +2719,11 @@ The key is always a possible IDX argument to `aref'.  */)
 
   CHECK_CHAR_TABLE (char_table);
 
-  map_char_table ((POINTER_TYPE *) call2, Qnil, char_table, function, 0, indices);
+  /* When Lisp_Object is represented as a union, `call2' cannot directly
+     be passed to map_char_table because it returns a Lisp_Object rather
+     than returning nothing.
+     Casting leads to crashes on some architectures.  -stef  */
+  map_char_table (void_call2, Qnil, char_table, function, 0, indices);
   return Qnil;
 }
 
@@ -3490,7 +3501,7 @@ The data read from the system are decoded using `locale-coding-system'.  */)
             it is consistent with CODESET?  If not, what to do?  */
          Faset (v, make_number (i),
                 code_convert_string_norecord (val, Vlocale_coding_system,
-                                              Qnil));
+                                              0));
        }
       return v;
     }
@@ -3508,7 +3519,7 @@ The data read from the system are decoded using `locale-coding-system'.  */)
          str = nl_langinfo (months[i]);
          val = make_unibyte_string (str, strlen (str));
          p->contents[i] =
-           code_convert_string_norecord (val, Vlocale_coding_system, Qnil);
+           code_convert_string_norecord (val, Vlocale_coding_system, 0);
        }
       XSETVECTOR (val, p);
       return val;