aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2018-04-25 17:42:11 +1000
committerNeil <nyamatongwe@gmail.com>2018-04-25 17:42:11 +1000
commitaf00d95fc02843ba3cae8d7d076fd43a171d6afd (patch)
treeb4ecfa3fdb9f4bf72cc06d484befc83e900056b3
parent3fb1bc5789348d9f9a8bc7868c20ab5ba6b41a41 (diff)
downloadscintilla-mirror-af00d95fc02843ba3cae8d7d076fd43a171d6afd.tar.gz
Remove variables and casts that are not needed.
-rw-r--r--cocoa/PlatCocoa.mm4
-rw-r--r--qt/ScintillaEditBase/PlatQt.cpp4
-rw-r--r--win32/PlatWin.cxx6
3 files changed, 6 insertions, 8 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index 606927995..763778342 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -892,10 +892,10 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION
// Map the widths given for UTF-16 characters back onto the UTF-8 input string
CFIndex fit = textLayout->getStringLength();
int ui=0;
- const unsigned char *us = reinterpret_cast<const unsigned char *>(s);
int i=0;
while (ui<fit) {
- const unsigned int byteCount = UTF8BytesOfLead[us[i]];
+ const unsigned char uch = s[i];
+ const unsigned int byteCount = UTF8BytesOfLead[uch];
const int codeUnits = UTF16LengthFromUTF8ByteCount(byteCount);
CGFloat xPosition = CTLineGetOffsetForStringIndex(mLine, ui+codeUnits, NULL);
for (unsigned int bytePos=0; (bytePos<byteCount) && (i<len); bytePos++) {
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp
index e32fec67d..fb7904f05 100644
--- a/qt/ScintillaEditBase/PlatQt.cpp
+++ b/qt/ScintillaEditBase/PlatQt.cpp
@@ -460,10 +460,10 @@ void SurfaceImpl::MeasureWidths(Font &font,
if (unicodeMode) {
int fit = su.size();
int ui=0;
- const unsigned char *us = reinterpret_cast<const unsigned char *>(s);
int i=0;
while (ui<fit) {
- const unsigned int byteCount = UTF8BytesOfLead[us[i]];
+ const unsigned char uch = s[i];
+ const unsigned int byteCount = UTF8BytesOfLead[uch];
const int codeUnits = UTF16LengthFromUTF8ByteCount(byteCount);
qreal xPosition = tl.cursorToX(ui+codeUnits);
for (unsigned int bytePos=0; (bytePos<byteCount) && (i<len); bytePos++) {
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index a74a21238..4f7d59562 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -982,9 +982,8 @@ void SurfaceGDI::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *
return;
}
// Map the widths given for UTF-16 characters back onto the UTF-8 input string
- const unsigned char *us = reinterpret_cast<const unsigned char *>(s);
for (int ui = 0; ui < fit; ui++) {
- const unsigned char uch = us[i];
+ const unsigned char uch = s[i];
const unsigned int byteCount = UTF8BytesOfLead[uch];
if (byteCount == 4) { // Non-BMP
ui++;
@@ -1654,10 +1653,9 @@ void SurfaceD2D::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *
if (unicodeMode) {
// Map the widths given for UTF-16 characters back onto the UTF-8 input string
int ui=0;
- const unsigned char *us = reinterpret_cast<const unsigned char *>(s);
int i=0;
while (ui<tbuf.tlen) {
- const unsigned char uch = us[i];
+ const unsigned char uch = s[i];
const unsigned int byteCount = UTF8BytesOfLead[uch];
if (byteCount == 4) { // Non-BMP
ui++;