Commits

Jérôme Vuarand committed 6594ea8

Fixed compilation warnings on GCC.

  • Participants
  • Parent commits 38d8a62

Comments (0)

Files changed (2)

 #include "structs.h"
 
 #include <lauxlib.h>
+#include <string.h>
 #include "compat.h"
 
 static int luausb_generic_index(lua_State* L)
 	lua_pop(L, 1);
 	{
 		size_t size;
-		udata->]]..field.name..[[ = lua_tolstring(L, 2, &size);
+		udata->]]..field.name..[[ = (const ]]..field.ctype..[[)lua_tolstring(L, 2, &size);
 		udata->]]..field.size..[[ = (]]..field.size_ctype..[[)size;
 	}
 	return 0;
 		lua_setfield(L, -2, "]]..field.name..[[");
 		lua_pop(L, 1);
 		memcpy(buffer, value, size);
-		udata->]]..field.name..[[ = buffer;
+		udata->]]..field.name..[[ = (]]..field.ctype..[[)buffer;
 		udata->]]..field.size..[[ = (]]..field.size_ctype..[[)size;
 	}
 	else if (lua_type(L, 2)==LUA_TNUMBER)
 		lua_setfield(L, -2, "]]..field.name..[[");
 		lua_pop(L, 1);
 		memset(buffer, 0, size);
-		udata->]]..field.name..[[ = buffer;
+		udata->]]..field.name..[[ = (]]..field.ctype..[[)buffer;
 		udata->]]..field.size..[[ = (]]..field.size_ctype..[[)size;
 	}
 	else
 #include "structs.h"
 
 #include <lauxlib.h>
+#include <string.h>
 #include "compat.h"
 
 static int luausb_generic_index(lua_State* L)
 	lua_pop(L, 1);
 	{
 		size_t size;
-		udata->extra = lua_tolstring(L, 2, &size);
+		udata->extra = (const unsigned char*)lua_tolstring(L, 2, &size);
 		udata->extra_length = (int)size;
 	}
 	return 0;
 	lua_pop(L, 1);
 	{
 		size_t size;
-		udata->extra = lua_tolstring(L, 2, &size);
+		udata->extra = (const unsigned char*)lua_tolstring(L, 2, &size);
 		udata->extra_length = (int)size;
 	}
 	return 0;
 	lua_pop(L, 1);
 	{
 		size_t size;
-		udata->extra = lua_tolstring(L, 2, &size);
+		udata->extra = (const unsigned char*)lua_tolstring(L, 2, &size);
 		udata->extra_length = (int)size;
 	}
 	return 0;
 		lua_setfield(L, -2, "buffer");
 		lua_pop(L, 1);
 		memcpy(buffer, value, size);
-		udata->buffer = buffer;
+		udata->buffer = (unsigned char*)buffer;
 		udata->length = (int)size;
 	}
 	else if (lua_type(L, 2)==LUA_TNUMBER)
 		lua_setfield(L, -2, "buffer");
 		lua_pop(L, 1);
 		memset(buffer, 0, size);
-		udata->buffer = buffer;
+		udata->buffer = (unsigned char*)buffer;
 		udata->length = (int)size;
 	}
 	else