X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/d6e164af0211eb18fad654d777549a019776e9ba..2a2c6ee8d18267c16e3953194c6066d9a22b88a5:/src/coding.c diff --git a/src/coding.c b/src/coding.c index e72d7b7186..7d199567fd 100644 --- a/src/coding.c +++ b/src/coding.c @@ -8419,11 +8419,10 @@ from_unicode (Lisp_Object str) Lisp_Object from_unicode_buffer (const wchar_t *wstr) { - return from_unicode ( - make_unibyte_string ( - (char *) wstr, - /* we get one of the two final 0 bytes for free. */ - 1 + sizeof (wchar_t) * wcslen (wstr))); + /* We get one of the two final null bytes for free. */ + ptrdiff_t len = 1 + sizeof (wchar_t) * wcslen (wstr); + AUTO_STRING_WITH_LEN (str, (char *) wstr, len); + return from_unicode (str); } wchar_t * @@ -9844,7 +9843,8 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS...) */) if (!(STRINGP (target) || (EQ (operation, Qinsert_file_contents) && CONSP (target) && STRINGP (XCAR (target)) && BUFFERP (XCDR (target))) - || (EQ (operation, Qopen_network_stream) && INTEGERP (target)))) + || (EQ (operation, Qopen_network_stream) + && (INTEGERP (target) || EQ (target, Qt))))) error ("Invalid argument %"pI"d of operation `%s'", XFASTINT (target_idx) + 1, SDATA (SYMBOL_NAME (operation))); if (CONSP (target))