simon-git: putty (main): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Mon May 29 15:49:04 BST 2023
TL;DR:
d22ccbac Fix UTF-8 flag checks in the Windows conio system.
5f43d11f Add UTF-8 flag to the Windows message_box() wrapper.
36db9374 New utility function: dupwcs.
392be3e4 New utility function: decode_utf8_to_wide_string.
059f42aa New Windows utility function: GetDlgItemTextW_alloc.
e1c6f619 New Windows utility function: request_file_w.
1adcb200 dialog.c: give ctrl->fileselect.filter an opaque type.
85680c77 Make x11_get_auth_from_authfile take a Filename.
8bd75b85 Some support for wide-character filenames in Windows.
Repository: https://git.tartarus.org/simon/putty.git
On the web: https://git.tartarus.org/?p=simon/putty.git
Branch updated: main
Committer: Simon Tatham <anakin at pobox.com>
Date: 2023-05-29 15:49:04
commit d22ccbac6fe8979fecd9c24a7894a9752aca5bba
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=d22ccbac6fe8979fecd9c24a7894a9752aca5bba;hp=8cf372d4a215584a031cfabbee34cbbf15391b1c
Author: Simon Tatham <anakin at pobox.com>
Date: Sun May 28 11:28:18 2023 +0100
Fix UTF-8 flag checks in the Windows conio system.
Having constructed a conio object with its own 'utf8' flag, we should
be checking that flag at time of use rather than the global
conio_use_utf8 (which was already taken into account at setup time).
Otherwise we miss the whole point, which is that without the override
flag turning off UTF-8, _some_ uses of the system should use the
default code page and not UTF-8.
windows/console.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
commit 5f43d11f830aff6d40f011ae0e99e1f38e215ee8
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=5f43d11f830aff6d40f011ae0e99e1f38e215ee8;hp=d22ccbac6fe8979fecd9c24a7894a9752aca5bba
Author: Simon Tatham <anakin at pobox.com>
Date: Mon May 29 13:28:11 2023 +0100
Add UTF-8 flag to the Windows message_box() wrapper.
message_box() previously differed from the real MessageBox API
function in that it permitted the user to provide a help context to be
used for a Help button in the dialog box.
Now it adds a second unusual ability: you can specify that the text
and caption strings are in UTF-8 rather than the system code page.
windows/pageant.c | 2 +-
windows/platform.h | 4 ++--
windows/putty.c | 2 +-
windows/puttygen.c | 14 +++++------
windows/utils/message_box.c | 42 +++++++++++++++++++++++++--------
windows/utils/pgp_fingerprints_msgbox.c | 2 +-
6 files changed, 44 insertions(+), 22 deletions(-)
commit 36db93748eb090bfb88ef8e6b8a9ac0d6cd235df
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=36db93748eb090bfb88ef8e6b8a9ac0d6cd235df;hp=5f43d11f830aff6d40f011ae0e99e1f38e215ee8
Author: Simon Tatham <anakin at pobox.com>
Date: Sun May 28 11:49:12 2023 +0100
New utility function: dupwcs.
Just like dupstr, but for wchar_t strings.
misc.h | 1 +
utils/CMakeLists.txt | 1 +
utils/dupwcs.c | 19 +++++++++++++++++++
3 files changed, 21 insertions(+)
commit 392be3e494dc68f1d41cd27cd300cfcac78c235e
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=392be3e494dc68f1d41cd27cd300cfcac78c235e;hp=36db93748eb090bfb88ef8e6b8a9ac0d6cd235df
Author: Simon Tatham <anakin at pobox.com>
Date: Mon May 29 13:27:16 2023 +0100
New utility function: decode_utf8_to_wide_string.
We already had encode_wide_string_as_utf8, which treats the wide
string as UTF-16 or UTF-32 as appropriate to the size of wchar_t. I'm
about to need the inverse function, and was surprised that it didn't
already exist (even though enough component parts did to make it easy).
misc.h | 4 ++++
utils/CMakeLists.txt | 1 +
utils/decode_utf8_to_wide_string.c | 35 +++++++++++++++++++++++++++++++++++
3 files changed, 40 insertions(+)
commit 059f42aa56fedd74e2bd17caaa763dd37282cbb4
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=059f42aa56fedd74e2bd17caaa763dd37282cbb4;hp=392be3e494dc68f1d41cd27cd300cfcac78c235e
Author: Simon Tatham <anakin at pobox.com>
Date: Mon May 29 13:31:14 2023 +0100
New Windows utility function: GetDlgItemTextW_alloc.
Just like the existing GetDlgItemText_alloc, but for wide strings.
windows/platform.h | 1 +
windows/utils/getdlgitemtext_alloc.c | 19 ++++++++++++++++---
2 files changed, 17 insertions(+), 3 deletions(-)
commit e1c6f61985a7fb04e7336b7483bae6f30314678f
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=e1c6f61985a7fb04e7336b7483bae6f30314678f;hp=059f42aa56fedd74e2bd17caaa763dd37282cbb4
Author: Simon Tatham <anakin at pobox.com>
Date: Mon May 29 15:30:57 2023 +0100
New Windows utility function: request_file_w.
Just like the existing request_file, but wide-character oriented.
windows/platform.h | 2 ++
windows/utils/request_file.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+)
commit 1adcb200f73f349aaec81abd643d116ad535ff8c
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=1adcb200f73f349aaec81abd643d116ad535ff8c;hp=e1c6f61985a7fb04e7336b7483bae6f30314678f
Author: Simon Tatham <anakin at pobox.com>
Date: Mon May 29 15:29:26 2023 +0100
dialog.c: give ctrl->fileselect.filter an opaque type.
The values of that field in a Control structure are already
platform-dependent: you're only supposed to set them in cross-platform
code by using #defined names that each platform will define
differently.
Now I need the _type_ as well as the values to be opaque, because I'm
about to make a change on Windows that turns it into a wide character
string instead of a char string.
dialog.c | 4 ++--
dialog.h | 6 +++---
unix/platform.h | 2 ++
windows/platform.h | 1 +
4 files changed, 8 insertions(+), 5 deletions(-)
commit 85680c77c00ec689a701eaa1bc21974fcd1e7dce
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=85680c77c00ec689a701eaa1bc21974fcd1e7dce;hp=1adcb200f73f349aaec81abd643d116ad535ff8c
Author: Simon Tatham <anakin at pobox.com>
Date: Sun May 28 11:27:09 2023 +0100
Make x11_get_auth_from_authfile take a Filename.
I think the only reason it currently takes a plain string is because
its interesting caller (in unix/x11.c) has just constructed a string
out of an environment variable, and it seemed like the path of least
effort not to bother wrapping it into a proper Filename. But when
Filename on Windows becomes more interesting, we'll need it to take
the full version.
ssh.h | 2 +-
unix/x11.c | 5 ++++-
utils/x11authfile.c | 4 ++--
windows/x11.c | 6 +++---
4 files changed, 10 insertions(+), 7 deletions(-)
commit 8bd75b85eda6e4d89a3773e003591f1602577c82
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=8bd75b85eda6e4d89a3773e003591f1602577c82;hp=85680c77c00ec689a701eaa1bc21974fcd1e7dce
Author: Simon Tatham <anakin at pobox.com>
Date: Sun May 28 11:30:59 2023 +0100
Some support for wide-character filenames in Windows.
The Windows version of the Filename structure now contains three
versions of the pathname, in UTF-16, UTF-8 and the system code page.
Callers can use whichever is most convenient.
All uses of filenames for actually opening files now use the UTF-16
version, which means they can tolerate 'exotic' filenames, by which I
mean those including Unicode characters outside the host system's
CP_ACP default code page.
Other uses of Filename structures inside the 'windows' subdirectory do
something appropriate, e.g. when printing a filename inside a message
box or a console message, we use the UTF-8 version of the filename
with the UTF-8 version of the appropriate API.
There are three remaining pieces to full Unicode filename support:
One is that the cross-platform code has many calls to
filename_to_str(), embodying the assumption that a file name can be
reliably converted into the unspecified current character set; those
will all need changing in some way.
Another is that write_setting_filename(), in windows/storage.c, still
saves filenames to the Registry as an ordinary REG_SZ in the system
code page. So even if an exotic filename were stored in a Conf, that
Conf couldn't round-trip via the Registry and back without corrupting
that filename by coercing it back to a string that fits in CP_ACP and
therefore doesn't represent the same file. This can't be fixed without
a compatibility break in the storage format, and I don't want to make
a minimal change in that area: if we're going to break compatibility,
then we should break it good and hard (the Nanny Ogg principle), and
devise a completely fresh storage representation that fixes as many
other legacy problems as possible at the same time. So that's my plan,
not yet started.
The final point, much more obviously, is that we're still short of
methods to _construct_ any Filename structures using a Unicode input
string! It should now work to enter one in the GUI configurer (either
by manual text input or via the file selector), but it won't
round-trip through a save and load (as discussed above), and there's
still no way to specify one on the command line (the groundwork is
laid by commit 10e1ac7752de928 but not yet linked up).
But this is a start.
windows/console.c | 6 +--
windows/controls.c | 34 +++++++++-------
windows/dialog.c | 7 ++--
windows/gss.c | 33 ++++++++--------
windows/pageant.c | 2 +-
windows/platform.h | 44 +++++++++++++++------
windows/storage.c | 18 ++++++++-
windows/utils/filename.c | 54 ++++++++++++++++++++++----
windows/utils/open_for_write_would_lose_data.c | 14 +++----
windows/window.c | 20 ++++++----
10 files changed, 159 insertions(+), 73 deletions(-)
More information about the tartarus-commits
mailing list