Index: trunk/src/gfx/image.cc
===================================================================
--- trunk/src/gfx/image.cc	(revision 120)
+++ trunk/src/gfx/image.cc	(revision 121)
@@ -12,5 +12,5 @@
 	: m_size( size ), m_depth( depth ), m_data( nullptr )
 {
-	m_data = new uint8[ m_size.x * m_size.y * m_depth ];
+	m_data = new uint8[ static_cast<uint16>( m_size.x * m_size.y ) * m_depth ];
 }
 
@@ -25,10 +25,10 @@
 	: m_size( size ), m_depth( depth ), m_data( nullptr )
 {
-	std::size_t bsize = m_size.x * m_size.y * m_depth;
-	m_data = new uint8[ m_size.x * m_size.y * m_depth ];
+	sint32 bsize = m_size.x * m_size.y * static_cast<sint32>( m_depth );
+	m_data = new uint8[ bsize ];
 
 	if ( reversed )
 	{
-		std::size_t bline = m_size.x * m_depth;
+		sint32 bline = m_size.x * static_cast<sint32>( m_depth );
 		for( int i = 0; i < m_size.y; ++i )
 		{
@@ -45,13 +45,13 @@
 void image::fill( uint8 value )
 {
-	std::fill( m_data, m_data + m_size.x * m_size.y * m_depth, value );
+	std::fill( m_data, m_data + m_size.x * m_size.y * (int)m_depth, value );
 }
 
-void image::set_region( region r, const uint8 * data, size_t stride )
+void image::set_region( region r, const uint8 * data, int stride )
 {
-	if ( stride == 0 ) stride = r.size.x * m_depth;
+	if ( stride == 0 ) stride = r.size.x * static_cast<sint32>( m_depth );
 	
-	std::size_t bpos  = (r.pos.y*m_size.x + r.pos.x ) * m_depth;
-	std::size_t bline = m_size.x*m_depth;
+	sint32 bpos  = (r.pos.y*m_size.x + r.pos.x ) * static_cast<sint32>( m_depth );
+	sint32 bline = m_size.x*static_cast<sint32>( m_depth );
 
 	for( int i = 0; i < r.size.y; ++i )
Index: trunk/src/gfx/texture_atlas.cc
===================================================================
--- trunk/src/gfx/texture_atlas.cc	(revision 120)
+++ trunk/src/gfx/texture_atlas.cc	(revision 121)
@@ -37,5 +37,5 @@
 			{
 				best_height = y + size.y;
-				best_index = i;
+				best_index = static_cast<int>( i );
 				best_width = node.z;
 				r.pos.x = node.x;
@@ -52,5 +52,5 @@
 	m_nodes.insert( m_nodes.begin() + best_index, glm::ivec3( r.pos.x, r.pos.y + size.y, size.x ) );
 
-	for( size_t i = best_index+1; i < m_nodes.size(); ++i )
+	for( size_t i = static_cast<size_t>( best_index )+1; i < m_nodes.size(); ++i )
 	{
 		glm::ivec3 node = m_nodes[ i ];
@@ -65,5 +65,5 @@
 			if (m_nodes[ i ].z <= 0)
 			{
-				m_nodes.erase( m_nodes.begin() + i );
+				m_nodes.erase( m_nodes.begin() + static_cast<int>(i) );
 				--i;
 			}
@@ -79,5 +79,5 @@
 	}
 	merge();
-	m_used += size.x * size.y;
+	m_used += static_cast<uint16>(size.x * size.y);
 	return r;
 }
@@ -119,5 +119,5 @@
 		{
 			m_nodes[ i ].z += m_nodes[ i+1 ].z;
-            m_nodes.erase( m_nodes.begin()+i+1 );
+            m_nodes.erase( m_nodes.begin()+static_cast<int>(i+1) );
 			--i;
 		}
Index: trunk/src/gfx/texture_font.cc
===================================================================
--- trunk/src/gfx/texture_font.cc	(revision 120)
+++ trunk/src/gfx/texture_font.cc	(revision 121)
@@ -17,7 +17,7 @@
 }
 
-float texture_glyph::get_kerning( const uint16 charcode )
+float texture_glyph::get_kerning( const uint16 other )
 {
-	auto i = kerning.find( charcode );
+	auto i = kerning.find( other );
 	return i != kerning.end() ? i->second : 0.0f;
 }
@@ -118,6 +118,7 @@
 	} 
 
-	for ( char c : codes )
+	for ( char ch : codes )
 	{
+		uint16 c = static_cast<uint16>( ch );
 		FT_UInt glyph_index = FT_Get_Char_Index( face, c ); 
 		FT_Error error = FT_Load_Glyph( face, glyph_index, flags ); 
@@ -136,5 +137,5 @@
 		int ft_glyph_top    = slot->bitmap_top;
 		int ft_glyph_left   = slot->bitmap_left;
-		int reg_width       = ft_bitmap_width / (depth > 3 ? 3 : depth);
+		int reg_width       = ft_bitmap_width / (depth > 3 ? 3 : (int)depth);
 
 		glm::ivec2 gsize( reg_width + 1, ft_bitmap_rows + 1 ); 
Index: trunk/src/gl/gl_context.cc
===================================================================
--- trunk/src/gl/gl_context.cc	(revision 120)
+++ trunk/src/gl/gl_context.cc	(revision 121)
@@ -83,5 +83,5 @@
 }
 
-void gl_context::apply_stencil_face( int face, stencil_test_face& stencil, const stencil_test_face& new_stencil )
+void gl_context::apply_stencil_face( unsigned face, stencil_test_face& stencil, const stencil_test_face& new_stencil )
 {
 	if (( stencil.op_fail       != new_stencil.op_fail       ) ||
@@ -317,5 +317,5 @@
 }
 
-void gl_context::force_apply_stencil_face( int face, const stencil_test_face& stencil )
+void gl_context::force_apply_stencil_face( unsigned face, const stencil_test_face& stencil )
 {
 	glStencilOpSeparate( face,
@@ -356,5 +356,5 @@
 }
 
-void gl_context::draw( primitive prim, const render_state& rs, program* p, vertex_array* va, int count )
+void gl_context::draw( primitive prim, const render_state& rs, program* p, vertex_array* va, size_t count )
 {
 	apply_render_state( rs );
@@ -365,9 +365,9 @@
 		if ( va->has_index_buffer() )
 		{
-			glDrawElements( primitive_to_enum(prim), count, datatype_to_gl_enum( va->get_index_buffer_type() ), 0 );
+			glDrawElements( primitive_to_enum(prim), static_cast<GLsizei>( count ), datatype_to_gl_enum( va->get_index_buffer_type() ), 0 );
 		}
 		else
 		{
-			glDrawArrays( primitive_to_enum(prim), 0, count);
+			glDrawArrays( primitive_to_enum(prim), 0, static_cast<GLsizei>( count ) );
 		}
 		va->unbind();
Index: trunk/src/gl/gl_device.cc
===================================================================
--- trunk/src/gl/gl_device.cc	(revision 120)
+++ trunk/src/gl/gl_device.cc	(revision 121)
@@ -53,10 +53,10 @@
 }
 
-vertex_buffer* gl_device::create_vertex_buffer( buffer_hint hint, int size, void* source /*= nullptr */ )
+vertex_buffer* gl_device::create_vertex_buffer( buffer_hint hint, size_t size, void* source /*= nullptr */ )
 {
 	return new gl_vertex_buffer( hint, size, source );
 }
 
-index_buffer* gl_device::create_index_buffer( buffer_hint hint, int size, void* source /*= nullptr */ )
+index_buffer* gl_device::create_index_buffer( buffer_hint hint, size_t size, void* source /*= nullptr */ )
 {
 	return new gl_index_buffer( hint, size, source );
Index: trunk/src/gl/gl_enum.cc
===================================================================
--- trunk/src/gl/gl_enum.cc	(revision 120)
+++ trunk/src/gl/gl_enum.cc	(revision 121)
@@ -30,5 +30,5 @@
 	case depth_test::GREATER_OR_EQUAL : return GL_GEQUAL;
 	case depth_test::ALWAYS           : return GL_ALWAYS;
-	default : return 0; // TODO: throw!
+	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
 }
@@ -53,5 +53,5 @@
 	case blending::ONE_MINUS_CONSTANT_ALPHA: return GL_ONE_MINUS_CONSTANT_ALPHA;
 	case blending::SRC_ALPHA_SATURATE      : return GL_SRC_ALPHA_SATURATE;
-	default : return 0; // TODO: throw!
+	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
 }
@@ -66,5 +66,5 @@
 	case blending::MINIMUM          : return GL_MIN;
 	case blending::MAXIMUM          : return GL_MAX;
-	default : return 0; // TODO: throw!
+	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
 }
@@ -77,5 +77,5 @@
 	case culling::BACK           : return GL_BACK;
 	case culling::FRONT_AND_BACK : return GL_FRONT_AND_BACK;
-	default : return 0; // TODO: throw!
+	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
 }
@@ -87,5 +87,5 @@
 	case culling::CW   : return GL_CW;
 	case culling::CCW  : return GL_CCW;
-	default : return 0; // TODO: throw!
+	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
 }
@@ -103,5 +103,5 @@
 	case stencil_test_face::GREATER_OR_EQUAL : return GL_GEQUAL;
 	case stencil_test_face::ALWAYS           : return GL_ALWAYS;
-	default : return 0; // TODO: throw!
+	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
 }
@@ -119,5 +119,5 @@
 	case stencil_test_face::INCREMENT_WRAP   : return GL_INCR_WRAP;
 	case stencil_test_face::DECREMENT_WRAP   : return GL_DECR_WRAP;
-	default : return 0; // TODO: throw!
+	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
 }
@@ -130,5 +130,5 @@
 	case STREAM_DRAW   : return GL_STREAM_DRAW;
 	case DYNAMIC_DRAW  : return GL_DYNAMIC_DRAW;
-	default : return 0; // TODO: throw!
+	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
 }
@@ -140,5 +140,5 @@
 	case RGB  : return GL_RGB;
 	case RGBA : return GL_RGBA;
-	default : return 0; // TODO: throw!
+	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
 }
@@ -154,5 +154,5 @@
 	case sampler::NEAREST_MIPMAP_LINEAR  : return GL_NEAREST_MIPMAP_LINEAR;
 	case sampler::LINEAR_MIPMAP_LINEAR   : return GL_LINEAR_MIPMAP_LINEAR;
-	default : return 0; // TODO: throw!
+	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
 }
@@ -166,5 +166,5 @@
 	case sampler::MIRRORED_REPEAT : return GL_MIRRORED_REPEAT;
 	case sampler::REPEAT          : return GL_REPEAT;
-	default : return 0; // TODO: throw!
+	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
 }
@@ -181,5 +181,5 @@
 	case TRIANGLE_STRIP : return GL_TRIANGLE_STRIP;
 	case TRIANGLE_FAN   : return GL_TRIANGLE_FAN;
-	default : return 0; // TODO: throw!
+	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
 }
@@ -209,5 +209,5 @@
 	case BYTE_VECTOR_3  : return GL_INT_VEC3;
 	case BYTE_VECTOR_4  : return GL_INT_VEC4;
-	default : return 0; // TODO: throw!
+	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
 }
Index: trunk/src/gl/gl_program.cc
===================================================================
--- trunk/src/gl/gl_program.cc	(revision 120)
+++ trunk/src/gl/gl_program.cc	(revision 121)
@@ -14,12 +14,12 @@
 using namespace nv;
 
-gl_shader::gl_shader( uint32 shader_type ) 
-	: object_id(0), shader_type( shader_type )
+gl_shader::gl_shader( uint32 sh_type ) 
+	: shader_type( sh_type ), object_id(0)
 {
 	// no op
 }
 
-gl_shader::gl_shader( uint32 shader_type, const string& shader_code )
-	: object_id(0), shader_type( shader_type )
+gl_shader::gl_shader( uint32 sh_type, const string& shader_code )
+	: shader_type( sh_type ), object_id(0)
 {
 	compile( shader_code );
@@ -140,5 +140,5 @@
 	glGetProgramiv( m_name.get_value(), GL_ACTIVE_ATTRIBUTES, &params );
 
-	for ( int i = 0; i < params; ++i )
+	for ( unsigned i = 0; i < (unsigned)params; ++i )
 	{
 		int attr_nlen;
@@ -149,5 +149,5 @@
 		glGetActiveAttrib( m_name.get_value(), i, 128, &attr_nlen, &attr_len, &attr_type, name_buffer );
 
-		string name( name_buffer, attr_nlen );
+		string name( name_buffer, size_t(attr_nlen) );
 
 		// skip built-ins
@@ -165,5 +165,5 @@
 	glGetProgramiv( m_name.get_value(), GL_ACTIVE_UNIFORMS, &params );
 
-	for ( int i = 0; i < params; ++i )
+	for ( unsigned i = 0; i < size_t(params); ++i )
 	{
 		int uni_nlen;
@@ -174,5 +174,5 @@
 		glGetActiveUniform( m_name.get_value(), i, 128, &uni_nlen, &uni_len, &uni_type, name_buffer );
 
-		string name( name_buffer, uni_nlen );
+		string name( name_buffer, size_t(uni_nlen) );
 
 		// skip built-ins
@@ -206,5 +206,5 @@
 			case FLOAT_MATRIX_3 : glUniformMatrix3fv( uloc, 1, GL_FALSE, glm::value_ptr(((uniform< enum_to_type< FLOAT_MATRIX_3 >::type >*)( ubase ))->get_value()) ); break;
 			case FLOAT_MATRIX_4 : glUniformMatrix4fv( uloc, 1, GL_FALSE, glm::value_ptr(((uniform< enum_to_type< FLOAT_MATRIX_4 >::type >*)( ubase ))->get_value()) ); break;
-			//default     : error?
+			default : break; // error?
 			}
 			ubase->clean();
Index: trunk/src/gl/gl_texture2d.cc
===================================================================
--- trunk/src/gl/gl_texture2d.cc	(revision 120)
+++ trunk/src/gl/gl_texture2d.cc	(revision 121)
@@ -15,8 +15,8 @@
 	glBindTexture( GL_TEXTURE_2D, m_name.get_value() );
 
-	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nv::sampler_filter_to_enum( m_sampler.filter_min ) );
-	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nv::sampler_filter_to_enum( m_sampler.filter_max ) );
-	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, nv::sampler_wrap_to_enum( m_sampler.wrap_s) );
-	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, nv::sampler_wrap_to_enum( m_sampler.wrap_t) );
+	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (int)nv::sampler_filter_to_enum( m_sampler.filter_min ) );
+	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (int)nv::sampler_filter_to_enum( m_sampler.filter_max ) );
+	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (int)nv::sampler_wrap_to_enum( m_sampler.wrap_s) );
+	glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (int)nv::sampler_wrap_to_enum( m_sampler.wrap_t) );
 
 	glBindTexture( GL_TEXTURE_2D, 0 );
@@ -31,9 +31,9 @@
 {
 	glBindTexture( GL_TEXTURE_2D, m_name.get_value() );
-	glTexImage2D( GL_TEXTURE_2D, 0, nv::image_format_to_enum(m_format), m_size.x, m_size.y, 0, nv::image_format_to_enum(m_format), nv::datatype_to_gl_enum(m_datatype), data );
+	glTexImage2D( GL_TEXTURE_2D, 0, (GLint)nv::image_format_to_enum(m_format), m_size.x, m_size.y, 0, nv::image_format_to_enum(m_format), nv::datatype_to_gl_enum(m_datatype), data );
 	glBindTexture( GL_TEXTURE_2D, 0 );
 }
 
-void nv::gl_texture2d::bind( int slot )
+void nv::gl_texture2d::bind( size_t slot )
 {
 	glActiveTexture( GL_TEXTURE0 + slot );
Index: trunk/src/gl/gl_vertex_buffer.cc
===================================================================
--- trunk/src/gl/gl_vertex_buffer.cc	(revision 120)
+++ trunk/src/gl/gl_vertex_buffer.cc	(revision 121)
@@ -10,15 +10,15 @@
 using namespace nv;
 
-gl_vertex_buffer::gl_vertex_buffer( buffer_hint hint, int size, void* data ) 
+gl_vertex_buffer::gl_vertex_buffer( buffer_hint hint, size_t size, void* data ) 
 	: vertex_buffer( hint, size ), m_name()
 {
 	bind();
-	glBufferData( GL_ARRAY_BUFFER, m_size, data, buffer_hint_to_enum( m_hint ) );
+	glBufferData( GL_ARRAY_BUFFER, (GLsizeiptr)m_size, data, buffer_hint_to_enum( m_hint ) );
 	unbind();
 }
 
-void gl_vertex_buffer::update( void* data, int offset, int size )
+void gl_vertex_buffer::update( void* data, size_t offset, size_t size )
 {
-	glBufferSubData( GL_ARRAY_BUFFER, offset, size, data );
+	glBufferSubData( GL_ARRAY_BUFFER, (GLintptr)offset, (GLsizeiptr)size, data );
 }
 
@@ -39,15 +39,15 @@
 }
 
-gl_index_buffer::gl_index_buffer( buffer_hint hint, int size, void* data ) 
+gl_index_buffer::gl_index_buffer( buffer_hint hint, size_t size, void* data ) 
 	: index_buffer( hint, size ), m_name()
 {
 	bind();
-	glBufferData( GL_ELEMENT_ARRAY_BUFFER, m_size, data, buffer_hint_to_enum( m_hint ) );
+	glBufferData( GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)m_size, data, buffer_hint_to_enum( m_hint ) );
 	unbind();
 }
 
-void gl_index_buffer::update( void* data, int offset, int size )
+void gl_index_buffer::update( void* data, size_t offset, size_t size )
 {
-	glBufferSubData( GL_ELEMENT_ARRAY_BUFFER, offset, size, data );
+	glBufferSubData( GL_ELEMENT_ARRAY_BUFFER, (GLintptr)offset, (GLsizeiptr)size, data );
 }
 
@@ -76,5 +76,5 @@
 	for ( vertex_buffer_attribute_map::iterator i = m_map.begin(); 	i != m_map.end(); ++i ) 
 	{
-		int location                = i->first;
+		uint32 location             = static_cast<uint32>( i->first );
 		vertex_buffer_attribute* va = i->second;
 		vertex_buffer*           vb = va->get_buffer();
@@ -83,8 +83,8 @@
 		glVertexAttribPointer( 
 			location, 
-			va->get_components(), 
+			static_cast<GLint>( va->get_components() ), 
 			nv::datatype_to_gl_enum( va->get_datatype() ),
 			GL_FALSE,
-			va->get_stride(),
+			static_cast<GLsizei>( va->get_stride() ),
 			(void*)va->get_offset()
 			);
@@ -107,5 +107,5 @@
 	for ( vertex_buffer_attribute_map::iterator i = m_map.begin(); 	i != m_map.end(); ++i ) 
 	{
-		glDisableVertexAttribArray( i->first );
+		glDisableVertexAttribArray( static_cast<uint32>( i->first ) );
 	}
 }
Index: trunk/src/gl/gl_window.cc
===================================================================
--- trunk/src/gl/gl_window.cc	(revision 120)
+++ trunk/src/gl/gl_window.cc	(revision 121)
@@ -21,5 +21,5 @@
 	if (ke.keysym.unicode >= 32 && ke.keysym.unicode < 128 )
 	{
-		kevent.key.ascii = (char)ke.keysym.unicode;
+		kevent.key.ascii = static_cast<char8>( ke.keysym.unicode );
 	}
 
@@ -151,5 +151,5 @@
 	: m_device( dev ), m_width( width ), m_height( height ), m_title("NV Engine"), m_screen( nullptr )
 {
-	int flags = SDL_OPENGL;
+	uint32 flags = SDL_OPENGL;
 	
 	m_screen = SDL_SetVideoMode( width, height, 32, flags );
Index: trunk/src/gui/gui_style.cc
===================================================================
--- trunk/src/gui/gui_style.cc	(revision 120)
+++ trunk/src/gui/gui_style.cc	(revision 121)
@@ -36,5 +36,5 @@
 	for (size_t i = 0; i < 4; ++i )
 	{
-		lua_rawgeti( m_lua, -1, i+1 );
+		lua_rawgeti( m_lua, -1, static_cast<int>( i+1 ) );
 		if ( lua_isnil( m_lua, -1 ) ) return true;
 		vec[i] = (float)lua_tonumber( m_lua, -1 );
Index: trunk/src/io_event.cc
===================================================================
--- trunk/src/io_event.cc	(revision 120)
+++ trunk/src/io_event.cc	(revision 121)
@@ -9,5 +9,5 @@
 using namespace nv;
 
-const char* get_key_name( key_code key )
+const char* nv::get_key_name( key_code key )
 {
 	switch ( key )
@@ -16,9 +16,9 @@
 #		include <nv/detail/key_list.inc>
 #	undef NV_KEY
-default: return "KEY_UNKNOWN";
+	NV_RETURN_COVERED_DEFAULT( "KEY_UNKNOWN" );
 	};
 }
 
-const char* get_mouse_name( mouse_code button )
+const char* nv::get_mouse_name( mouse_code button )
 {
 	switch ( button )
@@ -27,9 +27,9 @@
 #		include <nv/detail/mouse_list.inc>
 #	undef NV_MOUSE
-default: return "MOUSE_UNKNOWN";
+	NV_RETURN_COVERED_DEFAULT( "MOUSE_UNKNOWN" );
 	};
 }
 
-const char* get_io_event_name( io_event_code event )
+const char* nv::get_io_event_name( io_event_code event )
 {
 	switch ( event )
@@ -38,9 +38,9 @@
 #		include <nv/detail/io_event_list.inc>
 #	undef NV_IO_EVENT
-default: return "EV_UNKNOWN";
+	NV_RETURN_COVERED_DEFAULT( "EV_UNKNOWN" );
 	};
 }
 
-void register_io_types( type_database* db )
+void nv::register_io_types( type_database* db )
 {
 	type_enum key_enums[] = {
Index: trunk/src/library.cc
===================================================================
--- trunk/src/library.cc	(revision 120)
+++ trunk/src/library.cc	(revision 121)
@@ -37,5 +37,5 @@
 
 library::library() 
-    : m_name(), m_handle( nullptr )
+    : m_handle( nullptr ), m_name()
 {
 }
Index: trunk/src/logger.cc
===================================================================
--- trunk/src/logger.cc	(revision 120)
+++ trunk/src/logger.cc	(revision 121)
@@ -21,5 +21,5 @@
 
 // log level names
-const char *log_level_names[] =
+static const char *log_level_names[] =
 {
 	"NONE",
@@ -37,5 +37,5 @@
 
 // log level names
-const char *log_level_names_pad[] =
+static const char *log_level_names_pad[] =
 {
 	"NONE    ",
@@ -57,5 +57,5 @@
 
 #if NV_PLATFORM == NV_WINDOWS 
-unsigned short log_color[] =
+static unsigned short log_color[] =
 {
 	FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY,
@@ -72,5 +72,5 @@
 };
 #else
-const char *log_color[] =
+static const char *log_color[] =
 {
 	"\33[37;1m",
Index: trunk/src/lua/lua_glm.cc
===================================================================
--- trunk/src/lua/lua_glm.cc	(revision 120)
+++ trunk/src/lua/lua_glm.cc	(revision 121)
@@ -12,5 +12,5 @@
 static size_t nlua_swizzel_lookup[256];
 
-inline bool nlua_is_swizzel( const char* str, size_t max )
+inline bool nlua_is_swizzel( const unsigned char* str, size_t max )
 {
 	while (*str)
@@ -24,5 +24,5 @@
 template < typename T, size_t k >
 struct nlua_vec_constructor {
-	static inline T construct( lua_State* L, int index ) {
+	static inline T construct( lua_State*, int ) {
 		return T();
 	}
@@ -202,5 +202,5 @@
 	size_t len  = 0;
 	size_t vlen = v->length();
-	const char * key = lua_tolstring( L, 2, &len );
+	const unsigned char * key = (const unsigned char *)( lua_tolstring( L, 2, &len ) );
 	size_t idx = 255;
 
@@ -240,5 +240,5 @@
 	size_t len  = 0;
 	size_t vlen = v->length();
-	const char * key = lua_tolstring( L, 2, &len );
+	const unsigned char * key = (const unsigned char *)( lua_tolstring( L, 2, &len ) );
 	size_t idx = 255;
 	if( len == 1 )
@@ -321,28 +321,29 @@
 { 
 	for (size_t i = 0; i < 256; ++i ) nlua_swizzel_lookup[i] = 255;
-	nlua_swizzel_lookup['x'] = 0;
-	nlua_swizzel_lookup['r'] = 0;
-	nlua_swizzel_lookup['s'] = 0;
-	nlua_swizzel_lookup['0'] = 0;
-	nlua_swizzel_lookup['y'] = 1;
-	nlua_swizzel_lookup['g'] = 1;
-	nlua_swizzel_lookup['t'] = 0;
-	nlua_swizzel_lookup['1'] = 1;
-	nlua_swizzel_lookup['z'] = 2;
-	nlua_swizzel_lookup['b'] = 2;
-	nlua_swizzel_lookup['u'] = 0;
-	nlua_swizzel_lookup['2'] = 2;
-	nlua_swizzel_lookup['w'] = 3;
-	nlua_swizzel_lookup['a'] = 3;
-	nlua_swizzel_lookup['v'] = 0;
-	nlua_swizzel_lookup['3'] = 3;
+	using nv::char8;
+	nlua_swizzel_lookup[char8( 'x' )] = 0;
+	nlua_swizzel_lookup[char8( 'r' )] = 0;
+	nlua_swizzel_lookup[char8( 's' )] = 0;
+	nlua_swizzel_lookup[char8( '0' )] = 0;
+	nlua_swizzel_lookup[char8( 'y' )] = 1;
+	nlua_swizzel_lookup[char8( 'g' )] = 1;
+	nlua_swizzel_lookup[char8( 't' )] = 0;
+	nlua_swizzel_lookup[char8( '1' )] = 1;
+	nlua_swizzel_lookup[char8( 'z' )] = 2;
+	nlua_swizzel_lookup[char8( 'b' )] = 2;
+	nlua_swizzel_lookup[char8( 'u' )] = 0;
+	nlua_swizzel_lookup[char8( '2' )] = 2;
+	nlua_swizzel_lookup[char8( 'w' )] = 3;
+	nlua_swizzel_lookup[char8( 'a' )] = 3;
+	nlua_swizzel_lookup[char8( 'v' )] = 0;
+	nlua_swizzel_lookup[char8( '3' )] = 3;
 	int stack = lua_gettop( L );
 
-	luaL_requiref(L, "ivec2", luaopen_vec<glm::ivec2>, 1);
-	luaL_requiref(L, "ivec3", luaopen_vec<glm::ivec3>, 1);
-	luaL_requiref(L, "ivec4", luaopen_vec<glm::ivec4>, 1);
-	luaL_requiref(L, "vec2", luaopen_vec<glm::vec2>, 1);
-	luaL_requiref(L, "vec3", luaopen_vec<glm::vec3>, 1);
-	luaL_requiref(L, "vec4", luaopen_vec<glm::vec4>, 1);
+	luaL_requiref(L, "ivec2", luaopen_vec<nv::ivec2>, 1);
+	luaL_requiref(L, "ivec3", luaopen_vec<nv::ivec3>, 1);
+	luaL_requiref(L, "ivec4", luaopen_vec<nv::ivec4>, 1);
+	luaL_requiref(L, "vec2", luaopen_vec<nv::vec2>, 1);
+	luaL_requiref(L, "vec3", luaopen_vec<nv::vec3>, 1);
+	luaL_requiref(L, "vec4", luaopen_vec<nv::vec4>, 1);
 	lua_settop( L, stack );
 }
Index: trunk/src/lua/lua_raw.cc
===================================================================
--- trunk/src/lua/lua_raw.cc	(revision 120)
+++ trunk/src/lua/lua_raw.cc	(revision 121)
@@ -30,5 +30,5 @@
 {
 	index = lua_absindex( L, index );
-	int len = lua_rawlen( L, index );
+	int len = static_cast<int>( lua_rawlen( L, index ) );
 	int i   = len;
 	lua_createtable( L, len, 0 );
Index: trunk/src/lua/lua_state.cc
===================================================================
--- trunk/src/lua/lua_state.cc	(revision 120)
+++ trunk/src/lua/lua_state.cc	(revision 121)
@@ -15,12 +15,12 @@
 using namespace nv;
 
-lua::stack_guard::stack_guard( lua::state* L )
-	: L(L), m_level( lua_gettop(L->L) )
-{
-
-}
-
-lua::stack_guard::stack_guard( lua::state& L )
-	: L(&L), m_level( lua_gettop((&L)->L) )
+lua::stack_guard::stack_guard( lua::state* aL )
+	: L(aL), m_level( lua_gettop(aL->L) )
+{
+
+}
+
+lua::stack_guard::stack_guard( lua::state& aL )
+	: L(&aL), m_level( lua_gettop(aL.L) )
 {
 
Index: trunk/src/time.cc
===================================================================
--- trunk/src/time.cc	(revision 120)
+++ trunk/src/time.cc	(revision 121)
@@ -42,14 +42,12 @@
 static timer_impl zero_timer;
 
-volatile nv::uint64 nv::get_ticks()
+nv::uint64 nv::get_ticks()
 {
 #if NV_COMPILER == NV_MSVC
 	return __rdtsc();
-#elif NV_COMPILER == NV_GNUC
-	register long long ticks asm("eax");
+#else
+	register long long ticks asm("eax") = 0;
 	asm volatile (".byte 15, 49" : : : "eax", "edx");
-	return ticks;
-#else
-	return 0; // unsupported
+	return static_cast<nv::uint64>( ticks );
 #endif
 }
@@ -59,7 +57,6 @@
 #if NV_COMPILER == NV_MSVC
 	Sleep( ms );
-#elif NV_COMPILER == NV_GNUC
+#else
 	usleep( ms * 1000 );
-#else
 #endif
 }
@@ -85,5 +82,5 @@
 	struct timeval now;
 	gettimeofday(&now, NULL);
-	return (now.tv_sec - zero_timer.timeval_zero.tv_sec)*1000+(now.tv_usec-zero_timer.timeval_zero.tv_usec)/1000;
+	return (uint32)( (now.tv_sec - zero_timer.timeval_zero.tv_sec)*1000+(now.tv_usec-zero_timer.timeval_zero.tv_usec)/1000 );
 #endif
 }
@@ -99,5 +96,5 @@
 	struct timeval now;
 	gettimeofday(&now, NULL);
-	return (now.tv_sec - zero_timer.timeval_zero.tv_sec)*1000000+(now.tv_usec - zero_timer.timeval_zero.tv_usec);
+	return (uint32)( (now.tv_sec - zero_timer.timeval_zero.tv_sec)*1000000+(now.tv_usec - zero_timer.timeval_zero.tv_usec) );
 #endif
 }
