diff options
| -rw-r--r-- | win32/PlatWin.cxx | 14 | ||||
| -rw-r--r-- | win32/ScintillaWin.cxx | 15 | 
2 files changed, 14 insertions, 15 deletions
| diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index a927372c2..c1d1f7cd1 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -353,9 +353,6 @@ FontCached::FontCached(const FontParameters &fp) :  		if (SUCCEEDED(hr)) {  			pTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); -			const int maxLines = 2; -			DWRITE_LINE_METRICS lineMetrics[maxLines]; -			UINT32 lineCount = 0;  			FLOAT yAscent = 1.0f;  			FLOAT yDescent = 1.0f;  			FLOAT yInternalLeading = 0.0f; @@ -363,6 +360,9 @@ FontCached::FontCached(const FontParameters &fp) :  			hr = pIDWriteFactory->CreateTextLayout(L"X", 1, pTextFormat,  					100.0f, 100.0f, &pTextLayout);  			if (SUCCEEDED(hr)) { +				const int maxLines = 2; +				DWRITE_LINE_METRICS lineMetrics[maxLines]{}; +				UINT32 lineCount = 0;  				hr = pTextLayout->GetLineMetrics(lineMetrics, maxLines, &lineCount);  				if (SUCCEEDED(hr)) {  					yAscent = lineMetrics[0].baseline; @@ -2040,7 +2040,7 @@ class ListBoxX : public ListBox {  	IListBoxDelegate *delegate;  	const char *widestItem;  	unsigned int maxCharWidth; -	int resizeHit; +	WPARAM resizeHit;  	PRectangle rcPreSize;  	Point dragOffset;  	Point location;	// Caret location at which the list is opened @@ -2449,7 +2449,7 @@ POINT ListBoxX::MaxTrackSize() const {  }  void ListBoxX::SetRedraw(bool on) { -	::SendMessage(lb, WM_SETREDRAW, static_cast<BOOL>(on), 0); +	::SendMessage(lb, WM_SETREDRAW, on, 0);  	if (on)  		::InvalidateRect(lb, NULL, TRUE);  } @@ -2540,7 +2540,7 @@ void ListBoxX::StartResize(WPARAM hitCode) {  	}  	::SetCapture(GetHWND()); -	resizeHit = static_cast<int>(hitCode); +	resizeHit = hitCode;  }  LRESULT ListBoxX::NcHitTest(WPARAM wParam, LPARAM lParam) const { @@ -2753,7 +2753,7 @@ LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam  	case WM_MEASUREITEM: {  			MEASUREITEMSTRUCT *pMeasureItem = reinterpret_cast<MEASUREITEMSTRUCT *>(lParam); -			pMeasureItem->itemHeight = static_cast<unsigned int>(ItemHeight()); +			pMeasureItem->itemHeight = ItemHeight();  		}  		break; diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index a0bd5430f..0b08e0f55 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -522,8 +522,8 @@ void ScintillaWin::EnsureRenderTarget(HDC hdc) {  		renderTargetValid = true;  	}  	if (pD2DFactory && !pRenderTarget) { -		RECT rc;  		HWND hw = MainHWND(); +		RECT rc;  		GetClientRect(hw, &rc);  		D2D1_SIZE_U size = D2D1::SizeU(rc.right - rc.left, rc.bottom - rc.top); @@ -790,8 +790,8 @@ Sci::Position ScintillaWin::EncodedFromUTF8(const char *utf8, char *encoded) con  // the current codepage. Code is similar to HandleCompositionWindowed().  void ScintillaWin::AddCharUTF16(wchar_t const *wcs, unsigned int wclen) {  	if (IsUnicodeMode()) { -		char utfval[maxLenInputIME * 3];  		size_t len = UTF8Length(wcs, wclen); +		char utfval[maxLenInputIME * 3];  		UTF8FromUTF16(wcs, wclen, utfval, len);  		utfval[len] = '\0';  		AddCharUTF(utfval, static_cast<unsigned int>(len)); @@ -1676,7 +1676,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam  				if (lParam == 0) {  					return 0;  				} -				Sci_CharacterRange *pCR = reinterpret_cast<Sci_CharacterRange *>(lParam); +				const Sci_CharacterRange *pCR = reinterpret_cast<const Sci_CharacterRange *>(lParam);  				sel.selType = Selection::selStream;  				if (pCR->cpMin == 0 && pCR->cpMax == -1) {  					SetSelection(pCR->cpMin, pdoc->Length()); @@ -2232,7 +2232,7 @@ void ScintillaWin::Paste() {  	// Always use CF_UNICODETEXT if available  	GlobalMemory memUSelection(::GetClipboardData(CF_UNICODETEXT));  	if (memUSelection) { -		wchar_t *uptr = static_cast<wchar_t *>(memUSelection.ptr); +		const wchar_t *uptr = static_cast<const wchar_t *>(memUSelection.ptr);  		if (uptr) {  			size_t len;  			std::vector<char> putf; @@ -2260,7 +2260,7 @@ void ScintillaWin::Paste() {  		// CF_UNICODETEXT not available, paste ANSI text  		GlobalMemory memSelection(::GetClipboardData(CF_TEXT));  		if (memSelection) { -			char *ptr = static_cast<char *>(memSelection.ptr); +			const char *ptr = static_cast<char *>(memSelection.ptr);  			if (ptr) {  				const size_t bytes = memSelection.Size();  				size_t len = bytes; @@ -3069,7 +3069,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState,  		HRESULT hr = pIDataSource->GetData(&fmtu, &medium);  		if (SUCCEEDED(hr) && medium.hGlobal) {  			GlobalMemory memUDrop(medium.hGlobal); -			wchar_t *udata = static_cast<wchar_t *>(memUDrop.ptr); +			const wchar_t *udata = static_cast<wchar_t *>(memUDrop.ptr);  			if (udata) {  				if (IsUnicodeMode()) {  					const size_t tlen = memUDrop.Size(); @@ -3169,7 +3169,6 @@ STDMETHODIMP ScintillaWin::GetData(FORMATETC *pFEIn, STGMEDIUM *pSTM) {  bool ScintillaWin::Register(HINSTANCE hInstance_) {  	hInstance = hInstance_; -	bool result;  	// Register the Scintilla class  	// Register Scintilla as a wide character window @@ -3187,7 +3186,7 @@ bool ScintillaWin::Register(HINSTANCE hInstance_) {  	wndclass.lpszClassName = L"Scintilla";  	wndclass.hIconSm = 0;  	scintillaClassAtom = ::RegisterClassExW(&wndclass); -	result = 0 != scintillaClassAtom; +	bool result = 0 != scintillaClassAtom;  	if (result) {  		// Register the CallTip class | 
