diff options
-rw-r--r-- | win32/HanjaDic.cxx | 4 | ||||
-rw-r--r-- | win32/PlatWin.cxx | 15 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 47 |
3 files changed, 25 insertions, 41 deletions
diff --git a/win32/HanjaDic.cxx b/win32/HanjaDic.cxx index ccc303a99..a67a56122 100644 --- a/win32/HanjaDic.cxx +++ b/win32/HanjaDic.cxx @@ -64,10 +64,10 @@ private: public: IHanjaDic *HJinterface; - HanjaDic() : HJinterface(NULL) { + HanjaDic() : HJinterface(nullptr) { hr = CLSIDFromProgID(OLESTR("mshjdic.hanjadic"), &CLSID_HanjaDic); if (SUCCEEDED(hr)) { - hr = CoCreateInstance(CLSID_HanjaDic, NULL, + hr = CoCreateInstance(CLSID_HanjaDic, nullptr, CLSCTX_INPROC_SERVER, IID_IHanjaDic, (LPVOID *)& HJinterface); if (SUCCEEDED(hr)) { diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 499fcac7f..10fded545 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -98,7 +98,7 @@ bool LoadD2D() { // A single threaded factory as Scintilla always draw on the GUI thread fnD2DCF(D2D1_FACTORY_TYPE_SINGLE_THREADED, __uuidof(ID2D1Factory), - 0, + nullptr, reinterpret_cast<IUnknown**>(&pD2DFactory)); } } @@ -601,7 +601,7 @@ int SurfaceGDI::DeviceHeightFont(int points) { } void SurfaceGDI::MoveTo(int x_, int y_) { - ::MoveToEx(hdc, x_, y_, 0); + ::MoveToEx(hdc, x_, y_, nullptr); } void SurfaceGDI::LineTo(int x_, int y_) { @@ -1800,7 +1800,7 @@ void Window::Show(bool show) { } void Window::InvalidateAll() { - ::InvalidateRect(HwndFromWindowID(wid), NULL, FALSE); + ::InvalidateRect(HwndFromWindowID(wid), nullptr, FALSE); } void Window::InvalidateRectangle(PRectangle rc) { @@ -2383,7 +2383,7 @@ POINT ListBoxX::MaxTrackSize() const { void ListBoxX::SetRedraw(bool on) { ::SendMessage(lb, WM_SETREDRAW, on, 0); if (on) - ::InvalidateRect(lb, NULL, TRUE); + ::InvalidateRect(lb, nullptr, TRUE); } void ListBoxX::ResizeToCursor() { @@ -2782,22 +2782,17 @@ LRESULT PASCAL ListBoxX::StaticWndProc( namespace { bool ListBoxX_Register() noexcept { - WNDCLASSEX wndclassc; + WNDCLASSEX wndclassc {}; wndclassc.cbSize = sizeof(wndclassc); // We need CS_HREDRAW and CS_VREDRAW because of the ellipsis that might be drawn for // truncated items in the list and the appearance/disappearance of the vertical scroll bar. // The list repaint is double-buffered to avoid the flicker this would otherwise cause. wndclassc.style = CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW; - wndclassc.cbClsExtra = 0; wndclassc.cbWndExtra = sizeof(ListBoxX *); wndclassc.hInstance = hinstPlatformRes; - wndclassc.hIcon = NULL; - wndclassc.hbrBackground = NULL; - wndclassc.lpszMenuName = NULL; wndclassc.lpfnWndProc = ListBoxX::StaticWndProc; wndclassc.hCursor = ::LoadCursor(NULL, IDC_ARROW); wndclassc.lpszClassName = ListBoxX_ClassName; - wndclassc.hIconSm = 0; return ::RegisterClassEx(&wndclassc) != 0; } diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index efa0520f8..b85b4c80d 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -240,18 +240,18 @@ public: } unsigned int GetImeCaretPos() const noexcept { - return ImmGetCompositionStringW(hIMC, GCS_CURSORPOS, NULL, 0); + return ImmGetCompositionStringW(hIMC, GCS_CURSORPOS, nullptr, 0); } std::vector<BYTE> GetImeAttributes() { - const int attrLen = ::ImmGetCompositionStringW(hIMC, GCS_COMPATTR, NULL, 0); + const int attrLen = ::ImmGetCompositionStringW(hIMC, GCS_COMPATTR, nullptr, 0); std::vector<BYTE> attr(attrLen, 0); ::ImmGetCompositionStringW(hIMC, GCS_COMPATTR, &attr[0], static_cast<DWORD>(attr.size())); return attr; } std::wstring GetCompositionString(DWORD dwIndex) { - const LONG byteLen = ::ImmGetCompositionStringW(hIMC, dwIndex, NULL, 0); + const LONG byteLen = ::ImmGetCompositionStringW(hIMC, dwIndex, nullptr, 0); std::wstring wcs(byteLen / 2, 0); ::ImmGetCompositionStringW(hIMC, dwIndex, &wcs[0], byteLen); return wcs; @@ -1367,7 +1367,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam case SC_WIN_IDLE: // wParam=dwTickCountInitial, or 0 to initialize. lParam=bSkipUserInputTest if (idler.state) { - if (lParam || (WAIT_TIMEOUT == MsgWaitForMultipleObjects(0, 0, 0, 0, QS_INPUT|QS_HOTKEY))) { + if (lParam || (WAIT_TIMEOUT == MsgWaitForMultipleObjects(0, nullptr, 0, 0, QS_INPUT|QS_HOTKEY))) { if (Idle()) { // User input was given priority above, but all events do get a turn. Other // messages, notifications, etc. will get interleaved with the idle messages. @@ -1800,9 +1800,9 @@ bool ScintillaWin::FineTickerRunning(TickReason reason) { void ScintillaWin::FineTickerStart(TickReason reason, int millis, int tolerance) { FineTickerCancel(reason); if (SetCoalescableTimerFn && tolerance) { - timers[reason] = SetCoalescableTimerFn(MainHWND(), fineTimerStart + reason, millis, NULL, tolerance); + timers[reason] = SetCoalescableTimerFn(MainHWND(), fineTimerStart + reason, millis, nullptr, tolerance); } else { - timers[reason] = ::SetTimer(MainHWND(), fineTimerStart + reason, millis, NULL); + timers[reason] = ::SetTimer(MainHWND(), fineTimerStart + reason, millis, nullptr); } } @@ -1820,7 +1820,7 @@ bool ScintillaWin::SetIdle(bool on) { // and are only posted when the message queue is empty, i.e. during idle time. if (idler.state != on) { if (on) { - idler.idlerID = ::SetTimer(MainHWND(), idleTimerID, 10, NULL) + idler.idlerID = ::SetTimer(MainHWND(), idleTimerID, 10, nullptr) ? reinterpret_cast<IdlerID>(idleTimerID) : 0; } else { ::KillTimer(MainHWND(), reinterpret_cast<uptr_t>(idler.idlerID)); @@ -2386,7 +2386,7 @@ STDMETHODIMP FormatEnumerator_Next(FormatEnumerator *fe, ULONG celt, FORMATETC * unsigned int putPos = 0; while ((fe->pos < fe->formats.size()) && (putPos < celt)) { rgelt->cfFormat = fe->formats[fe->pos]; - rgelt->ptd = 0; + rgelt->ptd = nullptr; rgelt->dwAspect = DVASPECT_CONTENT; rgelt->lindex = -1; rgelt->tymed = TYMED_HGLOBAL; @@ -2494,7 +2494,7 @@ STDMETHODIMP DataObject_GetDataHere(DataObject *, FORMATETC *, STGMEDIUM *) { STDMETHODIMP DataObject_QueryGetData(DataObject *pd, FORMATETC *pFE) { if (pd->sci->DragIsRectangularOK(pFE->cfFormat) && - pFE->ptd == 0 && + pFE->ptd == nullptr && (pFE->dwAspect & DVASPECT_CONTENT) != 0 && pFE->lindex == -1 && (pFE->tymed & TYMED_HGLOBAL) != 0 @@ -2505,7 +2505,7 @@ STDMETHODIMP DataObject_QueryGetData(DataObject *pd, FORMATETC *pFE) { const bool formatOK = (pFE->cfFormat == CF_TEXT) || ((pFE->cfFormat == CF_UNICODETEXT) && pd->sci->IsUnicodeMode()); if (!formatOK || - pFE->ptd != 0 || + pFE->ptd != nullptr || (pFE->dwAspect & DVASPECT_CONTENT) == 0 || pFE->lindex != -1 || (pFE->tymed & TYMED_HGLOBAL) == 0 @@ -2524,7 +2524,7 @@ STDMETHODIMP DataObject_GetCanonicalFormatEtc(DataObject *pd, FORMATETC *, FORMA pFEOut->cfFormat = CF_UNICODETEXT; else pFEOut->cfFormat = CF_TEXT; - pFEOut->ptd = 0; + pFEOut->ptd = nullptr; pFEOut->dwAspect = DVASPECT_CONTENT; pFEOut->lindex = -1; pFEOut->tymed = TYMED_HGLOBAL; @@ -2540,7 +2540,7 @@ STDMETHODIMP DataObject_EnumFormatEtc(DataObject *pd, DWORD dwDirection, IEnumFO try { //Platform::DebugPrintf("DOB EnumFormatEtc %d\n", dwDirection); if (dwDirection != DATADIR_GET) { - *ppEnum = 0; + *ppEnum = nullptr; return E_FAIL; } FormatEnumerator *pfe; @@ -2756,7 +2756,7 @@ LRESULT ScintillaWin::ImeOnReconvert(LPARAM lParam) { if (!imc.hIMC) return 0; - if (!::ImmSetCompositionStringW(imc.hIMC, SCS_QUERYRECONVERTSTRING, rc, rcSize, NULL, 0)) + if (!::ImmSetCompositionStringW(imc.hIMC, SCS_QUERYRECONVERTSTRING, rc, rcSize, nullptr, 0)) return 0; // No selection asks IME to fill target fields with its own value. @@ -3101,7 +3101,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState, SetDragPosition(SelectionPosition(Sci::invalidPosition)); - STGMEDIUM medium = {0, {0}, 0}; + STGMEDIUM medium {}; std::vector<char> data; // Includes terminating NUL @@ -3176,7 +3176,7 @@ STDMETHODIMP ScintillaWin::GetData(FORMATETC *pFEIn, STGMEDIUM *pSTM) { const bool formatOK = (pFEIn->cfFormat == CF_TEXT) || ((pFEIn->cfFormat == CF_UNICODETEXT) && IsUnicodeMode()); if (!formatOK || - pFEIn->ptd != 0 || + pFEIn->ptd != nullptr || (pFEIn->dwAspect & DVASPECT_CONTENT) == 0 || pFEIn->lindex != -1 || (pFEIn->tymed & TYMED_HGLOBAL) == 0 @@ -3202,7 +3202,7 @@ STDMETHODIMP ScintillaWin::GetData(FORMATETC *pFEIn, STGMEDIUM *pSTM) { } } pSTM->hGlobal = text ? text.Unlock() : 0; - pSTM->pUnkForRelease = 0; + pSTM->pUnkForRelease = nullptr; return S_OK; } @@ -3212,37 +3212,26 @@ bool ScintillaWin::Register(HINSTANCE hInstance_) noexcept { // Register the Scintilla class // Register Scintilla as a wide character window - WNDCLASSEXW wndclass; + WNDCLASSEXW wndclass {}; wndclass.cbSize = sizeof(wndclass); wndclass.style = CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = ScintillaWin::SWndProc; - wndclass.cbClsExtra = 0; wndclass.cbWndExtra = sizeof(ScintillaWin *); wndclass.hInstance = hInstance; - wndclass.hIcon = NULL; - wndclass.hCursor = NULL; - wndclass.hbrBackground = NULL; - wndclass.lpszMenuName = NULL; wndclass.lpszClassName = L"Scintilla"; - wndclass.hIconSm = 0; scintillaClassAtom = ::RegisterClassExW(&wndclass); bool result = 0 != scintillaClassAtom; if (result) { // Register the CallTip class - WNDCLASSEX wndclassc; + WNDCLASSEX wndclassc {}; wndclassc.cbSize = sizeof(wndclassc); wndclassc.style = CS_GLOBALCLASS | CS_HREDRAW | CS_VREDRAW; - wndclassc.cbClsExtra = 0; wndclassc.cbWndExtra = sizeof(ScintillaWin *); wndclassc.hInstance = hInstance; - wndclassc.hIcon = NULL; - wndclassc.hbrBackground = NULL; - wndclassc.lpszMenuName = NULL; wndclassc.lpfnWndProc = ScintillaWin::CTWndProc; wndclassc.hCursor = ::LoadCursor(NULL, IDC_ARROW); wndclassc.lpszClassName = callClassName; - wndclassc.hIconSm = 0; callClassAtom = ::RegisterClassEx(&wndclassc); result = 0 != callClassAtom; |