fixed: possible crash

This commit is contained in:
Bob 2012-12-20 16:22:52 +01:00 committed by Bob van Loosen
parent 1c819b3b41
commit d8b544acbf
2 changed files with 4 additions and 4 deletions

View file

@ -410,7 +410,7 @@ void CBitVis::InitChars()
{\ {\
const unsigned int* pixarr = pixels;\ const unsigned int* pixarr = pixels;\
std::vector<unsigned int> pixelvec;\ std::vector<unsigned int> pixelvec;\
int charheight = CharHeight(pixarr);\ int charheight = CharHeight(pixarr, sizeof(pixels));\
if (m_fontheight < charheight)\ if (m_fontheight < charheight)\
m_fontheight = charheight;\ m_fontheight = charheight;\
for (size_t i = 0; i < sizeof(pixels) / sizeof(pixels[0]); i++)\ for (size_t i = 0; i < sizeof(pixels) / sizeof(pixels[0]); i++)\
@ -517,10 +517,10 @@ void CBitVis::InitChars()
GLYPH(' ', ((const unsigned int[]){0x0, 0x0, 0x0})) GLYPH(' ', ((const unsigned int[]){0x0, 0x0, 0x0}))
} }
int CBitVis::CharHeight(const unsigned int* in) int CBitVis::CharHeight(const unsigned int* in, size_t size)
{ {
int highest = 0; int highest = 0;
for (int i = 0; i < 8; i++) for (size_t i = 0; i < size; i++)
{ {
for (int j = 0; j < 32; j++) for (int j = 0; j < 32; j++)
{ {

View file

@ -73,7 +73,7 @@ class CBitVis
void ProcessAudio(); void ProcessAudio();
void SendData(int64_t time); void SendData(int64_t time);
void SetText(uint8_t* buff, const char* str, int offset = 0); void SetText(uint8_t* buff, const char* str, int offset = 0);
int CharHeight(const unsigned int* in); int CharHeight(const unsigned int* in, size_t size);
void InitChars(); void InitChars();
static void JackError(const char* jackerror); static void JackError(const char* jackerror);
static void JackInfo(const char* jackinfo); static void JackInfo(const char* jackinfo);