fixed some warnings and one signed/unsigned bug

This was SVN commit r291.
This commit is contained in:
janwas 2004-05-29 11:59:59 +00:00
parent e326ebae46
commit 246662f01f
7 changed files with 20 additions and 14 deletions

View File

@ -177,6 +177,7 @@ bool CGUI::HandleEvent(const SDL_Event& ev)
}
catch (PS_RESULT e)
{
UNUSED(e);
// TODO Gee: Handle
}
// JW: what's the difference between mPress and mDown? what's the code below responsible for?
@ -308,7 +309,7 @@ void CGUI::Draw()
// Adapt (origio) to being in top left corner and down
// just like the mouse position
glTranslatef(0.0f, g_yres, -1000.0f);
glTranslatef(0.0f, (GLfloat)g_yres, -1000.0f);
glScalef(1.0f, -1.f, 1.0f);
try
@ -319,6 +320,7 @@ void CGUI::Draw()
}
catch (PS_RESULT e)
{
UNUSED(e);
glPopMatrix();
// TODO Gee: Report error.
@ -391,6 +393,7 @@ void CGUI::Destroy()
}
catch (PS_RESULT e)
{
UNUSED(e);
// TODO Gee: Handle
}
@ -453,11 +456,11 @@ void CGUI::UpdateObjects()
bool CGUI::ObjectExists(const CStr &Name) const
{
return m_pAllObjects.count(Name);
return m_pAllObjects.count(Name) != 0;
}
// private struct used only in GenerateText(...)
static struct SGenerateTextImage
struct SGenerateTextImage
{
int m_YFrom, // The images starting location in Y
m_YTo, // The images end location in Y
@ -514,7 +517,7 @@ SGUIText CGUI::GenerateText(const CGUIString &string, /*const CColor &Color, */
bool WordWrapping = (Width != 0);
// Go through string word by word
for (int i=0; i<string.m_Words.size()-1 && !done; ++i)
for (int i=0; i<(int)string.m_Words.size()-1 && !done; ++i)
{
// Pre-process each line one time, so we know which floating images
// will be added for that line.
@ -1056,6 +1059,7 @@ void CGUI::Xerces_ReadObject(DOMElement *pElement, IGUIObject *pParent)
}
catch (PS_RESULT e)
{
UNUSED(e);
ReportParseError(CStr("Can't set \"") + attr_name + CStr("\" to \"") + attr_value + CStr("\""));
// This is not a fatal error

View File

@ -22,7 +22,7 @@ void CGUIScrollBarVertical::SetPosFromMousePos(const CPos &mouse)
if (!GetStyle())
return;
m_Pos = (m_PosWhenPressed + (float)m_ScrollRange*((float)mouse.y-m_BarPressedAtPos.y)/(m_Length-GetStyle()->m_Width*2));
m_Pos = (int)(m_PosWhenPressed + (float)m_ScrollRange*((float)mouse.y-m_BarPressedAtPos.y)/(m_Length-GetStyle()->m_Width*2));
}
void CGUIScrollBarVertical::Draw()

View File

@ -236,7 +236,7 @@ void CGUIString::SetValue(const CStr &str)
if (from != m_RawString.Length())
{
CurrentTextChunk.m_From = from;
CurrentTextChunk.m_To = m_RawString.Length();
CurrentTextChunk.m_To = (int)m_RawString.Length();
m_TextChunks.push_back(CurrentTextChunk);
}
@ -401,11 +401,11 @@ void CGUIString::SetValue(const CStr &str)
ofstream fout("output1.txt");
for (int i=0; i<m_TextChunks.size(); ++i)
for (int i=0; i<(int)m_TextChunks.size(); ++i)
{
fout << "{\"";
fout << m_TextChunks[i].m_From << " " << m_TextChunks[i].m_To << "\",";
for (int j=0; j<m_TextChunks[i].m_Tags.size(); ++j)
for (int j=0; j<(int)m_TextChunks[i].m_Tags.size(); ++j)
{
fout << "(" << m_TextChunks[i].m_Tags[j].m_TagType << " " << m_TextChunks[i].m_Tags[j].m_TagValue << ")";
}
@ -422,7 +422,7 @@ void CGUIString::SetValue(const CStr &str)
// those cases.
// We'll sort later.
m_Words.push_back(0);
m_Words.push_back(m_RawString.Length());
m_Words.push_back((int)m_RawString.Length());
// Space: ' '
for (position=0, curpos=0;;position = curpos+1)

View File

@ -100,7 +100,7 @@ bool __ParseString<CColor>(const CStr &Value, CColor &Output)
}
float values[4];
values[3] = 255.f; // default
for (int i=0; i<line.GetArgCount(); ++i)
for (int i=0; i<(int)line.GetArgCount(); ++i)
{
if (!line.GetArgFloat(i, values[i]))
{
@ -193,7 +193,7 @@ bool CClientArea::SetClientArea(const CStr &Value)
int arg_start[4] = {0,0,0,0}; // location of first argument, [0] is alwasy 0
// Divide into the four piles (delimiter is an argument named "delim")
for (int i=0, valuenr=0; i<line.GetArgCount(); ++i)
for (int i=0, valuenr=0; i<(int)line.GetArgCount(); ++i)
{
string str;
line.GetArgString(i, str);
@ -212,7 +212,7 @@ bool CClientArea::SetClientArea(const CStr &Value)
arg_count[valuenr] = arg_start[valuenr+1] - arg_start[valuenr] - 1;
}
else
arg_count[3] = line.GetArgCount() - arg_start[valuenr] - 1;
arg_count[3] = (int)line.GetArgCount() - arg_start[valuenr] - 1;
}
++valuenr;

View File

@ -323,6 +323,7 @@ void IGUIObject::LoadStyle(const SGUIStyle &Style)
// since it's generic.
catch (PS_RESULT e)
{
UNUSED(e);
// TODO Gee: was ist das?
}
}

View File

@ -105,7 +105,7 @@ void IGUIScrollBar::HandleMessage(const SGUIMessage &Message)
{
m_BarPressed = true;
m_BarPressedAtPos = mouse;
m_PosWhenPressed = m_Pos;
m_PosWhenPressed = (float)m_Pos;
}
else
// if button-minus is pressed

View File

@ -60,7 +60,8 @@ void IGUITextOwner::HandleMessage(const SGUIMessage &Message)
void IGUITextOwner::Draw(const int &index, const CColor &color, const CPos &pos,
const float &z, const CRect &clipping)
{
if (index < 0 && index >= m_GeneratedTexts.size())
if (index < 0 || index >= (int)m_GeneratedTexts.size())
// janwas fixed bug here; was i < 0 && i >= size - impossible.
{
// TODO Gee: Warning
return;