diff options
| author | Neil <nyamatongwe@gmail.com> | 2020-01-31 10:55:14 +1100 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2020-01-31 10:55:14 +1100 | 
| commit | 38f3c4d8dfb7829f3c16cb1053484c0bade6ed85 (patch) | |
| tree | e9871f23d4ca2dbfb349d87f76ef38729ad3ef0e | |
| parent | 98d89d81e17940ae5643f0db53734defa9610599 (diff) | |
| download | scintilla-mirror-38f3c4d8dfb7829f3c16cb1053484c0bade6ed85.tar.gz | |
Backport: Avoid Clang warning with extra test.
Harmonize types to avoid casts.
Backport of changeset 7967:ddf1b734e7f8.
| -rw-r--r-- | win32/PlatWin.cxx | 10 | 
1 files changed, 5 insertions, 5 deletions
| diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index d2b9b6f98..004c4cb50 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1591,14 +1591,14 @@ void SurfaceD2D::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *  	}  	// A cluster may be more than one WCHAR, such as for "ffi" which is a ligature in the Candara font  	FLOAT position = 0.0f; -	size_t ti=0; -	for (size_t ci=0; ci<count; ci++) { -		for (size_t inCluster=0; inCluster<clusterMetrics[ci].length; inCluster++) { +	int ti=0; +	for (unsigned int ci=0; ci<count; ci++) { +		for (unsigned int inCluster=0; inCluster<clusterMetrics[ci].length; inCluster++) {  			poses.buffer[ti++] = position + clusterMetrics[ci].width * (inCluster + 1) / clusterMetrics[ci].length;  		}  		position += clusterMetrics[ci].width;  	} -	PLATFORM_ASSERT(ti == static_cast<size_t>(tbuf.tlen)); +	PLATFORM_ASSERT(ti == tbuf.tlen);  	if (unicodeMode) {  		// Map the widths given for UTF-16 characters back onto the UTF-8 input string  		int ui=0; @@ -1609,7 +1609,7 @@ void SurfaceD2D::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *  			if (byteCount == 4) {	// Non-BMP  				ui++;  			} -			for (unsigned int bytePos=0; (bytePos<byteCount) && (i<len); bytePos++) { +			for (unsigned int bytePos=0; (bytePos<byteCount) && (i<len) && (ui<tbuf.tlen); bytePos++) {  				positions[i++] = poses.buffer[ui];  			}  			ui++; | 
