|
| 1 | +diff -Naur PoissonRecon/Src/Array.h PoissonRecon_Init/Src/Array.h |
| 2 | +--- PoissonRecon/Src/Array.h 2025-08-15 12:33:30.611697574 -0400 |
| 3 | ++++ PoissonRecon_Init/Src/Array.h 2025-08-15 12:33:26.563709221 -0400 |
| 4 | +@@ -95,7 +95,11 @@ |
| 5 | + #define AlignedFreePointer( ... ) { if( __VA_ARGS__ ) aligned_free( __VA_ARGS__ ) , __VA_ARGS__ = NULL; } |
| 6 | + #define DeletePointer( ... ) { if( __VA_ARGS__ ) delete[] __VA_ARGS__ , __VA_ARGS__ = NULL; } |
| 7 | + |
| 8 | +- template< class C > C* NewPointer( size_t size , const char* name=NULL ){ return new C[size]; } |
| 9 | ++ template< class C > C* NewPointer( size_t size , const char* name=NULL ) { |
| 10 | ++ // Prevent allocation of zero elements or overflow |
| 11 | ++ if (size == 0 || size > SIZE_MAX / sizeof(C)) return nullptr; |
| 12 | ++ return new C[size](); // value-initialize array to help avoid uninitialized warnings |
| 13 | ++ } |
| 14 | + template< class C > C* AllocPointer( size_t size , const char* name=NULL ){ return (C*) malloc( sizeof(C) * size ); } |
| 15 | + template< class C > C* AlignedAllocPointer( size_t size , size_t alignment , const char* name=NULL ){ return (C*)aligned_malloc( sizeof(C) * size , alignment ); } |
| 16 | + template< class C > C* ReAllocPointer( C* c , size_t size , const char* name=NULL ){ return (C*) realloc( c , sizeof(C) * size ); } |
| 17 | +diff -Naur PoissonRecon/Src/FEMTree.h PoissonRecon_Init/Src/FEMTree.h |
| 18 | +--- PoissonRecon/Src/FEMTree.h 2025-08-15 12:33:30.613697569 -0400 |
| 19 | ++++ PoissonRecon_Init/Src/FEMTree.h 2025-08-15 12:33:26.570709201 -0400 |
| 20 | +@@ -544,7 +544,8 @@ |
| 21 | + void _remapIndices( ConstPointer( node_index_type )oldNodeIndices , size_t newNodeCount ) |
| 22 | + { |
| 23 | + Pointer( Data ) newData = NewPointer< Data >( newNodeCount ); |
| 24 | +- memset( newData , 0 , sizeof(Data)*newNodeCount ); |
| 25 | ++ if (sizeof(Data)*newNodeCount > 0 && sizeof(Data)*newNodeCount < 200*1024*1024*1024) // Large upper limit (200G) - avoiding compiler warning |
| 26 | ++ memset( newData , 0 , sizeof(Data)*newNodeCount ); |
| 27 | + for( size_t i=0 ; i<newNodeCount ; i++ ) if( oldNodeIndices[i]>=0 && oldNodeIndices[i]<(node_index_type)_sz ) newData[i] = _data[ oldNodeIndices[i] ]; |
| 28 | + DeletePointer( _data ); |
| 29 | + _data = newData; |
| 30 | +@@ -708,8 +709,8 @@ |
| 31 | + template< unsigned int Dim , class Real , typename Data , typename T , unsigned int D > |
| 32 | + struct DualPointAndDataInfo |
| 33 | + { |
| 34 | +- DualPointInfo< Dim , Real , T , D > pointInfo; |
| 35 | +- Data data; |
| 36 | ++ DualPointInfo< Dim , Real , T , D > pointInfo = {}; |
| 37 | ++ Data data = {}; |
| 38 | + DualPointAndDataInfo operator + ( const DualPointAndDataInfo& p ) const { return DualPointAndDataInfo( pointInfo + p.pointInfo , data + p.data ); } |
| 39 | + DualPointAndDataInfo operator * ( Real s ) const { return DualPointAndDataInfo( pointInfo * s , data * s ); } |
| 40 | + DualPointAndDataInfo operator / ( Real s ) const { return DualPointAndDataInfo( pointInfo / s , data / s ); } |
| 41 | +diff -Naur PoissonRecon/Src/FEMTree.inl PoissonRecon_Init/Src/FEMTree.inl |
| 42 | +--- PoissonRecon/Src/FEMTree.inl 2025-08-15 12:33:30.614697566 -0400 |
| 43 | ++++ PoissonRecon_Init/Src/FEMTree.inl 2025-08-15 12:33:26.570709201 -0400 |
| 44 | +@@ -1984,4 +1984,4 @@ |
| 45 | + |
| 46 | + MergeNodes( _tree , tree->_tree , map , nextIndex ); |
| 47 | + return map; |
| 48 | +-} |
| 49 | +\ No newline at end of file |
| 50 | ++} |
| 51 | +diff -Naur PoissonRecon/Src/FEMTree.LevelSet.3D.inl PoissonRecon_Init/Src/FEMTree.LevelSet.3D.inl |
| 52 | +--- PoissonRecon/Src/FEMTree.LevelSet.3D.inl 2025-08-15 12:33:30.612697572 -0400 |
| 53 | ++++ PoissonRecon_Init/Src/FEMTree.LevelSet.3D.inl 2025-08-15 12:33:26.568709207 -0400 |
| 54 | +@@ -606,7 +606,9 @@ |
| 55 | + { |
| 56 | + if( !sliceNode->children ) |
| 57 | + { |
| 58 | +- int d , off[Dim] , _d , _off[Dim-1]; |
| 59 | ++ int d = 0, _d = 0; |
| 60 | ++ int off[Dim] = {0}; |
| 61 | ++ int _off[Dim-1] = {0}; |
| 62 | + Point< int , Dim > p; |
| 63 | + Point< int , Dim-1 > _p; |
| 64 | + for( unsigned int d=0 ; d<Dim ; d++ ) p[d] = off[d]; |
| 65 | +@@ -887,7 +889,7 @@ |
| 66 | + { |
| 67 | + if( tree._isValidSpaceNode( tree._sNodes.treeNodes[i] ) ) |
| 68 | + { |
| 69 | +- Real squareValues[ HyperCube::Cube< Dim-1 >::template ElementNum< 0 >() ]; |
| 70 | ++ Real squareValues[ HyperCube::Cube< Dim-1 >::template ElementNum< 0 >() ] = {Real(0)}; |
| 71 | + ConstPointSupportKey< UIntPack< FEMSignature< FEMSigs >::Degree ... > >& neighborKey = neighborKeys[ thread ]; |
| 72 | + ConstCornerSupportKey< UIntPack< FEMSignature< FEMSigs >::Degree ... > >& bNeighborKey = bNeighborKeys[ thread ]; |
| 73 | + TreeNode* leaf = tree._sNodes.treeNodes[i]; |
| 74 | +@@ -977,7 +979,7 @@ |
| 75 | + bool useBoundaryEvaluation = false; |
| 76 | + ThreadPool::ParallelFor( tree._sNodesBegin(depth,slice-(zDir==HyperCube::BACK ? 0 : 1)) , tree._sNodesEnd(depth,slice-(zDir==HyperCube::BACK ? 0 : 1)) , [&]( unsigned int thread , size_t i ) |
| 77 | + { |
| 78 | +- Real squareValues[ HyperCube::Cube< Dim-1 >::template ElementNum< 0 >() ]; |
| 79 | ++ Real squareValues[ HyperCube::Cube< Dim-1 >::template ElementNum< 0 >() ] = {Real(0)}; |
| 80 | + TreeNode* leaf = tree._sNodes.treeNodes[i]; |
| 81 | + |
| 82 | + if( tree._isValidSpaceNode( leaf ) && !IsActiveNode< Dim >( leaf->children ) ) |
| 83 | +@@ -1706,7 +1708,8 @@ |
| 84 | + Point< Real , 3 > dx0 , dx1; |
| 85 | + if( gradientNormals ) dx0 = sValues.cornerGradients[idx[c0]] , dx1 = sValues.cornerGradients[idx[c1]]; |
| 86 | + Point< Real , Dim > s; |
| 87 | +- Real start , width; |
| 88 | ++ Real start = Real(0); |
| 89 | ++ Real width = Real(0); |
| 90 | + tree._startAndWidth( node , s , width ); |
| 91 | + int o; |
| 92 | + { |
| 93 | +@@ -1924,7 +1927,7 @@ |
| 94 | + } |
| 95 | + if( isCoplanar ) |
| 96 | + { |
| 97 | +- Vertex c; |
| 98 | ++ Vertex c = Vertex(); |
| 99 | + c *= 0; |
| 100 | + for( unsigned int i=0 ; i<polygon.size() ; i++ ) c += polygon[i].second; |
| 101 | + c /= ( typename Vertex::Real )polygon.size(); |
| 102 | +diff -Naur PoissonRecon/Src/Geometry.h PoissonRecon_Init/Src/Geometry.h |
| 103 | +--- PoissonRecon/Src/Geometry.h 2025-08-15 12:33:30.615697563 -0400 |
| 104 | ++++ PoissonRecon_Init/Src/Geometry.h 2025-08-15 12:33:26.571709198 -0400 |
| 105 | +@@ -112,7 +112,7 @@ |
| 106 | + } |
| 107 | + |
| 108 | + protected: |
| 109 | +- FirstType _first; |
| 110 | ++ FirstType _first = {}; |
| 111 | + DirectSum< Real , RestTypes... > _rest; |
| 112 | + |
| 113 | + void _write( std::ostream &os ) const |
| 114 | +@@ -195,7 +195,7 @@ |
| 115 | + } |
| 116 | + static void _AddColumnVector( XForm< Real , Dim >& x , unsigned int c ){ ; } |
| 117 | + public: |
| 118 | +- Real coords[Dim]; |
| 119 | ++ Real coords[Dim] = {}; |
| 120 | + Point( void ) { memset( coords , 0 , sizeof(Real)*Dim ); } |
| 121 | + Point( const Point& p ){ memcpy( coords , p.coords , sizeof(Real)*Dim ); } |
| 122 | + template< class ... _Reals > Point( _Reals ... values ){ static_assert( sizeof...(values)==Dim || sizeof...(values)==0 , "[ERROR] Point::Point: Invalid number of coefficients" ) ; _init( 0 , values... ); } |
| 123 | +diff -Naur PoissonRecon/Src/RegularTree.inl PoissonRecon_Init/Src/RegularTree.inl |
| 124 | +--- PoissonRecon/Src/RegularTree.inl 2025-08-15 12:33:30.615697563 -0400 |
| 125 | ++++ PoissonRecon_Init/Src/RegularTree.inl 2025-08-15 12:33:26.587709152 -0400 |
| 126 | +@@ -236,7 +236,7 @@ |
| 127 | + if( !children ) return 0; |
| 128 | + else |
| 129 | + { |
| 130 | +- int c , d; |
| 131 | ++ int c = 0, d = 0; |
| 132 | + for( int i=0 ; i<(1<<Dim) ; i++ ) |
| 133 | + { |
| 134 | + d = children[i].maxDepth(); |
0 commit comments