Index: trunk/nv/core/handle.hh
===================================================================
--- trunk/nv/core/handle.hh	(revision 363)
+++ trunk/nv/core/handle.hh	(revision 364)
@@ -67,9 +67,10 @@
 	};
 
-	template < typename HANDLE >
+	template < typename HANDLE, typename INDEX = sint32 >
 	class handle_manager
 	{
-		static const sint32 NONE = -1;
-		static const sint32 USED = -2;
+		typedef INDEX index_type;
+		static const index_type NONE = index_type(-1);
+		static const index_type USED = index_type(-2);
 	public:
 
@@ -98,9 +99,9 @@
 			if ( m_last_free == NONE )
 			{
-				m_first_free = m_last_free = index;
+				m_first_free = m_last_free = (index_type)index;
 				return;
 			}
-			m_entries[(unsigned)m_last_free].next_free = index;
-			m_last_free = index;
+			m_entries[(value_type)m_last_free].next_free = (index_type)index;
+			m_last_free = (index_type)index;
 		}
 
@@ -118,5 +119,5 @@
 		{
 			value_type counter;
-			sint32     next_free;
+			index_type next_free;
 
 			index_entry() : counter( 0 ), next_free( NONE ) {}
@@ -137,6 +138,6 @@
 		}
 
-		sint32 m_first_free;
-		sint32 m_last_free;
+		index_type m_first_free;
+		index_type m_last_free;
 		std::vector< index_entry > m_entries;
 	};
Index: trunk/nv/core/string.hh
===================================================================
--- trunk/nv/core/string.hh	(revision 363)
+++ trunk/nv/core/string.hh	(revision 364)
@@ -328,6 +328,6 @@
 		}
 
-		inline NV_CONSTEXPR const char front()  const { return m_data[0]; }
-		inline NV_CONSTEXPR const char back()   const { return m_data[m_size - 1]; }
+		inline NV_CONSTEXPR char front()  const { return m_data[0]; }
+		inline NV_CONSTEXPR char back()   const { return m_data[m_size - 1]; }
 		inline NV_CONSTEXPR const char* data()  const { return m_data; }
 
@@ -351,24 +351,24 @@
 		{
 			if ( pos >= m_size ) return npos;
-			const_iterator it = std::search( this->cbegin() + pos, this->cend(), s.cbegin(), s.cend() );
-			return it == this->cend() ? npos : std::distance( this->cbegin(), it );
+			const_iterator it = std::search( this->cbegin() + ( difference_type ) pos, this->cend(), s.cbegin(), s.cend() );
+			return it == this->cend() ? npos : ( size_type )std::distance( this->cbegin(), it );
 		}
 		size_type find( char c, size_type pos = 0 ) const
 		{
 			if ( pos >= m_size ) return npos;
-			const_iterator it = std::find_if( this->cbegin() + pos, this->cend(), [=] ( char val ) { return val == c; } );
-			return it == this->cend() ? npos : std::distance( this->cbegin(), it );
+			const_iterator it = std::find_if( this->cbegin() + ( difference_type ) pos, this->cend(), [=] ( char val ) { return val == c; } );
+			return it == this->cend() ? npos : ( size_type )std::distance( this->cbegin(), it );
 		}
 		size_type rfind( const string_base& s, size_type pos = 0 ) const
 		{
 			if ( pos >= m_size ) return npos;
-			const_reverse_iterator it = std::search( this->crbegin() + pos, this->crend(), s.crbegin(), s.crend() );
-			return it == this->crend() ? npos : m_size - 1 - std::distance( this->crbegin(), it );
+			const_reverse_iterator it = std::search( this->crbegin() + ( difference_type ) pos, this->crend(), s.crbegin(), s.crend() );
+			return it == this->crend() ? npos : m_size - 1 - ( size_type )std::distance( this->crbegin(), it );
 		}
 		size_type rfind( char c, size_type pos = 0 ) const
 		{
 			if ( pos >= m_size ) return npos;
-			const_reverse_iterator it = std::find_if( this->crbegin() + pos, this->crend(), [=] ( char val ) { return val == c; } );
-			return it == this->crend() ? npos : m_size - 1 - std::distance( this->crbegin(), it );
+			const_reverse_iterator it = std::find_if( this->crbegin() + ( difference_type ) pos, this->crend(), [=] ( char val ) { return val == c; } );
+			return it == this->crend() ? npos : m_size - 1 - ( size_type )std::distance( this->crbegin(), it );
 		}
 		size_type find_first_of( char c ) const { return find( c ); }
@@ -376,5 +376,5 @@
 		{
 			const_iterator it = std::find_first_of( this->cbegin(), this->cend(), s.cbegin(), s.cend() );
-			return it == this->cend() ? npos : std::distance( this->cbegin(), it );
+			return it == this->cend() ? npos : ( size_type )std::distance( this->cbegin(), it );
 		}
 		size_type find_last_of( char c )  const { return rfind( c ); }
@@ -382,5 +382,5 @@
 		{
 			const_reverse_iterator it = std::find_first_of( this->crbegin(), this->crend(), s.cbegin(), s.cend() );
-			return it == this->crend() ? npos : m_size - 1 - std::distance( this->crbegin(), it );
+			return it == this->crend() ? npos : m_size - 1 - ( size_type )std::distance( this->crbegin(), it );
 		}
 		size_type find_first_not_of( const string_base& s ) const
@@ -388,5 +388,5 @@
 			for ( const_iterator it = this->cbegin(); it != this->cend(); ++it )
 				if ( 0 == std::memchr( s.m_data, *it, s.m_size ) )
-					return std::distance( this->cbegin(), it );
+					return ( size_type )std::distance( this->cbegin(), it );
 			return npos;
 		}
@@ -395,5 +395,5 @@
 			for ( const_iterator it = this->cbegin(); it != this->cend(); ++it )
 				if ( c != *it )
-					return std::distance( this->cbegin(), it );
+					return ( size_type )std::distance( this->cbegin(), it );
 			return npos;
 		}
@@ -402,5 +402,5 @@
 			for ( const_reverse_iterator it = this->crbegin(); it != this->crend(); ++it )
 				if ( 0 == std::memchr( s.m_data, *it, s.m_size ) )
-					return m_size - 1 - std::distance( this->crbegin(), it );;
+					return m_size - 1 - ( size_type )std::distance( this->crbegin(), it );;
 			return npos;
 		}
@@ -409,5 +409,5 @@
 			for ( const_reverse_iterator it = this->crbegin(); it != this->crend(); ++it )
 				if ( c != *it )
-					return m_size - 1 - std::distance( this->crbegin(), it );
+					return m_size - 1 - ( size_type )std::distance( this->crbegin(), it );
 			return npos;
 		}
@@ -618,5 +618,5 @@
 		if ( os.good() )
 		{
-			os.write( str.data(), str.size() );
+			os.write( str.data(), static_cast<std::streamsize>( str.size() ) );
 		}
 		return os;
Index: trunk/nv/engine/program_manager.hh
===================================================================
--- trunk/nv/engine/program_manager.hh	(revision 363)
+++ trunk/nv/engine/program_manager.hh	(revision 364)
@@ -24,6 +24,6 @@
 	public:
 		program_manager( context* a_context );
-		virtual const char* get_storage_name() const { return "programs"; }
-		virtual const char* get_resource_name() const { return "program"; }
+		virtual string_ref get_storage_name() const { return "programs"; }
+		virtual string_ref get_resource_name() const { return "program"; }
 	protected:
 		virtual resource_id load_resource( lua::table_guard& table );
Index: trunk/nv/engine/resource_system.hh
===================================================================
--- trunk/nv/engine/resource_system.hh	(revision 363)
+++ trunk/nv/engine/resource_system.hh	(revision 364)
@@ -32,6 +32,6 @@
 		resource_manager_base() : m_lua( nullptr ) {}
 		void initialize( lua::state* state );
-		virtual const char* get_storage_name() const = 0;
-		virtual const char* get_resource_name() const = 0;
+		virtual string_ref get_storage_name() const = 0;
+		virtual string_ref get_resource_name() const = 0;
 		virtual void clear() { m_names.clear(); }
 		void load_all();
Index: trunk/nv/gl/gl_window.hh
===================================================================
--- trunk/nv/gl/gl_window.hh	(revision 363)
+++ trunk/nv/gl/gl_window.hh	(revision 364)
@@ -32,5 +32,5 @@
 		virtual string get_title() const  { return std::string(); }
 		// TODO : implement?
-		virtual void set_swap_control( bool ) {};
+		virtual void set_swap_control( bool ) {}
 
 		virtual bool is_event_pending()            { return m_input->is_event_pending(); }
Index: trunk/nv/interface/input.hh
===================================================================
--- trunk/nv/interface/input.hh	(revision 363)
+++ trunk/nv/interface/input.hh	(revision 364)
@@ -24,5 +24,5 @@
 		virtual bool is_event_pending() = 0;
 		virtual bool poll_event( io_event& event ) = 0;
-		virtual ~input() {};
+		virtual ~input() {}
 	};
 
Index: trunk/nv/interface/window_manager.hh
===================================================================
--- trunk/nv/interface/window_manager.hh	(revision 363)
+++ trunk/nv/interface/window_manager.hh	(revision 364)
@@ -30,4 +30,5 @@
 		virtual void sleep( uint32 ms ) = 0;
 		virtual uint32 get_ticks() = 0;
+		virtual ~window_manager() {}
 	};
 
Index: trunk/nv/lua/lua_handle.hh
===================================================================
--- trunk/nv/lua/lua_handle.hh	(revision 363)
+++ trunk/nv/lua/lua_handle.hh	(revision 364)
@@ -68,5 +68,5 @@
 		{
 			typedef handle_operator<H> hop; 
-			detail::handle_struct h = detail::to_handle_impl( L, index, hop::get_index( handle ), hop::get_counter( handle ) );
+			detail::handle_struct h = detail::to_handle_impl( L, index, hop::get_index( def ), hop::get_counter( def ) );
 			return hop::create( h.index, h.counter );
 		};
Index: trunk/src/engine/resource_system.cc
===================================================================
--- trunk/src/engine/resource_system.cc	(revision 363)
+++ trunk/src/engine/resource_system.cc	(revision 364)
@@ -12,8 +12,5 @@
 {
 	m_lua = a_lua_state;
-	std::string constructor_name( get_resource_name() );
-	constructor_name = "register_"+constructor_name;
-	int correct = 0;
-	lua::register_storage( m_lua, get_storage_name(), constructor_name );
+	lua::register_storage( m_lua, get_storage_name(), "register_" + get_resource_name().to_string() );
 }
 
Index: trunk/src/gl/gl_context.cc
===================================================================
--- trunk/src/gl/gl_context.cc	(revision 363)
+++ trunk/src/gl/gl_context.cc	(revision 364)
@@ -734,5 +734,5 @@
 		if ( slots[i] > OUTPUT_7 ) buffers[i] = 0;
 	}
-	glDrawBuffers( count, buffers );
+	glDrawBuffers( (GLsizei)count, buffers );
 }
 
Index: trunk/src/gl/gl_device.cc
===================================================================
--- trunk/src/gl/gl_device.cc	(revision 363)
+++ trunk/src/gl/gl_device.cc	(revision 364)
@@ -56,5 +56,5 @@
 {
 	load_sdl_image_library();
-	SDL_Surface* image = IMG_LoadTyped_RW( SDL_RWFromMem( (void*)data, size ), 1, "tga" );
+	SDL_Surface* image = IMG_LoadTyped_RW( SDL_RWFromMem( (void*)data, (int)size ), 1, "png" );
 	if ( !image )
 	{
@@ -402,5 +402,5 @@
 
 	const char* pc = shader_code.data();
-	int l = shader_code.length();
+	int l = (int)shader_code.length();
 
 	glShaderSource( glid, 1, &pc, &l );
Index: trunk/src/gui/gui_ascii_renderer.cc
===================================================================
--- trunk/src/gui/gui_ascii_renderer.cc	(revision 363)
+++ trunk/src/gui/gui_ascii_renderer.cc	(revision 364)
@@ -80,18 +80,18 @@
 		for ( int x = 0; x < abs.get_width(); ++x )
 		{
-			m_terminal->print( position( abs.ul.y, abs.ul.x + x ), er->border_color, er->border_chars[0] );
-			m_terminal->print( position( abs.lr.y, abs.ul.x + x ), er->border_color, er->border_chars[1] );
+			m_terminal->print( position( abs.ul.y, abs.ul.x + x ), er->border_color, (unsigned char)er->border_chars[0] );
+			m_terminal->print( position( abs.lr.y, abs.ul.x + x ), er->border_color, (unsigned char)er->border_chars[1] );
 		}
 
 		for ( int y = 0; y < abs.get_height(); ++y )
 		{
-			m_terminal->print( position( abs.ul.y + y, abs.ul.x ), er->border_color, er->border_chars[2] );
-			m_terminal->print( position( abs.ul.y + y, abs.lr.x ), er->border_color, er->border_chars[3] );
+			m_terminal->print( position( abs.ul.y + y, abs.ul.x ), er->border_color, (unsigned char)er->border_chars[2] );
+			m_terminal->print( position( abs.ul.y + y, abs.lr.x ), er->border_color, (unsigned char)er->border_chars[3] );
 		}
 
-		m_terminal->print( abs.ul,   er->border_color, er->border_chars[4] );
-		m_terminal->print( abs.ur(), er->border_color, er->border_chars[5] );
-		m_terminal->print( abs.ll(), er->border_color, er->border_chars[6] );
-		m_terminal->print( abs.lr,   er->border_color, er->border_chars[7] );
+		m_terminal->print( abs.ul,   er->border_color, (unsigned char)er->border_chars[4] );
+		m_terminal->print( abs.ur(), er->border_color, (unsigned char)er->border_chars[5] );
+		m_terminal->print( abs.ll(), er->border_color, (unsigned char)er->border_chars[6] );
+		m_terminal->print( abs.lr,   er->border_color, (unsigned char)er->border_chars[7] );
 	}
 	if ( !e->m_text.empty() )
@@ -100,5 +100,5 @@
 		for ( char c : e->m_text )
 		{
-			m_terminal->print( p, er->text_color, c );
+			m_terminal->print( p, er->text_color, (unsigned char)c );
 			++p.x;
 		}
@@ -111,14 +111,16 @@
 }
 
-void nv::gui::ascii_renderer::on_hover_change( element* e, bool hover )
+void nv::gui::ascii_renderer::on_hover_change( element* e, bool /*hover*/ )
 {
 	// TODO: FIX
+	int fix_me;
 	NV_LOG( nv::LOG_DEBUG, "on_hover_change" );
 	e->m_flags[DIRTY] = true;
 }
 
-void nv::gui::ascii_renderer::on_select_change( element* e, bool select )
+void nv::gui::ascii_renderer::on_select_change( element* e, bool /*select*/ )
 {
 	// TODO: FIX
+	int fix_me;
 	NV_LOG( nv::LOG_DEBUG, "on_select_change" );
 	e->m_flags[DIRTY] = true;
Index: trunk/src/gui/gui_gfx_renderer.cc
===================================================================
--- trunk/src/gui/gui_gfx_renderer.cc	(revision 363)
+++ trunk/src/gui/gui_gfx_renderer.cc	(revision 364)
@@ -266,5 +266,5 @@
 				vec2 tsize32 = ( image->t2 - image->t1 ) * ( 2.0f / 3.0f );
 				vec2 tsizex = vec2( tsize.x, 0.0f );
-				vec2 tsizey = vec2( 0.0f, tsize.y );
+				//vec2 tsizey = vec2( 0.0f, tsize.y );
 				vec2 tsize3x = vec2( tsize3.x, 0.0f );
 				vec2 tsize3y = vec2( 0.0f, tsize3.y );
@@ -343,14 +343,16 @@
 }
 
-void gfx_renderer::on_hover_change( element* e, bool hover )
+void gfx_renderer::on_hover_change( element* e, bool /*hover*/ )
 {
 	// TODO: FIX
+	int fix_me;
 	NV_LOG( nv::LOG_DEBUG, "on_hover_change" );
 	e->m_flags[DIRTY] = true;
 }
 
-void gfx_renderer::on_select_change( element* e, bool select )
+void gfx_renderer::on_select_change( element* e, bool /*select*/ )
 {
 	// TODO: FIX
+	int fix_me;
 	NV_LOG( nv::LOG_DEBUG, "on_select_change" );
 	e->m_flags[DIRTY] = true;
Index: trunk/src/lua/lua_handle.cc
===================================================================
--- trunk/src/lua/lua_handle.cc	(revision 363)
+++ trunk/src/lua/lua_handle.cc	(revision 364)
@@ -15,5 +15,5 @@
 	NV_LUA_STACK_ASSERT( L, +1 );
 	lua_rawgeti( L, LUA_REGISTRYINDEX, pseudoindex ); // table
-	lua_rawgeti( L, -1, index );                      // table, entry
+	lua_rawgeti( L, -1, (int)index );                 // table, entry
 	if ( !lua_istable( L, -1 ) )
 	{
@@ -57,5 +57,5 @@
 	lua_rawgeti( L, LUA_REGISTRYINDEX, pseudoindex );
 	lua_insert( L, -2 );
-	lua_rawseti( L, -2, index );
+	lua_rawseti( L, -2, (int)index );
 	lua_pop( L, 1 );
 }
@@ -66,5 +66,5 @@
 	lua_rawgeti( L, LUA_REGISTRYINDEX, pseudoindex ); // table
 	lua_pushinteger( L, 0 );
-	lua_rawseti( L, -2, index );
+	lua_rawseti( L, -2, (int)index );
 	lua_pop( L, 1 );
 }
