xC: slightly clean up character encodings

This commit is contained in:
Přemysl Eric Janouch 2022-09-02 14:04:22 +02:00
parent 36f8c7639f
commit 2160d03794
Signed by: p
GPG Key ID: A0420B94F92B9493

7
xC.c
View File

@ -4234,6 +4234,7 @@ buffer_get_log_path (struct buffer *buffer)
(void) mkdir_with_parents (path.str, NULL); (void) mkdir_with_parents (path.str, NULL);
str_append_c (&path, '/'); str_append_c (&path, '/');
// FIXME: This mixes up character encodings.
make_log_filename (buffer->name, &path); make_log_filename (buffer->name, &path);
str_append (&path, ".log"); str_append (&path, ".log");
return str_steal (&path); return str_steal (&path);
@ -4255,7 +4256,7 @@ buffer_open_log_file (struct app_context *ctx, struct buffer *buffer)
// or an error that includes the below message. // or an error that includes the below message.
char *path = buffer_get_log_path (buffer); char *path = buffer_get_log_path (buffer);
if (!(buffer->log_file = fopen (path, "ab"))) if (!(buffer->log_file = fopen (path, "ab")))
log_global_error (ctx, "Couldn't open log file `#s': #l", log_global_error (ctx, "Couldn't open log file `#l': #l",
path, strerror (errno)); path, strerror (errno));
else else
set_cloexec (fileno (buffer->log_file)); set_cloexec (fileno (buffer->log_file));
@ -13085,6 +13086,8 @@ locale_to_utf8 (struct app_context *ctx, const char *locale,
const char *p = locale; const char *p = locale;
// Reset the shift state, FWIW // Reset the shift state, FWIW
// TODO: Don't use this iconv handle directly at all, elsewhere in xC.
// And ideally use U+FFFD with EILSEQ.
(void) iconv (ctx->term_to_utf8, NULL, NULL, NULL, NULL); (void) iconv (ctx->term_to_utf8, NULL, NULL, NULL, NULL);
bool fixed[n_indexes]; bool fixed[n_indexes];
@ -13456,7 +13459,7 @@ static void
input_editor_cleanup (struct app_context *ctx) input_editor_cleanup (struct app_context *ctx)
{ {
if (unlink (ctx->editor_filename)) if (unlink (ctx->editor_filename))
log_global_error (ctx, "Could not unlink `#s': #l", log_global_error (ctx, "Could not unlink `#l': #l",
ctx->editor_filename, strerror (errno)); ctx->editor_filename, strerror (errno));
cstr_set (&ctx->editor_filename, NULL); cstr_set (&ctx->editor_filename, NULL);