diff options
author | Vas Crabb <vas@vastheman.com> | 2016-08-03 14:54:28 +1000 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2016-08-03 14:54:28 +1000 |
commit | ae0e3fbf570a3eda623c4c729fce78684b190dd3 (patch) | |
tree | 11fd039e6e1a36f8258147288b1c10fc070b12dd /src/frontend/mame/ui/text.cpp | |
parent | 938371b64fdd15599c4ce4dbb8525ebda512f5ad (diff) |
quick fixes to some more stuff that isn't supplementary plane clean
Diffstat (limited to 'src/frontend/mame/ui/text.cpp')
-rw-r--r-- | src/frontend/mame/ui/text.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/frontend/mame/ui/text.cpp b/src/frontend/mame/ui/text.cpp index ea6ebc743df..50e7cf6bbfe 100644 --- a/src/frontend/mame/ui/text.cpp +++ b/src/frontend/mame/ui/text.cpp @@ -12,6 +12,10 @@ #include "rendfont.h" #include "render.h" +#include <cstddef> +#include <cstring> + + namespace ui { /*************************************************************************** INLINE FUNCTIONS @@ -111,10 +115,10 @@ text_layout::~text_layout() void text_layout::add_text(const char *text, const char_style &style) { - int position = 0; - int text_length = strlen(text); + std::size_t position = 0; + std::size_t const text_length = std::strlen(text); - while(position < text_length) + while (position < text_length) { // adding a character - we might change the width invalidate_calculated_actual_width(); @@ -124,16 +128,15 @@ void text_layout::add_text(const char *text, const char_style &style) { // get the current character unicode_char schar; - int scharcount; - scharcount = uchar_from_utf8(&schar, &text[position], text_length - position); - if (scharcount == -1) + int const scharcount = uchar_from_utf8(&schar, &text[position], text_length - position); + if (scharcount < 0) break; // if the line starts with a tab character, center it regardless text_justify line_justify = justify(); if (schar == '\t') { - position += scharcount; + position += unsigned(scharcount); line_justify = text_layout::CENTER; } @@ -142,12 +145,11 @@ void text_layout::add_text(const char *text, const char_style &style) } // get the current character - int scharcount; unicode_char ch; - scharcount = uchar_from_utf8(&ch, &text[position], text_length - position); + int const scharcount = uchar_from_utf8(&ch, &text[position], text_length - position); if (scharcount < 0) break; - position += scharcount; + position += unsigned(scharcount); // set up source information source_info source = { 0, }; |