Don't try parsing the regex ourselves, which is not just slower but also
more buggy: in particular, we didn't handle regexes with trailing
backslash correctly and could keep reading after the end of the buffer
in this case.
See #25040.
This reverts commit 8395e5733d because
HTTP standard says that senders MUST NOT generate multiple lines with
the same header, with the only exception of Set-Cookie, so we shouldn't
provide a way to do it.
That commit also introduced a nasty regression with the programs calling
AddCommonHeader("User-Agent") not working at all any more after it
because WinHTTP refuses to send a request with multiple copies of this
header.
Also partially reverts 1000d67c13 which
was done later but is logically part of the same commit that is being
reverted.
See #24881.
Replace most 'neither' words introduced after 2b0ee48ef7
(Fix double negatives used with 'neither', 2023-11-25)
with 'either'.
All changes are to comments only.
Closes#24999.
This object shouldn't be destroyed as long as there are any
wxWebRequests using it still alive, as destroying them after the session
would result in a crash, so replace a (possibly dangling) reference to
wxWebSessionImpl in wxWebRequestImpl with a shared pointer, which keeps
it alive for as long as necessary.
See #24969.
Previously it did the same thing as SetValue() in wxMSW but didn't do
anything in wxGTK (and probably other ports), which made it easy to
write code that only worked under Windows but mysteriously didn't show
any text under Linux.
Change it to not do anything anywhere and add an assert to help
detecting wrong uses of this function.
Also add a unit test checking this behaviour.
See #24982.
Detected by undefined behavior sanitizer, on a file with 16 bpp and a color
component of more than 8 bits. Fix by using a different, and more accurate,
method to scale color components to 8 bits.
This could be enhanced, e.g. break lines at characters other than
spaces, support Unicode better etc, but for now add just a very simple
function that should be suitable for wrapping help message in
wxCmdLineParser, where it will be used next.
The rules are different than for BMP files. Broken by b21642b72b (Fix loading
BMP files which use 32bpp but do not have valid alpha (#24939), 2024-11-04)
See #24955
This commit improves the best locale match algorithm by prioritizing
closer matches and add many new tests verifying that this works as
expected.
In order to do this, new information had to be added to the language
database, which was extended with it and updated to use the latest
Unicode CLDR data and latest Windows 11 locale list.
Further, add a set of scripts for maintaining the language database up
to date and a GitHub workflow `genlangdb.yml` which can be run manually
to regenerate the wxWidgets language-related source and header files
from the underlying Windows and Unicode data. It produces 2 artifacts:
- wxLanguageDatabaseDist.zip allows to easily update the
language-related files in the wxWidgets repository by simply copying
all files.
- the normal workflow log and wxLanguageDatabaseLog.zip allow to check
all temporary files of the regeneration process and to detect
potential issues, before the language-related files are actually
replaced by the new ones.
Finally, fix wxUILocaleImplName::GetPreferredUILanguages: Under Windows
10 and above the Windows API function ::GetUserPreferredUILanguages()
returns only the primary UI language plus US English. Additional
preferred UI languages installed by the user are ignored, so instead of
using this function read the list of user preferred languages from the
Windows registry.
Closes#24855.
Based on the behavior of WIN32 LoadFile(), and the gdk-pixbuf BMP loader source
code, the alpha values are ignored unless the compression method is BI_BITFIELDS.
See #10915, #24219
The call to wxGetTranslation() was ambiguous. Fix this by adding missing
wxASCII_STR() for all string literal arguments in wxGETTEXT_IN_CONTEXT
and wxGETTEXT_IN_CONTEXT_PLURAL, just as it is used in _().
Also test that all translation macros expand to compilable code
when wxNO_IMPLICIT_WXSTRING_ENCODING is enabled.
See #1312 and also #24916.
Closes#24925.
All supported platforms provide 64-bit integer types since many years,
so remove the legacy wxLongLongWx implementation and rename
wxLongLongNative to just wxLongLong and always compile it in.
Note that wxLongLong itself must still be kept for compatibility as it
has member functions, such as GetValue() or ToString(), that can be used
in the existing code.
The format of the generated JSON by the httpbin service for
multiple headers with the same name differs between platforms.
These headers are sometimes put into a JSON array and sometimes
concatenated into a single comma-separated string.
wxWebRequest::AddHeader() was added to accompany the existing
SetHeader() method. In wxWebSession, AddCommonHeader() did exist
already but behaved like setting a header. Its behavior was adapted
to its name and SetCommonHeader() was added with the old behavior
to accompany AddCommonHeader().
The WinHTTP and CURL implementations of wxWebRequest do now append
multiple headers of the same name. The URLSession implementation
follows in the next commits.
HTTP headers like Set-Cookie can be present multiple times in a
web response by definition. The existing GetHeader() method is
not sufficient to cope with this situation.
This commit already adds an implementation for Windows.
Linux and macOS follow in the next commits.
Verify that a control with wxNumValidator using wxNUM_VAL_ZERO_AS_BLANK
style doesn't change when it loses focus.
This test would have failed without the fix in the parent commit,
although we have to mark the control as dirty to see it to avoid this
from being hidden by the changes done in 67f634dfc4 (Don't normalize the
value of empty text control on focus loss, 2023-07-02).
Explicitly test that wxTranslations will use a language it doesn't
recognize if the OS asks for it and it is available.
See 44c24f12ee (Fix GetPreferredUILanguage() on macOS, 2024-09-09) and
the discussion in #24804.
Closes#24818.