diff options
Diffstat (limited to 'win32')
| -rw-r--r-- | win32/HanjaDic.cxx | 2 | ||||
| -rw-r--r-- | win32/PlatWin.cxx | 94 | ||||
| -rw-r--r-- | win32/ScintillaWin.cxx | 78 | 
3 files changed, 87 insertions, 87 deletions
| diff --git a/win32/HanjaDic.cxx b/win32/HanjaDic.cxx index ef8cf2bb5..d9640be7e 100644 --- a/win32/HanjaDic.cxx +++ b/win32/HanjaDic.cxx @@ -112,7 +112,7 @@ int GetHangulOfHanja(wchar_t *inout) {  			if (dict.IsHanja(static_cast<int>(inout[i]))) { // Pass hanja only!  				conv[0] = inout[i];  				BSTR bstrHanja = SysAllocString(conv); -				HRESULT hr = dict.HJinterface->HanjaToHangul(bstrHanja, &bstrHangul); +				const HRESULT hr = dict.HJinterface->HanjaToHangul(bstrHanja, &bstrHangul);  				if (SUCCEEDED(hr)) {  					inout[i] = static_cast<wchar_t>(bstrHangul[0]);  					changed += 1; diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 0bca24854..c93a058c7 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -129,7 +129,7 @@ bool LoadD2D() {  		}  		if (pIDWriteFactory) { -			HRESULT hr = pIDWriteFactory->CreateRenderingParams(&defaultRenderingParams); +			const HRESULT hr = pIDWriteFactory->CreateRenderingParams(&defaultRenderingParams);  			if (SUCCEEDED(hr)) {  				unsigned int clearTypeContrast;  				if (::SystemParametersInfo(SPI_GETFONTSMOOTHINGCONTRAST, 0, &clearTypeContrast, 0)) { @@ -212,7 +212,7 @@ HFONT FormatAndMetrics::HFont() {  			return 0;  		}  	} else { -		HRESULT hr = pTextFormat->GetFontFamilyName(lf.lfFaceName, LF_FACESIZE); +		const HRESULT hr = pTextFormat->GetFontFamilyName(lf.lfFaceName, LF_FACESIZE);  		if (!SUCCEEDED(hr)) {  			return 0;  		} @@ -393,7 +393,7 @@ void FontCached::Release() {  FontID FontCached::FindOrCreate(const FontParameters &fp) {  	FontID ret = 0;  	::EnterCriticalSection(&crPlatformLock); -	int hashFind = HashFont(fp); +	const int hashFind = HashFont(fp);  	for (FontCached *cur=first; cur; cur=cur->next) {  		if ((cur->hash == hashFind) &&  			cur->SameAs(fp)) { @@ -843,7 +843,7 @@ void SurfaceGDI::DrawRGBAImage(PRectangle rc, int width, int height, const unsig  			for (int y=height-1; y>=0; y--) {  				for (int x=0; x<width; x++) {  					unsigned char *pixel = image + (y*width+x) * 4; -					unsigned char alpha = pixelsImage[3]; +					const unsigned char alpha = pixelsImage[3];  					// Input is RGBA, output is BGRA with premultiplied alpha  					pixel[2] = static_cast<unsigned char>((*pixelsImage++) * alpha / 255);  					pixel[1] = static_cast<unsigned char>((*pixelsImage++) * alpha / 255); @@ -952,7 +952,7 @@ void SurfaceGDI::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *  		}  		// Map the widths given for UTF-16 characters back onto the UTF-8 input string  		for (int ui = 0; ui < fit; ui++) { -			unsigned int lenChar = UTF8BytesOfLead[static_cast<unsigned char>(s[i])]; +			const unsigned int lenChar = UTF8BytesOfLead[static_cast<unsigned char>(s[i])];  			if (lenChar == 4) {	// Non-BMP  				ui++;  			} @@ -1211,7 +1211,7 @@ void SurfaceD2D::InitPixMap(int width, int height, Surface *surface_, WindowID)  	desiredFormat = psurfOther->pRenderTarget->GetPixelFormat();  #endif  	desiredFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE; -	HRESULT hr = psurfOther->pRenderTarget->CreateCompatibleRenderTarget( +	const HRESULT hr = psurfOther->pRenderTarget->CreateCompatibleRenderTarget(  		&desiredSize, NULL, &desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, &pCompatibleRenderTarget);  	if (SUCCEEDED(hr)) {  		pRenderTarget = pCompatibleRenderTarget; @@ -1236,7 +1236,7 @@ void SurfaceD2D::D2DPenColour(ColourDesired fore, int alpha) {  		if (pBrush) {  			pBrush->SetColor(col);  		} else { -			HRESULT hr = pRenderTarget->CreateSolidColorBrush(col, &pBrush); +			const HRESULT hr = pRenderTarget->CreateSolidColorBrush(col, &pBrush);  			if (!SUCCEEDED(hr) && pBrush) {  				pBrush->Release();  				pBrush = 0; @@ -1297,18 +1297,18 @@ static float RoundFloat(float f) {  void SurfaceD2D::LineTo(int x_, int y_) {  	if (pRenderTarget) { -		int xDiff = x_ - x; -		int xDelta = Delta(xDiff); -		int yDiff = y_ - y; -		int yDelta = Delta(yDiff); +		const int xDiff = x_ - x; +		const int xDelta = Delta(xDiff); +		const int yDiff = y_ - y; +		const int yDelta = Delta(yDiff);  		if ((xDiff == 0) || (yDiff == 0)) {  			// Horizontal or vertical lines can be more precisely drawn as a filled rectangle -			int xEnd = x_ - xDelta; -			int left = Platform::Minimum(x, xEnd); -			int width = abs(x - xEnd) + 1; -			int yEnd = y_ - yDelta; -			int top = Platform::Minimum(y, yEnd); -			int height = abs(y - yEnd) + 1; +			const int xEnd = x_ - xDelta; +			const int left = Platform::Minimum(x, xEnd); +			const int width = abs(x - xEnd) + 1; +			const int yEnd = y_ - yDelta; +			const int top = Platform::Minimum(y, yEnd); +			const int height = abs(y - yEnd) + 1;  			D2D1_RECT_F rectangle1 = D2D1::RectF(static_cast<float>(left), static_cast<float>(top),  				static_cast<float>(left+width), static_cast<float>(top+height));  			pRenderTarget->FillRectangle(&rectangle1, pBrush); @@ -1455,7 +1455,7 @@ void SurfaceD2D::DrawRGBAImage(PRectangle rc, int width, int height, const unsig  		for (int yPixel=0; yPixel<height; yPixel++) {  			for (int xPixel = 0; xPixel<width; xPixel++) {  				unsigned char *pixel = &image[0] + (yPixel*width + xPixel) * 4; -				unsigned char alpha = pixelsImage[3]; +				const unsigned char alpha = pixelsImage[3];  				// Input is RGBA, output is BGRA with premultiplied alpha  				pixel[2] = (*pixelsImage++) * alpha / 255;  				pixel[1] = (*pixelsImage++) * alpha / 255; @@ -1468,7 +1468,7 @@ void SurfaceD2D::DrawRGBAImage(PRectangle rc, int width, int height, const unsig  		D2D1_SIZE_U size = D2D1::SizeU(width, height);  		D2D1_BITMAP_PROPERTIES props = {{DXGI_FORMAT_B8G8R8A8_UNORM,  		    D2D1_ALPHA_MODE_PREMULTIPLIED}, 72.0, 72.0}; -		HRESULT hr = pRenderTarget->CreateBitmap(size, &image[0], +		const HRESULT hr = pRenderTarget->CreateBitmap(size, &image[0],                    width * 4, &props, &bitmap);  		if (SUCCEEDED(hr)) {  			D2D1_RECT_F rcDestination = {rc.left, rc.top, rc.right, rc.bottom}; @@ -1525,7 +1525,7 @@ void SurfaceD2D::DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, co  		// Explicitly creating a text layout appears a little faster  		IDWriteTextLayout *pTextLayout; -		HRESULT hr = pIDWriteFactory->CreateTextLayout(tbuf.buffer, tbuf.tlen, pTextFormat, +		const HRESULT hr = pIDWriteFactory->CreateTextLayout(tbuf.buffer, tbuf.tlen, pTextFormat,  				rc.Width(), rc.Height(), &pTextLayout);  		if (SUCCEEDED(hr)) {  			D2D1_POINT_2F origin = {rc.left, ybase-yAscent}; @@ -1578,7 +1578,7 @@ XYPOSITION SurfaceD2D::WidthText(Font &font_, const char *s, int len) {  	if (pIDWriteFactory && pTextFormat) {  		// Create a layout  		IDWriteTextLayout *pTextLayout = 0; -		HRESULT hr = pIDWriteFactory->CreateTextLayout(tbuf.buffer, tbuf.tlen, pTextFormat, 1000.0, 1000.0, &pTextLayout); +		const HRESULT hr = pIDWriteFactory->CreateTextLayout(tbuf.buffer, tbuf.tlen, pTextFormat, 1000.0, 1000.0, &pTextLayout);  		if (SUCCEEDED(hr)) {  			DWRITE_TEXT_METRICS textMetrics;  			if (SUCCEEDED(pTextLayout->GetMetrics(&textMetrics))) @@ -1602,7 +1602,7 @@ void SurfaceD2D::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *  		SetFont(font_);  		// Create a layout  		IDWriteTextLayout *pTextLayout = 0; -		HRESULT hr = pIDWriteFactory->CreateTextLayout(tbuf.buffer, tbuf.tlen, pTextFormat, 10000.0, 1000.0, &pTextLayout); +		const HRESULT hr = pIDWriteFactory->CreateTextLayout(tbuf.buffer, tbuf.tlen, pTextFormat, 10000.0, 1000.0, &pTextLayout);  		if (!SUCCEEDED(hr))  			return;  		if (!SUCCEEDED(pTextLayout->GetClusterMetrics(clusterMetrics, clusters, &count))) @@ -1625,7 +1625,7 @@ void SurfaceD2D::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *  		const unsigned char *us = reinterpret_cast<const unsigned char *>(s);  		int i=0;  		while (ui<fit) { -			unsigned char uch = us[i]; +			const unsigned char uch = us[i];  			unsigned int lenChar = 1;  			if (uch >= (0x80 + 0x40 + 0x20 + 0x10)) {  				lenChar = 4; @@ -1683,7 +1683,7 @@ XYPOSITION SurfaceD2D::WidthChar(Font &font_, char ch) {  		// Create a layout  		IDWriteTextLayout *pTextLayout = 0;  		const WCHAR wch = ch; -		HRESULT hr = pIDWriteFactory->CreateTextLayout(&wch, 1, pTextFormat, 1000.0, 1000.0, &pTextLayout); +		const HRESULT hr = pIDWriteFactory->CreateTextLayout(&wch, 1, pTextFormat, 1000.0, 1000.0, &pTextLayout);  		if (SUCCEEDED(hr)) {  			DWRITE_TEXT_METRICS textMetrics;  			if (SUCCEEDED(pTextLayout->GetMetrics(&textMetrics))) @@ -1726,7 +1726,7 @@ XYPOSITION SurfaceD2D::AverageCharWidth(Font &font_) {  		IDWriteTextLayout *pTextLayout = 0;  		const WCHAR wszAllAlpha[] = L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";  		const size_t lenAllAlpha = wcslen(wszAllAlpha); -		HRESULT hr = pIDWriteFactory->CreateTextLayout(wszAllAlpha, static_cast<UINT32>(lenAllAlpha), +		const HRESULT hr = pIDWriteFactory->CreateTextLayout(wszAllAlpha, static_cast<UINT32>(lenAllAlpha),  			pTextFormat, 1000.0, 1000.0, &pTextLayout);  		if (SUCCEEDED(hr)) {  			DWRITE_TEXT_METRICS textMetrics; @@ -1812,7 +1812,7 @@ static RECT RectFromMonitor(HMONITOR hMonitor) {  }  void Window::SetPositionRelative(PRectangle rc, Window w) { -	LONG style = ::GetWindowLong(static_cast<HWND>(wid), GWL_STYLE); +	const LONG style = ::GetWindowLong(static_cast<HWND>(wid), GWL_STYLE);  	if (style & WS_POPUP) {  		POINT ptOther = {0, 0};  		::ClientToScreen(static_cast<HWND>(w.GetID()), &ptOther); @@ -2194,7 +2194,7 @@ PRectangle ListBoxX::GetDesiredRect() {  	SelectFont(hdc, oldFont);  	::ReleaseDC(lb, hdc); -	int widthDesired = Platform::Maximum(textSize.cx, (len + 1) * tm.tmAveCharWidth); +	const int widthDesired = Platform::Maximum(textSize.cx, (len + 1) * tm.tmAveCharWidth);  	if (width < widthDesired)  		width = widthDesired; @@ -2253,7 +2253,7 @@ int ListBoxX::Find(const char *) {  }  void ListBoxX::GetValue(int n, char *value, int len) { -	ListItemData item = lti.Get(n); +	const ListItemData item = lti.Get(n);  	strncpy(value, item.text, len);  	value[len-1] = '\0';  } @@ -2289,7 +2289,7 @@ void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) {  			::SetTextColor(pDrawItem->hDC, ::GetSysColor(COLOR_WINDOWTEXT));  		} -		ListItemData item = lti.Get(pDrawItem->itemID); +		const ListItemData item = lti.Get(pDrawItem->itemID);  		int pixId = item.pixId;  		const char *text = item.text;  		int len = static_cast<int>(strlen(text)); @@ -2305,13 +2305,13 @@ void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) {  		}  		// Draw the image, if any -		RGBAImage *pimage = images.Get(pixId); +		const RGBAImage *pimage = images.Get(pixId);  		if (pimage) {  			Surface *surfaceItem = Surface::Allocate(technology);  			if (surfaceItem) {  				if (technology == SCWIN_TECH_GDI) {  					surfaceItem->Init(pDrawItem->hDC, pDrawItem->hwndItem); -					long left = pDrawItem->rcItem.left + static_cast<int>(ItemInset.x + ImageInset.x); +					const long left = pDrawItem->rcItem.left + static_cast<int>(ItemInset.x + ImageInset.x);  					PRectangle rcImage = PRectangle::FromInts(left, pDrawItem->rcItem.top,  						left + images.GetWidth(), pDrawItem->rcItem.bottom);  					surfaceItem->DrawRGBAImage(rcImage, @@ -2339,7 +2339,7 @@ void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) {  						if (SUCCEEDED(hr)) {  							surfaceItem->Init(pDCRT, pDrawItem->hwndItem);  							pDCRT->BeginDraw(); -							long left = pDrawItem->rcItem.left + static_cast<long>(ItemInset.x + ImageInset.x); +							const long left = pDrawItem->rcItem.left + static_cast<long>(ItemInset.x + ImageInset.x);  							PRectangle rcImage = PRectangle::FromInts(left, pDrawItem->rcItem.top,  								left + images.GetWidth(), pDrawItem->rcItem.bottom);  							surfaceItem->DrawRGBAImage(rcImage, @@ -2371,7 +2371,7 @@ void ListBoxX::AppendListItem(const char *text, const char *numword) {  	}  	lti.AllocItem(text, pixId); -	unsigned int len = static_cast<unsigned int>(strlen(text)); +	const unsigned int len = static_cast<unsigned int>(strlen(text));  	if (maxItemCharacters < len) {  		maxItemCharacters = len;  		widestItem = text; @@ -2383,7 +2383,7 @@ void ListBoxX::SetList(const char *list, char separator, char typesep) {  	// the listbox is not visible.  	SetRedraw(false);  	Clear(); -	size_t size = strlen(list); +	const size_t size = strlen(list);  	char *words = lti.SetWords(list);  	char *startword = words;  	char *numword = NULL; @@ -2422,7 +2422,7 @@ void ListBoxX::AdjustWindowRect(PRectangle *rc) {  int ListBoxX::ItemHeight() const {  	int itemHeight = lineHeight + (static_cast<int>(TextInset.y) * 2); -	int pixHeight = images.GetHeight() + (static_cast<int>(ImageInset.y) * 2); +	const int pixHeight = images.GetHeight() + (static_cast<int>(ImageInset.y) * 2);  	if (itemHeight < pixHeight) {  		itemHeight = pixHeight;  	} @@ -2570,8 +2570,8 @@ LRESULT ListBoxX::NcHitTest(WPARAM wParam, LPARAM lParam) const {  	// window caption height + frame, even if one is hovering over the bottom edge of  	// the frame, so workaround that here  	if (hit >= HTTOP && hit <= HTTOPRIGHT) { -		int minHeight = GetSystemMetrics(SM_CYMINTRACK); -		int yPos = GET_Y_LPARAM(lParam); +		const int minHeight = GetSystemMetrics(SM_CYMINTRACK); +		const int yPos = GET_Y_LPARAM(lParam);  		if ((rc.Height() < minHeight) && (yPos > ((rc.top + rc.bottom)/2))) {  			hit += HTBOTTOM - HTTOP;  		} @@ -2625,10 +2625,10 @@ POINT ListBoxX::GetClientExtent() const {  void ListBoxX::CentreItem(int n) {  	// If below mid point, scroll up to centre, but with more items below if uneven  	if (n >= 0) { -		POINT extent = GetClientExtent(); -		int visible = extent.y/ItemHeight(); +		const POINT extent = GetClientExtent(); +		const int visible = extent.y/ItemHeight();  		if (visible < Length()) { -			LRESULT top = ::SendMessage(lb, LB_GETTOPINDEX, 0, 0); +			const LRESULT top = ::SendMessage(lb, LB_GETTOPINDEX, 0, 0);  			int half = (visible - 1) / 2;  			if (n > (top + half))  				::SendMessage(lb, LB_SETTOPINDEX, n - half , 0); @@ -2680,7 +2680,7 @@ LRESULT PASCAL ListBoxX::ControlWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA  		case WM_LBUTTONDOWN: {  				// We must take control of selection to prevent the ListBox activating  				// the popup -				LRESULT lResult = ::SendMessage(hWnd, LB_ITEMFROMPOINT, 0, lParam); +				const LRESULT lResult = ::SendMessage(hWnd, LB_ITEMFROMPOINT, 0, lParam);  				int item = LOWORD(lResult);  				if (HIWORD(lResult) == 0 && item >= 0) {  					::SendMessage(hWnd, LB_SETCURSEL, item, 0); @@ -2816,7 +2816,7 @@ LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam  	case WM_MOUSEWHEEL:  		wheelDelta -= static_cast<short>(HIWORD(wParam));  		if (abs(wheelDelta) >= WHEEL_DELTA) { -			int nRows = GetVisibleRows(); +			const int nRows = GetVisibleRows();  			int linesToScroll = 1;  			if (nRows > 1) {  				linesToScroll = nRows - 1; @@ -2939,12 +2939,12 @@ double ElapsedTime::Duration(bool reset) {  		LARGE_INTEGER lBegin;  		lBegin.HighPart = bigBit;  		lBegin.LowPart = littleBit; -		double elapsed = static_cast<double>(lEnd.QuadPart - lBegin.QuadPart); +		const double elapsed = static_cast<double>(lEnd.QuadPart - lBegin.QuadPart);  		result = elapsed / static_cast<double>(frequency.QuadPart);  	} else {  		endBigBit = clock();  		endLittleBit = 0; -		double elapsed = endBigBit - bigBit; +		const double elapsed = endBigBit - bigBit;  		result = elapsed / CLOCKS_PER_SEC;  	}  	if (reset) { @@ -3036,7 +3036,7 @@ long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long  bool Platform::IsDBCSLeadByte(int codePage, char ch) {  	// Byte ranges found in Wikipedia articles with relevant search strings in each case -	unsigned char uch = static_cast<unsigned char>(ch); +	const unsigned char uch = static_cast<unsigned char>(ch);  	switch (codePage) {  	case 932:  		// Shift_jis @@ -3109,7 +3109,7 @@ void Platform::DebugPrintf(const char *, ...) {  static bool assertionPopUps = true;  bool Platform::ShowAssertionPopUps(bool assertionPopUps_) { -	bool ret = assertionPopUps; +	const bool ret = assertionPopUps;  	assertionPopUps = assertionPopUps_;  	return ret;  } @@ -3118,7 +3118,7 @@ void Platform::Assert(const char *c, const char *file, int line) {  	char buffer[2000];  	sprintf(buffer, "Assertion [%s] failed at %s %d%s", c, file, line, assertionPopUps ? "" : "\r\n");  	if (assertionPopUps) { -		int idButton = ::MessageBoxA(0, buffer, "Assertion failure", +		const int idButton = ::MessageBoxA(0, buffer, "Assertion failure",  			MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL);  		if (idButton == IDRETRY) {  			::DebugBreak(); diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 8a817dde3..f5e1f07d6 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -594,8 +594,8 @@ HWND ScintillaWin::MainHWND() {  }  bool ScintillaWin::DragThreshold(Point ptStart, Point ptNow) { -	int xMove = static_cast<int>(std::abs(ptStart.x - ptNow.x)); -	int yMove = static_cast<int>(std::abs(ptStart.y - ptNow.y)); +	const int xMove = static_cast<int>(std::abs(ptStart.x - ptNow.x)); +	const int yMove = static_cast<int>(std::abs(ptStart.y - ptNow.y));  	return (xMove > ::GetSystemMetrics(SM_CXDRAG)) ||  		(yMove > ::GetSystemMetrics(SM_CYDRAG));  } @@ -607,7 +607,7 @@ void ScintillaWin::StartDrag() {  	IDataObject *pDataObject = reinterpret_cast<IDataObject *>(&dob);  	IDropSource *pDropSource = reinterpret_cast<IDropSource *>(&ds);  	//Platform::DebugPrintf("About to DoDragDrop %x %x\n", pDataObject, pDropSource); -	HRESULT hr = ::DoDragDrop( +	const HRESULT hr = ::DoDragDrop(  	                 pDataObject,  	                 pDropSource,  	                 DROPEFFECT_COPY | DROPEFFECT_MOVE, &dwEffect); @@ -635,7 +635,7 @@ static int InputCodePage() {  	HKL inputLocale = ::GetKeyboardLayout(0);  	LANGID inputLang = LOWORD(inputLocale);  	char sCodePage[10]; -	int res = ::GetLocaleInfoA(MAKELCID(inputLang, SORT_DEFAULT), +	const int res = ::GetLocaleInfoA(MAKELCID(inputLang, SORT_DEFAULT),  	  LOCALE_IDEFAULTANSICODEPAGE, sCodePage, sizeof(sCodePage));  	if (!res)  		return 0; @@ -687,7 +687,7 @@ static bool BoundsContains(PRectangle rcBounds, HRGN hRgnBounds, PRectangle rcCh  			if (hRgnCheck) {  				HRGN hRgnDifference = ::CreateRectRgn(0, 0, 0, 0);  				if (hRgnDifference) { -					int combination = ::CombineRgn(hRgnDifference, hRgnCheck, hRgnBounds, RGN_DIFF); +					const int combination = ::CombineRgn(hRgnDifference, hRgnCheck, hRgnBounds, RGN_DIFF);  					if (combination != NULLREGION) {  						contains = false;  					} @@ -788,7 +788,7 @@ void ScintillaWin::AddCharUTF16(wchar_t const *wcs, unsigned int wclen) {  	} else {  		UINT cpDest = CodePageOfDocument();  		char inBufferCP[maxLenInputIME * 2]; -		int size = ::WideCharToMultiByte(cpDest, +		const int size = ::WideCharToMultiByte(cpDest,  			0, wcs, wclen, inBufferCP, sizeof(inBufferCP) - 1, 0, 0);  		for (int i=0; i<size; i++) {  			AddChar(inBufferCP[i]); @@ -800,12 +800,12 @@ sptr_t ScintillaWin::WndPaint(uptr_t wParam) {  	//ElapsedTime et;  	// Redirect assertions to debug output and save current state -	bool assertsPopup = Platform::ShowAssertionPopUps(false); +	const bool assertsPopup = Platform::ShowAssertionPopUps(false);  	paintState = painting;  	PAINTSTRUCT ps;  	PAINTSTRUCT *pps; -	bool IsOcxCtrl = (wParam != 0); // if wParam != 0, it contains +	const bool IsOcxCtrl = (wParam != 0); // if wParam != 0, it contains  								   // a PAINSTRUCT* from the OCX  	// Removed since this interferes with reporting other assertions as it occurs repeatedly  	//PLATFORM_ASSERT(hRgnUpdate == NULL); @@ -818,7 +818,7 @@ sptr_t ScintillaWin::WndPaint(uptr_t wParam) {  		::BeginPaint(MainHWND(), pps);  	}  	rcPaint = PRectangle::FromInts(pps->rcPaint.left, pps->rcPaint.top, pps->rcPaint.right, pps->rcPaint.bottom); -	PRectangle rcClient = GetClientRectangle(); +	const PRectangle rcClient = GetClientRectangle();  	paintingAllText = BoundsContains(rcPaint, hRgnUpdate, rcClient);  	if (technology == SC_TECHNOLOGY_DEFAULT) {  		AutoSurface surfaceWindow(pps->hdc, this); @@ -834,7 +834,7 @@ sptr_t ScintillaWin::WndPaint(uptr_t wParam) {  			pRenderTarget->BeginDraw();  			Paint(surfaceWindow, rcPaint);  			surfaceWindow->Release(); -			HRESULT hr = pRenderTarget->EndDraw(); +			const HRESULT hr = pRenderTarget->EndDraw();  			if (hr == static_cast<HRESULT>(D2DERR_RECREATE_TARGET)) {  				DropRenderTarget();  				paintState = paintAbandoned; @@ -939,7 +939,7 @@ void ScintillaWin::SelectionToHangul() {  		pdoc->GetCharRange(&documentStr[0], selStart, documentStrLen);  		std::wstring uniStr = StringDecode(documentStr, CodePageOfDocument()); -		int converted = HanjaDict::GetHangulOfHanja(&uniStr[0]); +		const int converted = HanjaDict::GetHangulOfHanja(&uniStr[0]);  		documentStr = StringEncode(uniStr, CodePageOfDocument());  		if (converted > 0) { @@ -1028,7 +1028,7 @@ void ScintillaWin::AddWString(std::wstring wcs) {  	if (wcs.empty())  		return; -	int codePage = CodePageOfDocument(); +	const int codePage = CodePageOfDocument();  	for (size_t i = 0; i < wcs.size(); ) {  		const size_t ucWidth = UTF16CharLength(wcs[i]);  		const std::wstring uniChar(wcs, i, ucWidth); @@ -1075,9 +1075,9 @@ sptr_t ScintillaWin::HandleCompositionInline(uptr_t, sptr_t lParam) {  		std::vector<int> imeIndicator = MapImeIndicators(imc.GetImeAttributes()); -		bool tmpRecordingMacro = recordingMacro; +		const bool tmpRecordingMacro = recordingMacro;  		recordingMacro = false; -		int codePage = CodePageOfDocument(); +		const int codePage = CodePageOfDocument();  		for (size_t i = 0; i < wcs.size(); ) {  			const size_t ucWidth = UTF16CharLength(wcs[i]);  			const std::wstring uniChar(wcs, i, ucWidth); @@ -1091,7 +1091,7 @@ sptr_t ScintillaWin::HandleCompositionInline(uptr_t, sptr_t lParam) {  		recordingMacro = tmpRecordingMacro;  		// Move IME caret from current last position to imeCaretPos. -		int imeEndToImeCaretU16 = imc.GetImeCaretPos() - static_cast<unsigned int>(wcs.size()); +		const int imeEndToImeCaretU16 = imc.GetImeCaretPos() - static_cast<unsigned int>(wcs.size());  		Sci::Position imeCaretPosDoc = pdoc->GetRelativePositionUTF16(CurrentPosition(), imeEndToImeCaretU16);  		MoveImeCarets(- CurrentPosition() + imeCaretPosDoc); @@ -1352,8 +1352,8 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam  #ifdef _MSC_VER  #pragma warning(suppress: 28159)  #endif -						DWORD dwCurrent = GetTickCount(); -						DWORD dwStart = wParam ? static_cast<DWORD>(wParam) : dwCurrent; +						const DWORD dwCurrent = GetTickCount(); +						const DWORD dwStart = wParam ? static_cast<DWORD>(wParam) : dwCurrent;  						const DWORD maxWorkTime = 50;  						if (dwCurrent >= dwStart && dwCurrent > maxWorkTime && dwCurrent - maxWorkTime < dwStart) @@ -1484,7 +1484,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam  		case WM_KEYDOWN: {  			//Platform::DebugPrintf("S keydown %d %x %x %x %x\n",iMessage, wParam, lParam, ::IsKeyDown(VK_SHIFT), ::IsKeyDown(VK_CONTROL));  				lastKeyDownConsumed = false; -				int ret = KeyDown(KeyTranslate(static_cast<int>(wParam)), +				const int ret = KeyDown(KeyTranslate(static_cast<int>(wParam)),  					Platform::IsKeyDown(VK_SHIFT),  					Platform::IsKeyDown(VK_CONTROL),  					Platform::IsKeyDown(VK_MENU), @@ -1526,7 +1526,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam  		case WM_KILLFOCUS: {  				HWND wOther = reinterpret_cast<HWND>(wParam);  				HWND wThis = MainHWND(); -				HWND wCT = static_cast<HWND>(ct.wCallTip.GetID()); +				const HWND wCT = static_cast<HWND>(ct.wCallTip.GetID());  				if (!wParam ||  					!(::IsChild(wThis, wOther) || (wOther == wCT))) {  					SetFocusState(false); @@ -1929,7 +1929,7 @@ bool ScintillaWin::ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) {  		modified = true;  	} -	PRectangle rcText = GetTextRectangle(); +	const PRectangle rcText = GetTextRectangle();  	int horizEndPreferred = scrollWidth;  	if (horizEndPreferred < 0)  		horizEndPreferred = 0; @@ -2013,7 +2013,7 @@ public:  			if (lenMixed > utf16Mixed.size()) {  				utf16Mixed.resize(lenMixed + 8);  			} -			size_t nUtf16Mixed = ::MultiByteToWideChar(cp, 0, mixed, +			const size_t nUtf16Mixed = ::MultiByteToWideChar(cp, 0, mixed,  				static_cast<int>(lenMixed),  				&utf16Mixed[0],  				static_cast<int>(utf16Mixed.size())); @@ -2032,7 +2032,7 @@ public:  				if (foldedUTF8) {  					// Maximum length of a case conversion is 6 bytes, 3 characters  					wchar_t wFolded[20]; -					size_t charsConverted = UTF16FromUTF8(foldedUTF8, +					const size_t charsConverted = UTF16FromUTF8(foldedUTF8,  							strlen(foldedUTF8),  							wFolded, ELEMENTS(wFolded));  					for (size_t j=0; j<charsConverted; j++) @@ -2072,18 +2072,18 @@ CaseFolder *ScintillaWin::CaseFolderForEncoding() {  				char sCharacter[2] = "A";  				sCharacter[0] = static_cast<char>(i);  				wchar_t wCharacter[20]; -				unsigned int lengthUTF16 = ::MultiByteToWideChar(cpDoc, 0, sCharacter, 1, +				const unsigned int lengthUTF16 = ::MultiByteToWideChar(cpDoc, 0, sCharacter, 1,  					wCharacter, ELEMENTS(wCharacter));  				if (lengthUTF16 == 1) {  					const char *caseFolded = CaseConvert(wCharacter[0], CaseConversionFold);  					if (caseFolded) {  						wchar_t wLower[20]; -						size_t charsConverted = UTF16FromUTF8(caseFolded, +						const size_t charsConverted = UTF16FromUTF8(caseFolded,  							strlen(caseFolded),  							wLower, ELEMENTS(wLower));  						if (charsConverted == 1) {  							char sCharacterLowered[20]; -							unsigned int lengthConverted = ::WideCharToMultiByte(cpDoc, 0, +							const unsigned int lengthConverted = ::WideCharToMultiByte(cpDoc, 0,  								wLower, static_cast<int>(charsConverted),  								sCharacterLowered, ELEMENTS(sCharacterLowered), NULL, 0);  							if ((lengthConverted == 1) && (sCharacter[0] != sCharacterLowered[0])) { @@ -2234,7 +2234,7 @@ void ScintillaWin::Paste() {  			std::vector<char> putf;  			// Default Scintilla behaviour in Unicode mode  			if (IsUnicodeMode()) { -				unsigned int bytes = static_cast<unsigned int>(memUSelection.Size()); +				const unsigned int bytes = static_cast<unsigned int>(memUSelection.Size());  				len = UTF8Length(uptr, bytes / 2);  				putf.resize(len + 1);  				UTF8FromUTF16(uptr, bytes / 2, &putf[0], len); @@ -2258,7 +2258,7 @@ void ScintillaWin::Paste() {  		if (memSelection) {  			char *ptr = static_cast<char *>(memSelection.ptr);  			if (ptr) { -				unsigned int bytes = static_cast<unsigned int>(memSelection.Size()); +				const unsigned int bytes = static_cast<unsigned int>(memSelection.Size());  				unsigned int len = bytes;  				for (unsigned int i = 0; i < bytes; i++) {  					if ((len == bytes) && (0 == ptr[i])) @@ -2269,7 +2269,7 @@ void ScintillaWin::Paste() {  				if (IsUnicodeMode()) {  					std::vector<wchar_t> uptr(len+1); -					unsigned int ulen = ::MultiByteToWideChar(CP_ACP, 0, +					const unsigned int ulen = ::MultiByteToWideChar(CP_ACP, 0,  					                    ptr, len, &uptr[0], len+1);  					unsigned int mlen = UTF8Length(&uptr[0], ulen); @@ -2460,7 +2460,7 @@ STDMETHODIMP DataObject_QueryGetData(DataObject *pd, FORMATETC *pFE) {  		return S_OK;  	} -	bool formatOK = (pFE->cfFormat == CF_TEXT) || +	const bool formatOK = (pFE->cfFormat == CF_TEXT) ||  		((pFE->cfFormat == CF_UNICODETEXT) && pd->sci->IsUnicodeMode());  	if (!formatOK ||  	    pFE->ptd != 0 || @@ -2855,8 +2855,8 @@ void ScintillaWin::ScrollMessage(WPARAM wParam) {  void ScintillaWin::HorizontalScrollMessage(WPARAM wParam) {  	int xPos = xOffset; -	PRectangle rcText = GetTextRectangle(); -	int pageWidth = static_cast<int>(rcText.Width() * 2 / 3); +	const PRectangle rcText = GetTextRectangle(); +	const int pageWidth = static_cast<int>(rcText.Width() * 2 / 3);  	switch (LoWord(wParam)) {  	case SB_LINEUP:  		xPos -= 20; @@ -2930,7 +2930,7 @@ void ScintillaWin::FullPaintDC(HDC hdc) {  			pRenderTarget->BeginDraw();  			Paint(surfaceWindow, rcPaint);  			surfaceWindow->Release(); -			HRESULT hr = pRenderTarget->EndDraw(); +			const HRESULT hr = pRenderTarget->EndDraw();  			if (hr == static_cast<HRESULT>(D2DERR_RECREATE_TARGET)) {  				DropRenderTarget();  			} @@ -2946,7 +2946,7 @@ static bool CompareDevCap(HDC hdc, HDC hOtherDC, int nIndex) {  bool ScintillaWin::IsCompatibleDC(HDC hOtherDC) {  	HDC hdc = ::GetDC(MainHWND()); -	bool isCompatible = +	const bool isCompatible =  		CompareDevCap(hdc, hOtherDC, TECHNOLOGY) &&  		CompareDevCap(hdc, hOtherDC, LOGPIXELSY) &&  		CompareDevCap(hdc, hOtherDC, LOGPIXELSX) && @@ -3000,11 +3000,11 @@ STDMETHODIMP ScintillaWin::DragEnter(LPDATAOBJECT pIDataSource, DWORD grfKeyStat  	if (pIDataSource == NULL)  		return E_POINTER;  	FORMATETC fmtu = {CF_UNICODETEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; -	HRESULT hrHasUText = pIDataSource->QueryGetData(&fmtu); +	const HRESULT hrHasUText = pIDataSource->QueryGetData(&fmtu);  	hasOKText = (hrHasUText == S_OK);  	if (!hasOKText) {  		FORMATETC fmte = {CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; -		HRESULT hrHasText = pIDataSource->QueryGetData(&fmte); +		const HRESULT hrHasText = pIDataSource->QueryGetData(&fmte);  		hasOKText = (hrHasText == S_OK);  	}  	if (!hasOKText) { @@ -3068,7 +3068,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState,  			wchar_t *udata = static_cast<wchar_t *>(memUDrop.ptr);  			if (udata) {  				if (IsUnicodeMode()) { -					int tlen = static_cast<int>(memUDrop.Size()); +					const int tlen = static_cast<int>(memUDrop.Size());  					// Convert UTF-16 to UTF-8  					int dataLen = UTF8Length(udata, tlen/2);  					data.resize(dataLen+1); @@ -3129,7 +3129,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState,  /// Implement important part of IDataObject  STDMETHODIMP ScintillaWin::GetData(FORMATETC *pFEIn, STGMEDIUM *pSTM) { -	bool formatOK = (pFEIn->cfFormat == CF_TEXT) || +	const bool formatOK = (pFEIn->cfFormat == CF_TEXT) ||  		((pFEIn->cfFormat == CF_UNICODETEXT) && IsUnicodeMode());  	if (!formatOK ||  	    pFEIn->ptd != 0 || @@ -3421,7 +3421,7 @@ LRESULT PASCAL ScintillaWin::SWndProc(  // Must be called once only.  int Scintilla_RegisterClasses(void *hInstance) {  	Platform_Initialise(hInstance); -	bool result = ScintillaWin::Register(static_cast<HINSTANCE>(hInstance)); +	const bool result = ScintillaWin::Register(static_cast<HINSTANCE>(hInstance));  #ifdef SCI_LEXER  	Scintilla_LinkLexers();  #endif @@ -3429,7 +3429,7 @@ int Scintilla_RegisterClasses(void *hInstance) {  }  static int ResourcesRelease(bool fromDllMain) { -	bool result = ScintillaWin::Unregister(); +	const bool result = ScintillaWin::Unregister();  	Platform_Finalise(fromDllMain);  	return result;  } | 
