Index: trunk/src/formats/md2_loader.cc
===================================================================
--- trunk/src/formats/md2_loader.cc	(revision 189)
+++ trunk/src/formats/md2_loader.cc	(revision 198)
@@ -17,5 +17,4 @@
 
 // assuming low-endian
-#define MD2_MAGIC         "IDP2"
 #define MD2_MAX_FRAMES    512
 #define MD2_MAX_SKINS     32
@@ -75,6 +74,6 @@
 struct md2_vertex_t
 {
-	unsigned char v[3];
-	unsigned char n;
+	uint8 v[3];
+	uint8 n;
 };
 
@@ -127,5 +126,5 @@
 }
 
-static bool read_md2_frame( md2_frame_t* frame, int vcount, nv::stream& source )
+static bool read_md2_frame( md2_frame_t* frame, unsigned vcount, nv::stream& source )
 {
 	frame->vertices = new md2_vertex_t[ vcount ];
@@ -170,14 +169,14 @@
 	
 	source.seek( md2->header.offset_skins, origin::SET );
-	source.read( md2->skins, sizeof(md2_skin_t), md2->header.num_skins );
+	source.read( md2->skins, sizeof(md2_skin_t), static_cast<size_t>( md2->header.num_skins ) );
 
 	source.seek( md2->header.offset_st, origin::SET );
-	source.read( md2->texcoords, sizeof(md2_texcoord_t), md2->header.num_st );
+	source.read( md2->texcoords, sizeof(md2_texcoord_t), static_cast<size_t>( md2->header.num_st ) );
 
 	source.seek( md2->header.offset_tris, origin::SET );
-	source.read( md2->triangles, sizeof(md2_triangle_t), md2->header.num_tris );
+	source.read( md2->triangles, sizeof(md2_triangle_t), static_cast<size_t>( md2->header.num_tris ) );
 
 	source.seek( md2->header.offset_glcmds, origin::SET);
-	source.read( md2->glcmds, sizeof(int), md2->header.num_glcmds );
+	source.read( md2->glcmds, sizeof(int), static_cast<size_t>( md2->header.num_glcmds ) );
 
 	md2->frames    = new md2_frame_t   [ md2->header.num_frames ];
@@ -185,5 +184,5 @@
 	for ( int i = 0; i < md2->header.num_frames; ++i )
 	{
-		if (!read_md2_frame( &(md2->frames[i]), md2->header.num_vertices, source ) ) return false;
+		if (!read_md2_frame( &(md2->frames[i]), static_cast<unsigned>( md2->header.num_vertices ), source ) ) return false;
 	}
 
@@ -197,5 +196,5 @@
 }
 
-static inline vec3 md2_normal( char normal )
+static inline vec3 md2_normal( uint8 normal )
 {
 	return md2_vec3( md2_normal_table[normal] );
@@ -269,7 +268,7 @@
 }
 
-sint32 md2_loader::get_max_frames() const
-{
-	return ((md2_t*)m_md2)->header.num_frames;
+size_t md2_loader::get_max_frames() const
+{
+	return static_cast< size_t >( ((md2_t*)m_md2)->header.num_frames );
 }
 
@@ -277,9 +276,9 @@
 {
 	md2_t* md2 = (md2_t*)m_md2;
-	sint32 num_frames = md2->header.num_frames;
-	sint32 num_verts  = m_new_vindexes.size();
+	size_t num_frames = static_cast< size_t >( md2->header.num_frames );
+	size_t num_verts  =	m_new_vindexes.size();
 	p.clear();
-	sint32 current_frame = ( frame == -1 ? 0 : frame );
-	sint32 frame_count   = ( frame == -1 ? num_frames : 1 );
+	size_t current_frame = ( frame == -1 ? 0 : static_cast< size_t >( frame ) );
+	size_t frame_count   = ( frame == -1 ? num_frames : 1 );
 
 	p.reserve( num_verts * frame_count );
@@ -287,13 +286,13 @@
 	while ( frame_count > 0 )
 	{
-		const md2_frame_t& frame = md2->frames[current_frame];
-		NV_LOG( LOG_INFO, "FrameID = " << frame.name );
-
-		vec3 scale     = md2_vec3( frame.scale );
-		vec3 translate = md2_vec3( frame.translate );
-
-		for (sint32 i = 0; i < num_verts; ++i )
+		const md2_frame_t& cframe = md2->frames[current_frame];
+		NV_LOG( LOG_INFO, "FrameID = " << cframe.name );
+
+		vec3 scale     = md2_vec3( cframe.scale );
+		vec3 translate = md2_vec3( cframe.translate );
+
+		for (size_t i = 0; i < num_verts; ++i )
 		{
-			const md2_vertex_t& v = frame.vertices[ m_new_vindexes[ i ] ];
+			const md2_vertex_t& v = cframe.vertices[ m_new_vindexes[ i ] ];
 			p.push_back( vec3( v.v[0], v.v[2], v.v[1] ) * scale + translate );
 		}
@@ -306,9 +305,9 @@
 {
 	md2_t* md2 = (md2_t*)m_md2;
-	sint32 num_frames = md2->header.num_frames;
-	sint32 num_verts  =	m_new_vindexes.size();
+	size_t num_frames = static_cast< size_t >( md2->header.num_frames );
+	size_t num_verts  =	m_new_vindexes.size();
 	n.clear();
-	sint32 current_frame = ( frame == -1 ? 0 : frame );
-	sint32 frame_count   = ( frame == -1 ? num_frames : 1 );
+	size_t current_frame = ( frame == -1 ? 0 : static_cast< size_t>( frame ) );
+	size_t frame_count   = ( frame == -1 ? num_frames : 1 );
 
 	n.reserve( num_verts * frame_count );
@@ -316,9 +315,9 @@
 	while ( frame_count > 0 )
 	{
-		const md2_frame_t& frame = md2->frames[current_frame];
-
-		for (sint32 i = 0; i < num_verts; ++i )
+		const md2_frame_t& cframe = md2->frames[current_frame];
+
+		for (size_t i = 0; i < num_verts; ++i )
 		{
-			const md2_vertex_t& v = frame.vertices[ m_new_vindexes[ i ] ];
+			const md2_vertex_t& v = cframe.vertices[ m_new_vindexes[ i ] ];
 			n.push_back( s_md2_normal_cache[ v.n ] );
 		}
@@ -331,5 +330,5 @@
 {
 	md2_t* md2 = (md2_t*)m_md2;
-	sint32 num_verts  = m_new_vindexes.size();
+	size_t num_verts  = m_new_vindexes.size();
 
 	t.clear();
@@ -338,5 +337,5 @@
 	vec2 scale( 1.0f / (float) md2->header.skinwidth, 1.0f / (float) md2->header.skinheight );
 
-	for (sint32 i = 0; i < num_verts; ++i )
+	for (size_t i = 0; i < num_verts; ++i )
 	{
 		const md2_texcoord_t& st = md2->texcoords[ m_new_tindexes[ i ] ];
@@ -354,5 +353,5 @@
 {
 	md2_t* md2 = (md2_t*)m_md2;
-	uint32 num_indexes = md2->header.num_tris * 3;
+	uint32 num_indexes = static_cast< uint32 >( md2->header.num_tris * 3 );
 
 	uint32 stats_reuse      = 0;
@@ -373,10 +372,10 @@
 		for ( int j = 0; j < 3; ++j )
 		{
-			short index  = t.vertex[j];
-			short tindex = t.st[j];
+			uint16 index  = t.vertex[j];
+			uint16 tindex = t.st[j];
 
 			if ( index_translation[ index ] != -1 )
 			{
-				uint16 prev = index_translation[ index ];
+				uint16 prev = static_cast< uint16 >( index_translation[ index ] );
 				if ( m_new_tindexes[ prev ] == tindex )
 				{
