@@ -97,7 +97,7 @@ static void CMod_LoadShaders( const lump_t *l ) {
9797 Com_Error (ERR_DROP , "%s: funny lump size" , __func__ );
9898 }
9999
100- count = l -> filelen / sizeof (* in );
100+ count = ( size_t ) l -> filelen / sizeof (* in );
101101 if ( count < 1 )
102102 Com_Error (ERR_DROP , "%s: map with no shaders" , __func__ );
103103
@@ -129,7 +129,7 @@ static void CMod_LoadSubmodels( const lump_t *l ) {
129129 if (l -> filelen % sizeof (* in ))
130130 Com_Error ( ERR_DROP , "%s: funny lump size" , __func__ );
131131
132- count = l -> filelen / sizeof (* in );
132+ count = ( size_t ) l -> filelen / sizeof (* in );
133133 if ( count < 1 )
134134 Com_Error ( ERR_DROP , "%s: map with no models" , __func__ );
135135
@@ -156,14 +156,14 @@ static void CMod_LoadSubmodels( const lump_t *l ) {
156156 // make a "leaf" just to hold the model's brushes and surfaces
157157 out -> leaf .numLeafBrushes = LittleLong ( in -> numBrushes );
158158 indexes = Hunk_Alloc ( out -> leaf .numLeafBrushes * 4 , h_high );
159- out -> leaf .firstLeafBrush = indexes - cm .leafbrushes ;
159+ out -> leaf .firstLeafBrush = ( int )( indexes - cm .leafbrushes ) ;
160160 for ( j = 0 ; j < out -> leaf .numLeafBrushes ; j ++ ) {
161161 indexes [j ] = LittleLong ( in -> firstBrush ) + j ;
162162 }
163163
164164 out -> leaf .numLeafSurfaces = LittleLong ( in -> numSurfaces );
165165 indexes = Hunk_Alloc ( out -> leaf .numLeafSurfaces * 4 , h_high );
166- out -> leaf .firstLeafSurface = indexes - cm .leafsurfaces ;
166+ out -> leaf .firstLeafSurface = ( int )( indexes - cm .leafsurfaces ) ;
167167 for ( j = 0 ; j < out -> leaf .numLeafSurfaces ; j ++ ) {
168168 indexes [j ] = LittleLong ( in -> firstSurface ) + j ;
169169 }
@@ -187,7 +187,7 @@ static void CMod_LoadNodes( const lump_t *l ) {
187187 if (l -> filelen % sizeof (* in ))
188188 Com_Error ( ERR_DROP , "%s: funny lump size" , __func__ );
189189
190- count = l -> filelen / sizeof (* in );
190+ count = ( size_t ) l -> filelen / sizeof (* in );
191191 if ( count < 1 )
192192 Com_Error ( ERR_DROP , "%s: map has no nodes" , __func__ );
193193
@@ -241,7 +241,7 @@ static void CMod_LoadBrushes( const lump_t *l ) {
241241 if ( l -> filelen % sizeof (* in ) )
242242 Com_Error ( ERR_DROP , "%s: funny lump size" , __func__ );
243243
244- count = l -> filelen / sizeof (* in );
244+ count = ( size_t ) l -> filelen / sizeof (* in );
245245
246246 cm .brushes = Hunk_Alloc ( ( BOX_BRUSHES + count ) * sizeof ( * cm .brushes ), h_high );
247247 cm .numBrushes = count ;
@@ -280,7 +280,7 @@ static void CMod_LoadLeafs( const lump_t *l )
280280 if ( l -> filelen % sizeof (* in ) )
281281 Com_Error ( ERR_DROP , "%s: funny lump size" , __func__ );
282282
283- count = l -> filelen / sizeof (* in );
283+ count = ( size_t ) l -> filelen / sizeof (* in );
284284 if ( count < 1 )
285285 Com_Error ( ERR_DROP , "%s: map with no leafs" , __func__ );
286286
@@ -325,7 +325,7 @@ static void CMod_LoadPlanes( const lump_t *l )
325325 if ( l -> filelen % sizeof (* in ) )
326326 Com_Error ( ERR_DROP , "%s: funny lump size" , __func__ );
327327
328- count = l -> filelen / sizeof (* in );
328+ count = ( size_t ) l -> filelen / sizeof (* in );
329329 if ( count < 1 )
330330 Com_Error ( ERR_DROP , "%s: map with no planes" , __func__ );
331331
@@ -367,7 +367,7 @@ static void CMod_LoadLeafBrushes( const lump_t *l )
367367 if ( l -> filelen % sizeof (* in ) )
368368 Com_Error ( ERR_DROP , "%s: funny lump size" , __func__ );
369369
370- count = l -> filelen / sizeof (* in );
370+ count = ( size_t ) l -> filelen / sizeof (* in );
371371
372372 cm .leafbrushes = Hunk_Alloc ( (count + BOX_BRUSHES ) * sizeof ( * cm .leafbrushes ), h_high );
373373 cm .numLeafBrushes = count ;
@@ -396,7 +396,7 @@ static void CMod_LoadLeafSurfaces( const lump_t *l )
396396 if ( l -> filelen % sizeof (* in ) )
397397 Com_Error ( ERR_DROP , "%s: funny lump size" , __func__ );
398398
399- count = l -> filelen / sizeof (* in );
399+ count = ( size_t ) l -> filelen / sizeof (* in );
400400
401401 cm .leafsurfaces = Hunk_Alloc ( count * sizeof ( * cm .leafsurfaces ), h_high );
402402 cm .numLeafSurfaces = count ;
@@ -444,7 +444,7 @@ static void CMod_LoadBrushSides( const lump_t *l )
444444 if ( l -> filelen % sizeof (* in ) ) {
445445 Com_Error ( ERR_DROP , "%s: funny lump size" , __func__ );
446446 }
447- count = l -> filelen / sizeof (* in );
447+ count = ( size_t ) l -> filelen / sizeof (* in );
448448
449449 cm .brushsides = Hunk_Alloc ( ( BOX_SIDES + count ) * sizeof ( * cm .brushsides ), h_high );
450450 cm .numBrushSides = count ;
0 commit comments