Replace max macro with std::max in C++ code

Fixes compilation on Guix with gcc 12. Not sure which of those is
relevant.
This commit is contained in:
Timotej Lazar 2022-06-12 16:53:06 +02:00
parent 0aa9a623f3
commit 1e38669119
11 changed files with 70 additions and 53 deletions

View file

@ -1,3 +1,5 @@
#include <algorithm>
#include "avpchunk.hpp" #include "avpchunk.hpp"
#include "md5.h" #include "md5.h"
//#include "strachnk.hpp" //#include "strachnk.hpp"
@ -280,7 +282,7 @@ AVP_Generator_Extended_Settings_Chunk::AVP_Generator_Extended_Settings_Chunk(Chu
CHUNK_EXTRACT(spare2,int) CHUNK_EXTRACT(spare2,int)
size_t size=max(*(int*) data,(int)sizeof(AVP_Generator_Weighting)); size_t size=std::max(*(int*) data,(int)sizeof(AVP_Generator_Weighting));
weights=(AVP_Generator_Weighting*)new unsigned char[size]; weights=(AVP_Generator_Weighting*)new unsigned char[size];
memset(weights,0,sizeof(AVP_Generator_Weighting)); memset(weights,0,sizeof(AVP_Generator_Weighting));
@ -551,7 +553,7 @@ RIF_IMPLEMENT_DYNCREATE("AVPENVIR",AVP_Environment_Settings_Chunk)
AVP_Environment_Settings_Chunk::AVP_Environment_Settings_Chunk(Chunk_With_Children* parent,const char* data,size_t data_size) AVP_Environment_Settings_Chunk::AVP_Environment_Settings_Chunk(Chunk_With_Children* parent,const char* data,size_t data_size)
:Chunk(parent,"AVPENVIR") :Chunk(parent,"AVPENVIR")
{ {
size_t size=max(data_size,sizeof(AVP_Environment_Settings)); size_t size=std::max(data_size,sizeof(AVP_Environment_Settings));
settings=(AVP_Environment_Settings*)new unsigned char[size]; settings=(AVP_Environment_Settings*)new unsigned char[size];
memcpy(settings,data,data_size); memcpy(settings,data,data_size);
@ -642,7 +644,7 @@ AVP_Decal_Chunk::AVP_Decal_Chunk(Chunk_With_Children* parent,const char* data,si
int loaded_decal_size=*(int*)data; int loaded_decal_size=*(int*)data;
data+=4; data+=4;
decal_size=max(loaded_decal_size,(int)sizeof(AVP_Decal)); decal_size=std::max(loaded_decal_size,(int)sizeof(AVP_Decal));
//allocate buffer for decals , and initialise to zero //allocate buffer for decals , and initialise to zero
decal_buffer=new char[num_decals*decal_size]; decal_buffer=new char[num_decals*decal_size];

View file

@ -1,5 +1,6 @@
#define DB_LEVEL 1 #define DB_LEVEL 1
#include <algorithm>
#include <stdlib.h> #include <stdlib.h>
#include "list_tem.hpp" #include "list_tem.hpp"
@ -956,7 +957,7 @@ void add_placed_hierarchy(Placed_Hierarchy_Chunk* phc,const char* fname,const ch
for(; !chlif.done(); chlif.next()) for(; !chlif.done(); chlif.next())
{ {
Indexed_Sound_Chunk* isc=(Indexed_Sound_Chunk*)chlif(); Indexed_Sound_Chunk* isc=(Indexed_Sound_Chunk*)chlif();
phtt->num_sounds=max(phtt->num_sounds,isc->index+1); phtt->num_sounds=std::max(phtt->num_sounds,isc->index+1);
} }
if(phtt->num_sounds) if(phtt->num_sounds)
@ -990,7 +991,7 @@ void add_placed_hierarchy(Placed_Hierarchy_Chunk* phc,const char* fname,const ch
for(chlif.restart();!chlif.done();chlif.next()) for(chlif.restart();!chlif.done();chlif.next())
{ {
Placed_Hierarchy_Sequence_Chunk* phsc=(Placed_Hierarchy_Sequence_Chunk*)chlif(); Placed_Hierarchy_Sequence_Chunk* phsc=(Placed_Hierarchy_Sequence_Chunk*)chlif();
phtt->num_sequences=max(phtt->num_sequences,phsc->index+1); phtt->num_sequences=std::max(phtt->num_sequences,phsc->index+1);
} }
GLOBALASSERT(phtt->num_sequences); GLOBALASSERT(phtt->num_sequences);
@ -1777,11 +1778,11 @@ static void add_placed_light(Object_Chunk* ob,int list_pos,AVP_Strategy_Chunk* a
pltd->colour_diff_green-=pltd->colour_green; pltd->colour_diff_green-=pltd->colour_green;
pltd->colour_diff_blue-=pltd->colour_blue; pltd->colour_diff_blue-=pltd->colour_blue;
pltd->fade_up_time=(max(lchunk->light.fade_up_time,1)*ONE_FIXED)/1000; pltd->fade_up_time=(std::max(lchunk->light.fade_up_time,1)*ONE_FIXED)/1000;
pltd->fade_down_time=(max(lchunk->light.fade_down_time,1)*ONE_FIXED)/1000; pltd->fade_down_time=(std::max(lchunk->light.fade_down_time,1)*ONE_FIXED)/1000;
pltd->up_time=(max(lchunk->light.up_time,1)*ONE_FIXED)/1000; pltd->up_time=(std::max(lchunk->light.up_time,1)*ONE_FIXED)/1000;
pltd->down_time=(max(lchunk->light.down_time,1)*ONE_FIXED)/1000; pltd->down_time=(std::max(lchunk->light.down_time,1)*ONE_FIXED)/1000;
pltd->timer=(max(lchunk->light.start_time,1)*ONE_FIXED)/1000; pltd->timer=(std::max(lchunk->light.start_time,1)*ONE_FIXED)/1000;
pltd->type=(LIGHT_TYPE)lchunk->light.light_type; pltd->type=(LIGHT_TYPE)lchunk->light.light_type;
pltd->on_off_type=(LIGHT_ON_OFF_TYPE)lchunk->light.on_off_type; pltd->on_off_type=(LIGHT_ON_OFF_TYPE)lchunk->light.on_off_type;
@ -3808,7 +3809,7 @@ void setup_particle_generators(Environment_Data_Chunk * envd)
if(data_chunk->type==PARGEN_TYPE_SPARK) if(data_chunk->type==PARGEN_TYPE_SPARK)
part_temp->frequency=(data_chunk->time*ONE_FIXED)/10; part_temp->frequency=(data_chunk->time*ONE_FIXED)/10;
else else
part_temp->frequency=ONE_FIXED/max(data_chunk->quantity,1); part_temp->frequency=ONE_FIXED/std::max(data_chunk->quantity,static_cast<unsigned short>(1));
part_temp->active=!(data_chunk->flags & ParticleGeneratorFlag_Inactive); part_temp->active=!(data_chunk->flags & ParticleGeneratorFlag_Inactive);

View file

@ -1,5 +1,7 @@
#define DB_LEVEL 2 #define DB_LEVEL 2
#include <algorithm>
#include "3dc.h" #include "3dc.h"
#include "inline.h" #include "inline.h"
#include "module.h" #include "module.h"
@ -167,7 +169,7 @@ void setup_paths(RIFFHANDLE h)
for(; !plif.done(); plif.next()) for(; !plif.done(); plif.next())
{ {
AVP_Path_Chunk* apc=(AVP_Path_Chunk*) plif(); AVP_Path_Chunk* apc=(AVP_Path_Chunk*) plif();
PathArraySize=max(PathArraySize,apc->PathID+1); PathArraySize=std::max(PathArraySize,apc->PathID+1);
} }
PathArray=(PATHHEADER*)PoolAllocateMem(sizeof(PATHHEADER)*PathArraySize); PathArray=(PATHHEADER*)PoolAllocateMem(sizeof(PATHHEADER)*PathArraySize);
@ -187,7 +189,7 @@ void setup_paths(RIFFHANDLE h)
int length=apc->PathLength; int length=apc->PathLength;
if(apc->flags & PathFlag_BackAndForth) if(apc->flags & PathFlag_BackAndForth)
{ {
length=max(length,(length-1)*2); length=std::max(length,(length-1)*2);
} }
path->modules_in_path=(AIMODULE**)PoolAllocateMem(sizeof(AIMODULE*)*length); path->modules_in_path=(AIMODULE**)PoolAllocateMem(sizeof(AIMODULE*)*length);
@ -463,7 +465,7 @@ Global_Hierarchy_Store::Global_Hierarchy_Store (RIFFHANDLE h)
for(; !chlif.done(); chlif.next()) for(; !chlif.done(); chlif.next())
{ {
Indexed_Sound_Chunk* isc=(Indexed_Sound_Chunk*)chlif(); Indexed_Sound_Chunk* isc=(Indexed_Sound_Chunk*)chlif();
max_index=max(max_index,isc->index); max_index=std::max(max_index,isc->index);
} }
//now create a large enough array , and fill it in //now create a large enough array , and fill it in
num_sounds=max_index+1; num_sounds=max_index+1;
@ -716,7 +718,7 @@ void Global_Hierarchy_Store::setup_alternate_shape_sets(List <Object_ShapeNum_Pa
for(chlif.restart();!chlif.done();chlif.next()) for(chlif.restart();!chlif.done();chlif.next())
{ {
Hierarchy_Shape_Set_Collection_Chunk* coll=(Hierarchy_Shape_Set_Collection_Chunk*)chlif(); Hierarchy_Shape_Set_Collection_Chunk* coll=(Hierarchy_Shape_Set_Collection_Chunk*)chlif();
max_index=max(max_index,coll->Set_Collection_Num); max_index=std::max(max_index,coll->Set_Collection_Num);
} }
if(max_index==-1) return; if(max_index==-1) return;
@ -988,11 +990,11 @@ SECTION * Global_Hierarchy_Store::build_hierarchy (Object_Hierarchy_Chunk * ohc,
if (frame_no<seq->num_frames) if (frame_no<seq->num_frames)
{ {
//calculate sequence length , making sure it doesn't overflow an unsigned short //calculate sequence length , making sure it doesn't overflow an unsigned short
kfd->Sequence_Length =(unsigned short) min(seq->frames[frame_no].at_frame_no - this_frame_no,65535); kfd->Sequence_Length =(unsigned short) std::min(seq->frames[frame_no].at_frame_no - this_frame_no,65535);
} }
else else
{ {
kfd->Sequence_Length =(unsigned short) min(65536 - this_frame_no,65535); kfd->Sequence_Length =(unsigned short) std::min(65536 - this_frame_no,65535);
} }
} }
@ -1196,11 +1198,11 @@ SECTION * Global_Hierarchy_Store::build_hierarchy (Object_Hierarchy_Chunk * ohc,
if (frame_no<num_frames) if (frame_no<num_frames)
{ {
//calculate sequence length , making sure it doesn't overflow an unsigned short //calculate sequence length , making sure it doesn't overflow an unsigned short
kfd->Sequence_Length =(unsigned short) min(frame_array[frame_no]->at_frame_no - this_frame_no,65535); kfd->Sequence_Length =(unsigned short) std::min(frame_array[frame_no]->at_frame_no - this_frame_no,65535L);
} }
else else
{ {
kfd->Sequence_Length =(unsigned short) min(65536 - this_frame_no , 65535); kfd->Sequence_Length =(unsigned short) std::min(65536 - this_frame_no , 65535);
} }
} }
//sort out some settings for the last frame //sort out some settings for the last frame

View file

@ -47,6 +47,7 @@ extern "C" {
#define PACKED __attribute__((packed)) #define PACKED __attribute__((packed))
/* windows junk */ /* windows junk */
#ifndef __cplusplus
#ifndef min #ifndef min
#define min(a, b) (((a) < (b)) ? (a) : (b)) #define min(a, b) (((a) < (b)) ? (a) : (b))
#endif #endif
@ -54,6 +55,7 @@ extern "C" {
#ifndef max #ifndef max
#define max(a, b) (((a) > (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b))
#endif #endif
#endif
#define __cdecl #define __cdecl

View file

@ -1,3 +1,4 @@
#include <algorithm>
#include <string.h> #include <string.h>
#include "bmpnames.hpp" #include "bmpnames.hpp"
#include "mishchnk.hpp" #include "mishchnk.hpp"
@ -128,7 +129,7 @@ Chunk_With_BMPs::Chunk_With_BMPs (Chunk_With_Children * parent, const char * con
bn.priority = d2; bn.priority = d2;
bn.transparency_colour_union = d3; bn.transparency_colour_union = d3;
max_index = max (bn.index, max_index); max_index = std::max(bn.index, max_index);
bmps.add_entry (bn); bmps.add_entry (bn);
} }

View file

@ -1,3 +1,4 @@
#include <algorithm>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
@ -672,7 +673,7 @@ static void setup_tex_conv_array (
for (; !bns.done(); bns.next()) for (; !bns.done(); bns.next())
{ {
max_indices = max(bns().index,max_indices); max_indices = std::max(bns().index,max_indices);
} }
conv_array = new int [max_indices+1]; conv_array = new int [max_indices+1];
@ -1177,7 +1178,7 @@ BOOL load_rif_bitmaps (RIFFHANDLE h, int/* flags*/)
for (; !bns.done(); bns.next()) for (; !bns.done(); bns.next())
{ {
h->max_index = max(bns().index,h->max_index); h->max_index = std::max(bns().index,h->max_index);
} }
if (h->tex_index_nos) delete h->tex_index_nos; if (h->tex_index_nos) delete h->tex_index_nos;
@ -1619,7 +1620,7 @@ void DeallocateRifLoadedShapeheader(SHAPEHEADER * shp)
if (is_textured(shp->items[i][0])) if (is_textured(shp->items[i][0]))
{ {
int UVIndex = (shp->items[i][3] &0xffff0000) >> 16; int UVIndex = (shp->items[i][3] &0xffff0000) >> 16;
max_num_texs = max (max_num_texs, shp->items[i][3] &0x7fff); max_num_texs = std::max(max_num_texs, shp->items[i][3] &0x7fff);
if(shp->items[i][2]& iflag_txanim) if(shp->items[i][2]& iflag_txanim)
{ {
int j; int j;
@ -2138,7 +2139,7 @@ void SetupAnimatingShape(Shape_Chunk* sc,SHAPEHEADER* shp, Shape_Merge_Data_Chun
for(;!chlif.done();chlif.next()) for(;!chlif.done();chlif.next())
{ {
Anim_Shape_Sequence_Chunk* assc=(Anim_Shape_Sequence_Chunk*)chlif(); Anim_Shape_Sequence_Chunk* assc=(Anim_Shape_Sequence_Chunk*)chlif();
numseq=max(assc->sequence_data.SequenceNum+1,numseq); numseq=std::max(assc->sequence_data.SequenceNum+1,numseq);
} }
shapeanimationheader* sah=(shapeanimationheader*)PoolAllocateMem(sizeof(shapeanimationheader)); shapeanimationheader* sah=(shapeanimationheader*)PoolAllocateMem(sizeof(shapeanimationheader));
@ -2173,9 +2174,9 @@ void SetupAnimatingShape(Shape_Chunk* sc,SHAPEHEADER* shp, Shape_Merge_Data_Chun
sas->max_z=(int)((cas->max.z-Centre.z)*local_scale); sas->max_z=(int)((cas->max.z-Centre.z)*local_scale);
sas->min_z=(int)((cas->min.z-Centre.z)*local_scale); sas->min_z=(int)((cas->min.z-Centre.z)*local_scale);
int x=max(-sas->min_x,sas->max_x); int x=std::max(-sas->min_x,sas->max_x);
int y=max(-sas->min_y,sas->max_y); int y=std::max(-sas->min_y,sas->max_y);
int z=max(-sas->min_z,sas->max_z); int z=std::max(-sas->min_z,sas->max_z);
sas->radius=(int)sqrt((double)(x*x+y*y+z*z)); sas->radius=(int)sqrt((double)(x*x+y*y+z*z));
@ -2609,7 +2610,7 @@ BOOL copy_sprite_to_shapeheader (RIFFHANDLE h, SHAPEHEADER *& shphd,Sprite_Heade
LIF<BMP_Name> bns (&blsc->bmps); LIF<BMP_Name> bns (&blsc->bmps);
for (; !bns.done(); bns.next()) for (; !bns.done(); bns.next())
{ {
local_max_index = max(bns().index,local_max_index); local_max_index = std::max(bns().index,local_max_index);
} }
BmpConv = new int [local_max_index+1]; BmpConv = new int [local_max_index+1];
@ -2771,7 +2772,7 @@ BOOL copy_sprite_to_shapeheader (RIFFHANDLE h, SHAPEHEADER *& shphd,Sprite_Heade
int MaxSeq=0; int MaxSeq=0;
for(LIF<Chunk*>chlif(&chlist);!chlif.done();chlif.next()) for(LIF<Chunk*>chlif(&chlist);!chlif.done();chlif.next())
{ {
MaxSeq=max(MaxSeq,((Sprite_Action_Chunk*)chlif())->Action); MaxSeq=std::max(MaxSeq,((Sprite_Action_Chunk*)chlif())->Action);
} }
txanimheader** thlist=(txanimheader**)PoolAllocateMem((3+MaxSeq)*sizeof(txanimheader)); txanimheader** thlist=(txanimheader**)PoolAllocateMem((3+MaxSeq)*sizeof(txanimheader));
thlist[0]=thlist[MaxSeq+2]=0; thlist[0]=thlist[MaxSeq+2]=0;

View file

@ -1,4 +1,5 @@
#include "chunk.hpp" #include "chunk.hpp"
#include <algorithm>
#include <math.h> #include <math.h>
#include "chnktype.hpp" #include "chnktype.hpp"
@ -1044,17 +1045,17 @@ void ChunkAnimSequence::UpdateNormalsAndExtents(ChunkShape const * cs,List<int>*
for (int j=0; j<caf->num_verts; j++) for (int j=0; j<caf->num_verts; j++)
{ {
if(vert_in_bb && !vert_in_bb[j]) continue; if(vert_in_bb && !vert_in_bb[j]) continue;
max.x = max(max.x, caf->v_list[j].x); max.x = std::max(max.x, caf->v_list[j].x);
max.y = max(max.y, caf->v_list[j].y); max.y = std::max(max.y, caf->v_list[j].y);
max.z = max(max.z, caf->v_list[j].z); max.z = std::max(max.z, caf->v_list[j].z);
min.x = min(min.x, caf->v_list[j].x); min.x = std::min(min.x, caf->v_list[j].x);
min.y = min(min.y, caf->v_list[j].y); min.y = std::min(min.y, caf->v_list[j].y);
min.z = min(min.z, caf->v_list[j].z); min.z = std::min(min.z, caf->v_list[j].z);
double temp_rad = mod(caf->v_list[j]); double temp_rad = mod(caf->v_list[j]);
radius = max (radius, (float)temp_rad); radius = std::max(radius, (float)temp_rad);
} }
} }
if(vert_in_bb) delete [] vert_in_bb; if(vert_in_bb) delete [] vert_in_bb;

View file

@ -1,6 +1,7 @@
#ifndef INLINE_INCLUDED #ifndef INLINE_INCLUDED
#define INLINE_INCLUDED #define INLINE_INCLUDED
#ifndef __cplusplus
#ifndef min #ifndef min
#define min(a, b) (((a) < (b)) ? (a) : (b)) #define min(a, b) (((a) < (b)) ? (a) : (b))
#endif #endif
@ -8,6 +9,7 @@
#ifndef max #ifndef max
#define max(a, b) (((a) > (b)) ? (a) : (b)) #define max(a, b) (((a) > (b)) ? (a) : (b))
#endif #endif
#endif
#if SUPPORT_MMX #if SUPPORT_MMX

View file

@ -1,3 +1,5 @@
#include <algorithm>
#include "chunk.hpp" #include "chunk.hpp"
#include "ltchunk.hpp" #include "ltchunk.hpp"
@ -331,8 +333,8 @@ int Light_Scale_Chunk::ApplyPrelightScale(int l)
l+=(prelight_add-prelight_multiply_above); l+=(prelight_add-prelight_multiply_above);
l= (int)(l*prelight_multiply); l= (int)(l*prelight_multiply);
l+=prelight_multiply_above; l+=prelight_multiply_above;
l=min(l,255); l=std::min(l,255);
return max(l,prelight_multiply_above); return std::max(l,prelight_multiply_above);
} }
int Light_Scale_Chunk::ApplyRuntimeScale(int l) int Light_Scale_Chunk::ApplyRuntimeScale(int l)
{ {
@ -340,8 +342,8 @@ int Light_Scale_Chunk::ApplyRuntimeScale(int l)
l+=(runtime_add-runtime_multiply_above); l+=(runtime_add-runtime_multiply_above);
l=(int)( l*runtime_multiply); l=(int)( l*runtime_multiply);
l+=runtime_multiply_above; l+=runtime_multiply_above;
l=min(l,255); l=std::min(l,255);
return max(l,runtime_multiply_above); return std::max(l,runtime_multiply_above);
} }
//////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////
RIF_IMPLEMENT_DYNCREATE("PLOBJLIT",Placed_Object_Light_Chunk) RIF_IMPLEMENT_DYNCREATE("PLOBJLIT",Placed_Object_Light_Chunk)

View file

@ -1,3 +1,5 @@
#include <algorithm>
#include "chunk.hpp" #include "chunk.hpp"
#include "chnktype.hpp" #include "chnktype.hpp"
#include "mishchnk.hpp" #include "mishchnk.hpp"
@ -625,7 +627,7 @@ void File_Chunk::post_input_processing()
LIF<Shape_Chunk *> sli(&shplist); LIF<Shape_Chunk *> sli(&shplist);
for (; !sli.done(); sli.next()) for (; !sli.done(); sli.next())
{ {
Shape_Chunk::max_id = max (Shape_Chunk::max_id,sli()->get_header()->file_id_num); Shape_Chunk::max_id = std::max(Shape_Chunk::max_id,sli()->get_header()->file_id_num);
} }
Shape_Chunk** shape_array=new Shape_Chunk*[Shape_Chunk::max_id+1]; Shape_Chunk** shape_array=new Shape_Chunk*[Shape_Chunk::max_id+1];
@ -803,7 +805,7 @@ BOOL File_Chunk::check_file()
// Here we update max_id // Here we update max_id
Shape_Chunk::max_id = max (Shape_Chunk::max_id,id); Shape_Chunk::max_id = std::max(Shape_Chunk::max_id,id);
// go to version number // go to version number
SetFilePointer(rif_file,shphead.first_entry() + 100,0,FILE_BEGIN); SetFilePointer(rif_file,shphead.first_entry() + 100,0,FILE_BEGIN);
@ -1515,7 +1517,7 @@ void File_Chunk::build_object_array()
//find the highest object index //find the highest object index
for(oblif.restart();!oblif.done();oblif.next()) for(oblif.restart();!oblif.done();oblif.next())
{ {
object_array_size=max(object_array_size,oblif()->object_data.index_num+1); object_array_size=std::max(object_array_size,oblif()->object_data.index_num+1);
} }
if(object_array_size<=0) return; if(object_array_size<=0) return;
@ -1864,7 +1866,7 @@ void RIF_File_Chunk::post_input_processing()
for (LIF<Shape_Chunk *> sli(&shplist); !sli.done(); sli.next()) for (LIF<Shape_Chunk *> sli(&shplist); !sli.done(); sli.next())
{ {
Shape_Chunk::max_id = max (Shape_Chunk::max_id,sli()->get_header()->file_id_num); Shape_Chunk::max_id = std::max(Shape_Chunk::max_id,sli()->get_header()->file_id_num);
} }
Chunk_With_Children::post_input_processing(); Chunk_With_Children::post_input_processing();

View file

@ -1,3 +1,4 @@
#include <algorithm>
#include <math.h> #include <math.h>
#include "unaligned.h" #include "unaligned.h"
#include "chunk.hpp" #include "chunk.hpp"
@ -191,17 +192,17 @@ void Shape_Chunk::post_input_processing()
for (int i=0; i<shape_data_store->num_verts; i++) for (int i=0; i<shape_data_store->num_verts; i++)
{ {
max.x = max(max.x, shape_data_store->v_list[i].x); max.x = std::max(max.x, shape_data_store->v_list[i].x);
max.y = max(max.y, shape_data_store->v_list[i].y); max.y = std::max(max.y, shape_data_store->v_list[i].y);
max.z = max(max.z, shape_data_store->v_list[i].z); max.z = std::max(max.z, shape_data_store->v_list[i].z);
min.x = min(min.x, shape_data_store->v_list[i].x); min.x = std::min(min.x, shape_data_store->v_list[i].x);
min.y = min(min.y, shape_data_store->v_list[i].y); min.y = std::min(min.y, shape_data_store->v_list[i].y);
min.z = min(min.z, shape_data_store->v_list[i].z); min.z = std::min(min.z, shape_data_store->v_list[i].z);
float temp_rad =(float) mod(shape_data_store->v_list[i]); float temp_rad =(float) mod(shape_data_store->v_list[i]);
radius = max (radius, temp_rad); radius = std::max(radius, temp_rad);
} }
shape_data_store->max = max; shape_data_store->max = max;
@ -1459,7 +1460,7 @@ void Shape_Header_Chunk::prepare_for_output()
} }
Shape_Chunk::max_id = max(Shape_Chunk::max_id, file_id_num); Shape_Chunk::max_id = std::max(Shape_Chunk::max_id, file_id_num);
// this should always be the last thing // this should always be the last thing
@ -1783,7 +1784,7 @@ void Shape_Morphing_Data_Chunk::prepare_for_output()
for (; !cli.done(); cli.next()) for (; !cli.done(); cli.next())
{ {
max_id = max (max_id, ((Shape_Sub_Shape_Chunk *)cli())->get_header()->file_id_num); max_id = std::max(max_id, ((Shape_Sub_Shape_Chunk *)cli())->get_header()->file_id_num);
} }
for (cli.restart(); !cli.done(); cli.next()) for (cli.restart(); !cli.done(); cli.next())