diff options
Diffstat (limited to 'win32')
| -rw-r--r-- | win32/PlatWin.cxx | 21 | ||||
| -rw-r--r-- | win32/ScintillaWin.cxx | 2 | 
2 files changed, 16 insertions, 7 deletions
| diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 16854f254..97d7eddb5 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -285,6 +285,7 @@ static void SetLogFont(LOGFONTA &lf, const char *faceName, int characterSet, flo  	lf.lfCharSet = static_cast<BYTE>(characterSet);  	lf.lfQuality = Win32MapFontQuality(extraFontFlag);  	strncpy(lf.lfFaceName, faceName, sizeof(lf.lfFaceName)); +	lf.lfFaceName[sizeof(lf.lfFaceName)-1] = '\0';  }  /** @@ -2270,12 +2271,15 @@ PRectangle ListBoxX::GetDesiredRect() {  	HDC hdc = ::GetDC(lb);  	HFONT oldFont = SelectFont(hdc, fontCopy);  	SIZE textSize = {0, 0}; -	int len = static_cast<int>(widestItem ? strlen(widestItem) : 0); -	if (unicodeMode) { -		const TextWide tbuf(widestItem, len, unicodeMode); -		::GetTextExtentPoint32W(hdc, tbuf.buffer, tbuf.tlen, &textSize); -	} else { -		::GetTextExtentPoint32A(hdc, widestItem, len, &textSize); +	int len = 0; +	if (widestItem) { +		len = static_cast<int>(strlen(widestItem)); +		if (unicodeMode) { +			const TextWide tbuf(widestItem, len, unicodeMode); +			::GetTextExtentPoint32W(hdc, tbuf.buffer, tbuf.tlen, &textSize); +		} else { +			::GetTextExtentPoint32A(hdc, widestItem, len, &textSize); +		}  	}  	TEXTMETRIC tm;  	::GetTextMetrics(hdc, &tm); @@ -2439,7 +2443,11 @@ void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) {  							delete surfaceItem;  							pDCRT->EndDraw();  							pDCRT->Release(); +						} else { +							delete surfaceItem;  						} +					} else { +						delete surfaceItem;  					}  #endif  				} @@ -2991,6 +2999,7 @@ ElapsedTime::ElapsedTime() {  		littleBit = timeVal.LowPart;  	} else {  		bigBit = clock(); +		littleBit = 0;  	}  } diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 2386f1c48..8d7be0629 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -2132,7 +2132,7 @@ void ScintillaWin::ImeStartComposition() {  			lf.lfItalic = static_cast<BYTE>(vs.styles[styleHere].italic ? 1 : 0);  			lf.lfCharSet = DEFAULT_CHARSET;  			lf.lfFaceName[0] = '\0'; -			if (vs.styles[styleHere].fontName) +			if (vs.styles[styleHere].fontName && (strlen(vs.styles[styleHere].fontName) < sizeof(lf.lfFaceName)))  				strcpy(lf.lfFaceName, vs.styles[styleHere].fontName);  			::ImmSetCompositionFontA(hIMC, &lf); | 
