diff --git a/src/os/windows/string_uniscribe.cpp b/src/os/windows/string_uniscribe.cpp index 9ba43d5bdd..210e7a17f0 100644 --- a/src/os/windows/string_uniscribe.cpp +++ b/src/os/windows/string_uniscribe.cpp @@ -143,8 +143,7 @@ static HFONT HFontFromFont(Font *font) { if (font->fc->GetOSHandle() != nullptr) return CreateFontIndirect(reinterpret_cast(const_cast(font->fc->GetOSHandle()))); - LOGFONT logfont; - ZeroMemory(&logfont, sizeof(LOGFONT)); + LOGFONT logfont{}; logfont.lfHeight = font->fc->GetHeight(); logfont.lfWeight = FW_NORMAL; logfont.lfCharSet = DEFAULT_CHARSET; @@ -249,12 +248,10 @@ static bool UniscribeShapeRun(const UniscribeParagraphLayoutFactory::CharType *b static std::vector UniscribeItemizeString(UniscribeParagraphLayoutFactory::CharType *buff, int32_t length) { /* Itemize text. */ - SCRIPT_CONTROL control; - ZeroMemory(&control, sizeof(SCRIPT_CONTROL)); + SCRIPT_CONTROL control{}; control.uDefaultLanguage = _current_language->winlangid; - SCRIPT_STATE state; - ZeroMemory(&state, sizeof(SCRIPT_STATE)); + SCRIPT_STATE state{}; state.uBidiLevel = _current_text_dir == TD_RTL ? 1 : 0; std::vector items(16); diff --git a/src/safeguards.h b/src/safeguards.h index 91157590a7..97c2bc6c45 100644 --- a/src/safeguards.h +++ b/src/safeguards.h @@ -49,6 +49,7 @@ #define memcmp SAFEGUARD_DO_NOT_USE_THIS_METHOD #define memcpy SAFEGUARD_DO_NOT_USE_THIS_METHOD +#define memset SAFEGUARD_DO_NOT_USE_THIS_METHOD /* Use fgets instead. */ #define gets SAFEGUARD_DO_NOT_USE_THIS_METHOD