summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormniip <mniip@mniip.com>2013-09-06 11:04:49 (GMT)
committer jacksonmj <mj-pt@jacksonmj.co.uk>2013-09-06 12:09:24 (GMT)
commit8d96f3f6b6a872956cac4217c4a8f56d6316738b (patch)
treec61bb42865e38f0befd4ed651fe23789869bae18
parentd9089d13c4d7299236da6736480bf9fe967541e2 (diff)
downloadpowder-8d96f3f6b6a872956cac4217c4a8f56d6316738b.zip
powder-8d96f3f6b6a872956cac4217c4a8f56d6316738b.tar.gz
fix segfault on wordwrapping a string with a character >=128
-rw-r--r--src/graphics/Graphics.cpp2
-rw-r--r--src/graphics/Graphics.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/graphics/Graphics.cpp b/src/graphics/Graphics.cpp
index aa00821..c70344b 100644
--- a/src/graphics/Graphics.cpp
+++ b/src/graphics/Graphics.cpp
@@ -586,7 +586,7 @@ int Graphics::textwidth(const char *s)
return x-1;
}
-int Graphics::CharWidth(char c)
+int Graphics::CharWidth(unsigned char c)
{
return font_data[font_ptrs[(int)c]];
}
diff --git a/src/graphics/Graphics.h b/src/graphics/Graphics.h
index 580f2c0..de1c2e8 100644
--- a/src/graphics/Graphics.h
+++ b/src/graphics/Graphics.h
@@ -203,7 +203,7 @@ public:
//Font/text metrics
static int CharIndexAtPosition(char *s, int positionX, int positionY);
static int PositionAtCharIndex(char *s, int charIndex, int & positionX, int & positionY);
- static int CharWidth(char c);
+ static int CharWidth(unsigned char c);
static int textnwidth(char *s, int n);
static void textnpos(char *s, int n, int w, int *cx, int *cy);
static int textwidthx(char *s, int w);