G ++ warning: narrowing conversion

I am trying to compile hosts3d from sourceforge and it compiles, but generates some narrowing errors. I do not know how to fix this, but any help would be greatly appreciated. I suspect that I can download the previous version of the compiler, and I can finish this, but for now ... C ++ 11

g ++ -Wall -O2 -c -o src / glwin.o src / glwin.cpp src / glwin.cpp: in the member function 'int MyGLWin :: AddInput (int, int, unsigned int, int, const char *, bool ) ': src / glwin.cpp: 983: 147: warning: narrowing conversion "max" from "int" to "unsigned int" inside {} poorly formed in C ++ 11 [-Wnarrowing] glin_obj glin = {GLWIN_INPUT , lastWin , lower, names ++, left, top, cwidth, strlen (text), (strlen (text)> cwidth? strlen (text) - cwidth: 0), max};

//create input object, return name of input object
int MyGLWin::AddInput(int left, int top, unsigned int cwidth, int max, const char *text, bool lower)
{
  if (!lastWin) return -1;  //check parent window object exists
  glin_obj glin = {GLWIN_INPUT, lastWin, lower, names++, left, top, cwidth, strlen(text), (strlen(text) > cwidth ? strlen(text) - cwidth : 0), max};
  strcpy(glin.text, text);  //default text
  currInput = glin.name;  //set input object focus (for keys)
  lastInput = (glin_obj *)GLWinLL.Write(new glin_obj(glin));
  return glin.name;
}
+4
source share
1 answer

"" , , , . int max () unsigned int.

-, AddInput API, . , ( , ), (unsigned int)max.

+2

All Articles