diff --git a/vcg/space/index/octree.h b/vcg/space/index/octree.h index 328ae419..6815fcd8 100644 --- a/vcg/space/index/octree.h +++ b/vcg/space/index/octree.h @@ -310,7 +310,6 @@ public: global_mark = 1; marks.resize(placeholder_count); std::fill(marks.begin(), marks.end(), 0); - //memset(&marks[0], 0, sizeof(unsigned char)*placeholder_count); std::sort(placeholders.begin(), placeholders.end(), ObjectSorter< NodeType >()); std::vector< NodePointer > filled_leaves(placeholder_count); diff --git a/vcg/space/index/octree_template.h b/vcg/space/index/octree_template.h index 7a2f1d71..96aca827 100644 --- a/vcg/space/index/octree_template.h +++ b/vcg/space/index/octree_template.h @@ -28,6 +28,8 @@ #include #include #include +#include +#include namespace vcg @@ -111,7 +113,7 @@ protected: InnerNode() : Node() {} InnerNode(NodePointer parent, int level) : Node(parent, level) { - memset(&sons[0], 0, 8*sizeof(Node*)); + sons.fill(nullptr); } inline NodePointer &Son(int sonIndex) @@ -125,7 +127,7 @@ protected: return false; } - NodePointer sons[8]; + std::array sons; }; /* @@ -598,7 +600,8 @@ public: assert( boundingBox.min.Y()<=p.Y() && p.Y()<=boundingBox.max.Y() ); assert( boundingBox.min.Z()<=p.Z() && p.Z()<=boundingBox.max.Z() ); - memset(route, NULL, maximumDepth*sizeof(NodePointer)); + for (unsigned int i = 0; i < maximumDepth; ++i) + route[i] = nullptr; CenterType path = CenterType::Construct(Interize(p)); int shift = maximumDepth-1; diff --git a/wrap/io_trimesh/export_idtf.h b/wrap/io_trimesh/export_idtf.h index ac393c40..e711ee61 100644 --- a/wrap/io_trimesh/export_idtf.h +++ b/wrap/io_trimesh/export_idtf.h @@ -159,7 +159,8 @@ public: tga.colourmaptype = 0; tga.imagetype = 2; - memset(tga.colormapspecs,0,5); + for (unsigned int i = 0; i < 5; ++i) + tga.colormapspecs[i] = '\0'; tga.xstart = (short) im.offset().x(); tga.ystart = (short) im.offset().y(); tga.height = (short) im.height(); @@ -180,10 +181,10 @@ public: //is a 8-digits binary number code // always 0 0 | mirroring | bits //(future uses)| image | for alpha-channel - //-------------------------------------------- - // 7 6 | 5 4 | 3 2 1 0 //-------------------------------------------- - // 0 0 | 1 0 | 1 0 0 0 + // 7 6 | 5 4 | 3 2 1 0 + //-------------------------------------------- + // 0 0 | 1 0 | 1 0 0 0 tga.descriptor = (char) 40; tga.bits = (char) 32; } diff --git a/wrap/io_trimesh/import_raw.h b/wrap/io_trimesh/import_raw.h index 44773f55..a617a954 100644 --- a/wrap/io_trimesh/import_raw.h +++ b/wrap/io_trimesh/import_raw.h @@ -347,7 +347,9 @@ static int Open( MESH_TYPE &m, const char * filename, bool triangulate=false, in //read a new line ii=0; - memset( rawline, 0, 512); + for (unsigned int i = 0; i < 512; ++i) + rawline[i] = 0; + //memset( rawline, 0, 512); fread(&(rawline[ii++]),sizeof(char),1,fp); while( (rawline[ii-1] != '\n') && (ii<512) ) {