mirror of
https://github.com/kevinbentley/Descent3.git
synced 2025-01-22 11:28:56 +00:00
2dlib: Fix an integer signedness compiler warning in pentext.cpp
This fixes an integer signedness compiler warning and cleans up the grViewport::draw_text_line method in 2dlib/pentext.cpp.
This commit is contained in:
parent
9af8c16b6b
commit
10dae4d65b
@ -333,23 +333,18 @@ void grViewport::draw_text_line_clip(int x, int y, char *str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void grViewport::draw_text_line(int x, int y, char *str) {
|
void grViewport::draw_text_line(int x, int y, char *str) {
|
||||||
unsigned i, cur_x;
|
|
||||||
|
|
||||||
/* perform string drawing without viewport clipping.
|
/* perform string drawing without viewport clipping.
|
||||||
supports bitmap fonts or color(alpha) mapped fonts.
|
supports bitmap fonts or color(alpha) mapped fonts.
|
||||||
*/
|
*/
|
||||||
cur_x = x;
|
uint32_t cur_x = x;
|
||||||
for (i = 0; i < (int)strlen(str); i++) {
|
for (size_t i = 0; i < strlen(str); i++) {
|
||||||
uint8_t ch;
|
uint8_t ch = (uint8_t)str[i];
|
||||||
|
|
||||||
ch = (uint8_t)str[i];
|
|
||||||
|
|
||||||
if (ch == GR_COLOR_CHAR) {
|
if (ch == GR_COLOR_CHAR) {
|
||||||
if ((i + 3) >= (int)strlen(str))
|
if ((i + 3) >= strlen(str))
|
||||||
Int3(); // This shouldn't happen! bad string!
|
Int3(); // This shouldn't happen! bad string!
|
||||||
set_text_color(GR_RGB(str[i + 1], str[i + 2], str[i + 3]));
|
set_text_color(GR_RGB(str[i + 1], str[i + 2], str[i + 3]));
|
||||||
i += 4;
|
i += 4;
|
||||||
if (i >= (int)strlen(str))
|
if (i >= strlen(str))
|
||||||
Int3(); // This shouldn't happen too.
|
Int3(); // This shouldn't happen too.
|
||||||
ch = (uint8_t)str[i];
|
ch = (uint8_t)str[i];
|
||||||
} else if (ch == '\t') { // tab char
|
} else if (ch == '\t') { // tab char
|
||||||
|
Loading…
Reference in New Issue
Block a user