aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--win32/PlatWin.cxx15
-rw-r--r--win32/ScintillaWin.cxx14
2 files changed, 14 insertions, 15 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index df18f928f..c17cf87a1 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -646,7 +646,7 @@ void SurfaceGDI::Polygon(Point *pts, size_t npts, ColourDesired fore, ColourDesi
BrushColour(back);
std::vector<POINT> outline;
for (size_t i=0; i<npts; i++) {
- POINT pt = POINTFromPoint(pts[i]);
+ const POINT pt = POINTFromPoint(pts[i]);
outline.push_back(pt);
}
::Polygon(hdc, &outline[0], static_cast<int>(npts));
@@ -797,8 +797,8 @@ void SurfaceGDI::DrawRGBAImage(PRectangle rc, int width, int height, const unsig
const BITMAPINFO bpih = {{sizeof(BITMAPINFOHEADER), width, height, 1, 32, BI_RGB, 0, 0, 0, 0, 0},
{{0, 0, 0, 0}}};
void *image = nullptr;
- HBITMAP hbmMem = CreateDIBSection(hMemDC, &bpih,
- DIB_RGB_COLORS, &image, NULL, 0);
+ HBITMAP hbmMem = ::CreateDIBSection(hMemDC, &bpih,
+ DIB_RGB_COLORS, &image, {}, 0);
if (hbmMem) {
HBITMAP hbmOld = SelectBitmap(hMemDC, hbmMem);
@@ -1505,7 +1505,7 @@ void SurfaceD2D::DrawTextCommon(PRectangle rc, const Font &font_, XYPOSITION yba
}
// Explicitly creating a text layout appears a little faster
- IDWriteTextLayout *pTextLayout;
+ IDWriteTextLayout *pTextLayout = nullptr;
const HRESULT hr = pIDWriteFactory->CreateTextLayout(tbuf.buffer, tbuf.tlen, pTextFormat,
rc.Width(), rc.Height(), &pTextLayout);
if (SUCCEEDED(hr)) {
@@ -1818,8 +1818,7 @@ void Window::InvalidateRectangle(PRectangle rc) {
}
void Window::SetFont(Font &font) {
- ::SendMessage(HwndFromWindowID(wid), WM_SETFONT,
- reinterpret_cast<WPARAM>(font.GetID()), 0);
+ SetWindowFont(HwndFromWindowID(wid), font.GetID(), 0);
}
namespace {
@@ -2072,7 +2071,7 @@ void ListBoxX::SetFont(Font &font) {
}
FormatAndMetrics *pfm = static_cast<FormatAndMetrics *>(font.GetID());
fontCopy = pfm->HFont();
- ::SendMessage(lb, WM_SETFONT, reinterpret_cast<WPARAM>(fontCopy), 0);
+ SetWindowFont(lb, fontCopy, 0);
}
}
@@ -2903,7 +2902,7 @@ bool Platform::ShowAssertionPopUps(bool assertionPopUps_) {
}
void Platform::Assert(const char *c, const char *file, int line) {
- char buffer[2000];
+ char buffer[2000] {};
sprintf(buffer, "Assertion [%s] failed at %s %d%s", c, file, line, assertionPopUps ? "" : "\r\n");
if (assertionPopUps) {
const int idButton = ::MessageBoxA(0, buffer, "Assertion failure",
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 97478e872..37d6fe263 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -354,7 +354,7 @@ class ScintillaWin :
sptr_t HandleCompositionInline(uptr_t wParam, sptr_t lParam);
static bool KoreanIME() noexcept;
void MoveImeCarets(Sci::Position offset);
- void DrawImeIndicator(int indicator, int len);
+ void DrawImeIndicator(int indicator, Sci::Position len);
void SetCandidateWindowPos();
void SelectionToHangul();
void EscapeHanja();
@@ -962,7 +962,7 @@ void ScintillaWin::MoveImeCarets(Sci::Position offset) {
}
}
-void ScintillaWin::DrawImeIndicator(int indicator, int len) {
+void ScintillaWin::DrawImeIndicator(int indicator, Sci::Position len) {
// Emulate the visual style of IME characters with indicators.
// Draw an indicator on the character before caret by the character bytes of len
// so it should be called after InsertCharacter().
@@ -1160,7 +1160,7 @@ sptr_t ScintillaWin::HandleCompositionInline(uptr_t, sptr_t lParam) {
InsertCharacter(docChar.c_str(), static_cast<unsigned int>(docChar.size()), CharacterSource::tentativeInput);
- DrawImeIndicator(imeIndicator[i], static_cast<unsigned int>(docChar.size()));
+ DrawImeIndicator(imeIndicator[i], docChar.size());
i += ucWidth;
}
@@ -1536,7 +1536,7 @@ sptr_t ScintillaWin::KeyMessage(unsigned int iMessage, uptr_t wParam, sptr_t lPa
return 1;
} else {
wchar_t wcs[3] = { 0 };
- const unsigned int wclen = UTF16FromUTF32Character(static_cast<unsigned int>(wParam), wcs);
+ const size_t wclen = UTF16FromUTF32Character(static_cast<unsigned int>(wParam), wcs);
AddCharUTF16(wcs, wclen, CharacterSource::directInput);
return FALSE;
}
@@ -1639,7 +1639,7 @@ sptr_t ScintillaWin::EditMessage(unsigned int iMessage, uptr_t wParam, sptr_t lP
if (static_cast<Sci::Position>(wParam) < 0) {
wParam = SelectionStart().Position();
}
- return pdoc->LineFromPosition(static_cast<Sci::Position>(wParam));
+ return pdoc->LineFromPosition(wParam);
case EM_EXLINEFROMCHAR:
return pdoc->LineFromPosition(lParam);
@@ -1664,7 +1664,7 @@ sptr_t ScintillaWin::EditMessage(unsigned int iMessage, uptr_t wParam, sptr_t lP
break;
case EM_SETSEL: {
- Sci::Position nStart = static_cast<Sci::Position>(wParam);
+ Sci::Position nStart = wParam;
Sci::Position nEnd = lParam;
if (nStart == 0 && nEnd == -1) {
nEnd = pdoc->Length();
@@ -2841,7 +2841,7 @@ void ScintillaWin::ImeStartComposition() {
// The negative is to allow for leading
lf.lfHeight = -(std::abs(deviceHeight / SC_FONT_SIZE_MULTIPLIER));
lf.lfWeight = vs.styles[styleHere].weight;
- lf.lfItalic = static_cast<BYTE>(vs.styles[styleHere].italic ? 1 : 0);
+ lf.lfItalic = vs.styles[styleHere].italic ? 1 : 0;
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfFaceName[0] = L'\0';
if (vs.styles[styleHere].fontName) {