shell/source/backends/wininetbe/wininetbackend.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
New commits: commit 873814828f8db91cf622e900a59ec1009dcc03a2 Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Tue Mar 20 11:43:59 2018 +0100 tdf#116516: INTERNET_PROXY_INFO always contains char* data Regression from e80aef4e032f08ef0c4cfbb028bf83b81002f112 The InternetQueryOption has two variants: ANSI (A) and Unicode (W) (see https://msdn.microsoft.com/en-us/library/aa385101). INTERNET_PROXY_INFO struct we are using is defined to contain two LPCTSTR members (see https://msdn.microsoft.com/en-us/library/aa385148). When UNICODE is defined, InternetQueryOption expands to W variant, and at the same time, all MS-specific generic string types (like TCHAR or LPCTSTR) are expanded to wchar_t-based types. So, the expectation is that InternetQueryOptionW fills the struct with pointers to widechar strings. But actually this is not true: InternetQueryOptionW still returns char-based strings in the struct; so just revert partially commit above. Change-Id: I0facb1baf2a191f7bafdf185e684bfe741ca677a Reviewed-on: https://gerrit.libreoffice.org/51629 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 3837901ef422d432f709dd95352796a54b58aae6) Reviewed-on: https://gerrit.libreoffice.org/51633 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/shell/source/backends/wininetbe/wininetbackend.cxx b/shell/source/backends/wininetbe/wininetbackend.cxx index b1006803d065..86cfdfec654e 100644 --- a/shell/source/backends/wininetbe/wininetbackend.cxx +++ b/shell/source/backends/wininetbe/wininetbackend.cxx @@ -165,10 +165,14 @@ WinInetBackend::WinInetBackend() // an empty proxy list, so we don't have to check if // proxy is enabled or not - // We use a W-version of InternetQueryOption; it returns struct with pointers to wide strings - // There's no INTERNET_PROXY_INFOW, so we simply cast returned struct's members - OUString aProxyList = reinterpret_cast<const sal_Unicode*>( lpi->lpszProxy ); - OUString aProxyBypassList = reinterpret_cast<const sal_Unicode*>( lpi->lpszProxyBypass ); + // We use InternetQueryOptionW (see https://msdn.microsoft.com/en-us/library/aa385101); + // it fills INTERNET_PROXY_INFO struct which is definned in WinInet.h to have LPCTSTR + // (i.e., the UNICODE-dependent generic string type expanding to const wchar_t* when + // UNICODE is defined, and InternetQueryOption macro expands to InternetQueryOptionW). + // Thus, it's natural to expect that W version would return wide strings. But it's not + // true. The W version still returns const char* in INTERNET_PROXY_INFO. + OUString aProxyList = OUString::createFromAscii( lpi->lpszProxy ); + OUString aProxyBypassList = OUString::createFromAscii( lpi->lpszProxyBypass ); // override default for ProxyType, which is "0" meaning "No proxies". valueProxyType_.IsPresent = true; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits