Christian Grasser 5c1813185a Update to scintilla 5.5.6 & Lexilla 5.4.4
Release 5.5.6 (https://www.scintilla.org/scintilla556.zip)

    Released 2 April 2025.
*   Disallow changing case of protected text. Bug #2463.
*   Return enumeration type from MarkerSymbolDefined to match MarkerDefine. Bug #2469.
*   On Win32, use DirectWrite for autocompletion lists when DirectWrite chosen for document text.
*   On Win32, optimize case-insensitive DBCS search to be around 5 times faster by using 64K memory to cache folding data for each DBCS code page used.
*   On Win32, fix a crash with bidirectional text.
*   When using Visual C++ through nmake, fix building for ARM64. Feature #1546.
*   On Qt, draw clipped UTF-8 text correctly. Bug #2464.
*   On Qt, avoid a dwell start when the mouse is moved outside the Scintilla widget. Bug #2466.
*   On Qt, autoCompleteSelection converts from local encoding when not in Unicode mode. Bug #2465.

Release 5.4.4 (https://www.scintilla.org/lexilla544.zip)

    Released 2 April 2025.
*   Fix building for ARM64. Pull request #308.

Close #16373
2025-04-08 18:41:39 +02:00

65 lines
1.6 KiB
C++

// Scintilla source code edit control
/** @file WinTypes.h
** Implement safe release of COM objects and access to functions in DLLs.
** Header contains all implementation - there is no .cxx file.
**/
// Copyright 2020-2021 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef WINTYPES_H
#define WINTYPES_H
namespace Scintilla::Internal {
// Release an IUnknown* and set to nullptr.
// While IUnknown::Release must be noexcept, it isn't marked as such so produces
// warnings which are avoided by the catch.
template <class T>
inline void ReleaseUnknown(T *&ppUnknown) noexcept {
if (ppUnknown) {
try {
ppUnknown->Release();
} catch (...) {
// Never occurs
}
ppUnknown = nullptr;
}
}
struct UnknownReleaser {
// Called by unique_ptr to destroy/free the resource
template <class T>
void operator()(T *pUnknown) noexcept {
try {
pUnknown->Release();
} catch (...) {
// IUnknown::Release must not throw, ignore if it does.
}
}
};
/// Find a function in a DLL and convert to a function pointer.
/// This avoids undefined and conditionally defined behaviour.
template<typename T>
inline T DLLFunction(HMODULE hModule, LPCSTR lpProcName) noexcept {
if (!hModule) {
return nullptr;
}
FARPROC function = ::GetProcAddress(hModule, lpProcName);
static_assert(sizeof(T) == sizeof(function));
T fp {};
memcpy(&fp, &function, sizeof(T));
return fp;
}
inline void ReleaseLibrary(HMODULE &hLib) noexcept {
if (hLib) {
FreeLibrary(hLib);
hLib = {};
}
}
}
#endif