Hi folks!
I tried clang-static-analyzer on irssi 1.1.1, it seems like it
finds some things. Here's a diff, but there might be more that you would
want to check, or choose to work differently.
(in special-vars.c, ret is commands->data sometime)
I hope it's not too much trouble if reported as a confidential bug.
Thanks.
This adds a i_wcwidth() function that replaces mk_wcwidth(), and a
'wcwidth_implementation' setting to pick which one it wraps.
Values:
- old: uses our local mk_wcwidth() which implements unicode 5.0
- system: uses the libc-provided wcwidth(), which may be better or worse
than ours depending on how up to date the system is.
- auto: tests the system one against two characters that became
fullwidth in unicode 5.2 and 9.0 respectively. If either of them pass,
pick the system implementation, otherwise pick ours.
It defaults to auto.
mk_wcwidth() is still preferable in some cases, since the way it uses
ranges for fullwidth characters means most CJK blocks are covered even
if their characters didn't exist back then.
The "system" implementation is also wrapped to never return -1, but to
assume those unknown characters use one cell. Quoting the code:
/* Treat all unknown characters as taking one cell. This is
* the reason mk_wcwidth and other outdated implementations
* mostly worked with newer unicode, while glibc's wcwidth
* needs updating to recognize new characters.
*
* Instead of relying on that, we keep the behavior of assuming
* one cell even for glibc's implementation, which is still
* highly accurate and less of a headache overall.
*/
A side-effect of 8deb618 is that `/save` may replace configuration files
that are symlinks with regular files. Fix this by resolving all
symlinks before renaming the temporary file.
Some programs and users send SIGWINCH as a request for the client to redraw
in the event of session detachment/reattachment (e.g. abduco). A well-formed
terminal will only send SIGWINCH when the window size has changed, so there
is no need to optimise this case out.
Fixes#888.
Previously we showed that there was a topic set when using /topic, just
an empty one. This was different than how we show such topics when
initially joining a channel. Now we say that the topic is unset in both
cases.
Don't use errno if it is not set and show the default error message
instead. This prevents messages like "SSL handshake failed: Success"
from being shown.
This is modeled after glib's g_file_set_contents. It doesn't use that
function directly because the writing is done with GIOChannel
streaming-like writes and g_file_set_contents expects the whole thing to
be in-memory.
Main differences with g_file_set_contents:
- complete lack of win32 special casing (cygwin/WSL should work though)
- no fallocate() (linux only, but we don't know the size upfront, anyway)
- always calls fsync (glib skips it on btrfs or when not overwriting)
Other than that, it's the same old mkstemp + fsync + rename.