diff options
author | Neil <nyamatongwe@gmail.com> | 2019-03-27 07:48:45 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2019-03-27 07:48:45 +1100 |
commit | a29736e309ee7d0b8ca588674024c2deb6923090 (patch) | |
tree | ab183df2e3321f6cd8c2c9dd3c424f0f8ce23f01 | |
parent | 93f226764563a4fe11fab49d6312b7fe4971d0eb (diff) | |
download | scintilla-mirror-a29736e309ee7d0b8ca588674024c2deb6923090.tar.gz |
Use size_t for consistency and to avoid casts.
-rw-r--r-- | gtk/PlatGTK.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 0701eb7a1..40e87c428 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -823,7 +823,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, std::string_view text, XYPOSITION * } } if (positionsCalculated < 1 ) { - const int lenPositions = static_cast<int>(text.length()); + const size_t lenPositions = text.length(); // Either 8-bit or DBCS conversion failed so treat as 8-bit. SetConverter(PFont(font_)->characterSet); const bool rtlCheck = PFont(font_)->characterSet == SC_CHARSET_HEBREW || @@ -833,7 +833,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, std::string_view text, XYPOSITION * utfForm = UTF8FromLatin1(text); } pango_layout_set_text(layout, utfForm.c_str(), utfForm.length()); - int i = 0; + size_t i = 0; int clusterStart = 0; // Each 8-bit input character may take 1 or 2 bytes in UTF-8 // and groups of up to 3 may be represented as ligatures. @@ -847,7 +847,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, std::string_view text, XYPOSITION * int widthLayout = 0; pango_layout_get_size(layout, &widthLayout, NULL); XYPOSITION widthTotal = doubleFromPangoUnits(widthLayout); - for (int bytePos=0; bytePos<lenPositions; bytePos++) { + for (size_t bytePos=0; bytePos<lenPositions; bytePos++) { positions[bytePos] = widthTotal / lenPositions * (bytePos + 1); } return; @@ -862,7 +862,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, std::string_view text, XYPOSITION * // If something failed, fill in rest of the positions positions[i++] = clusterStart; } - PLATFORM_ASSERT(static_cast<size_t>(i) == text.length()); + PLATFORM_ASSERT(i == text.length()); } } } |