From 48088d651e0eafbe8440f123c0635e27c7bb7d19 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 20 Nov 2016 13:25:24 +0100 Subject: [PATCH] Changed: Use stdext::make_checked_array_iterator and stdext::make_unchecked_array_iterator with VC++ 2015 --HG-- branch : develop --- code/nel/include/nel/3d/ps_attrib_maker_template.h | 6 ++++++ code/nel/src/3d/mesh.cpp | 6 +++++- code/nel/src/3d/ps_mesh.cpp | 3 +++ code/nel/src/3d/ps_ribbon.cpp | 6 +++++- code/nel/src/3d/std3d.h | 1 + code/nel/src/3d/water_height_map.cpp | 4 ++++ 6 files changed, 24 insertions(+), 2 deletions(-) diff --git a/code/nel/include/nel/3d/ps_attrib_maker_template.h b/code/nel/include/nel/3d/ps_attrib_maker_template.h index 92953b86f..c41931ab3 100644 --- a/code/nel/include/nel/3d/ps_attrib_maker_template.h +++ b/code/nel/include/nel/3d/ps_attrib_maker_template.h @@ -24,6 +24,8 @@ #include "nel/misc/rgba.h" #include "nel/misc/traits_nl.h" +#include + namespace NL3D { /* @@ -480,7 +482,11 @@ void CPSValueGradientFunc::setValuesUnpacked(const T *valueTab, uint32 numVal _MaxValue = _MinValue = valueTab[0]; _NbValues = (numValues - 1) * nbStages; _Tab.resize(_NbValues + 1); +#ifdef NL_COMP_VC14 + std::copy(valueTab, valueTab + _NbValues + 1, stdext::make_checked_array_iterator(&_Tab[0], _Tab.size())); +#else std::copy(valueTab, valueTab + _NbValues + 1, &_Tab[0]); +#endif } diff --git a/code/nel/src/3d/mesh.cpp b/code/nel/src/3d/mesh.cpp index 0d3095182..3595c962d 100644 --- a/code/nel/src/3d/mesh.cpp +++ b/code/nel/src/3d/mesh.cpp @@ -1101,7 +1101,11 @@ bool CMeshGeom::retrieveTriangles(std::vector &indices) const else { // std::copy will convert from 16 bits index to 32 bit index - std::copy((uint16 *) iba.getPtr(), ((uint16 *) iba.getPtr()) + pb.getNumIndexes(), &indices[triIdx*3]); +#ifdef NL_COMP_VC14 + std::copy((uint16 *)iba.getPtr(), ((uint16 *)iba.getPtr()) + pb.getNumIndexes(), stdext::make_checked_array_iterator(&indices[triIdx * 3], indices.size() - triIdx * 3)); +#else + std::copy((uint16 *)iba.getPtr(), ((uint16 *)iba.getPtr()) + pb.getNumIndexes(), &indices[triIdx * 3]); +#endif } // next triIdx+= pb.getNumIndexes()/3; diff --git a/code/nel/src/3d/ps_mesh.cpp b/code/nel/src/3d/ps_mesh.cpp index 5002f0054..b1a9cc8b8 100644 --- a/code/nel/src/3d/ps_mesh.cpp +++ b/code/nel/src/3d/ps_mesh.cpp @@ -1113,6 +1113,9 @@ void CPSConstraintMesh::getShapesNames(std::string *shapesNames) const { const_cast(this)->update(); } +#ifdef NL_COMP_VC14 + std::copy(_MeshShapeFileName.begin(), _MeshShapeFileName.end(), stdext::make_unchecked_array_iterator(shapesNames)); +#else std::copy(_MeshShapeFileName.begin(), _MeshShapeFileName.end(), shapesNames); } diff --git a/code/nel/src/3d/ps_ribbon.cpp b/code/nel/src/3d/ps_ribbon.cpp index af907313f..b00b89775 100644 --- a/code/nel/src/3d/ps_ribbon.cpp +++ b/code/nel/src/3d/ps_ribbon.cpp @@ -1463,7 +1463,11 @@ void CPSRibbon::setShape(const CVector *shape, uint32 nbPointsInShape, bool brac ///================================================================================================================== void CPSRibbon::getShape(CVector *shape) const { - NL_PS_FUNC(CPSRibbon_getShape) + NL_PS_FUNC(CPSRibbon_getShape); + +#ifdef NL_COMP_VC14 + std::copy(_Shape.begin(), _Shape.end(), stdext::make_unchecked_array_iterator(shape)); +#else std::copy(_Shape.begin(), _Shape.end(), shape); } diff --git a/code/nel/src/3d/std3d.h b/code/nel/src/3d/std3d.h index 3fc5b55d6..e81f1ead4 100644 --- a/code/nel/src/3d/std3d.h +++ b/code/nel/src/3d/std3d.h @@ -34,6 +34,7 @@ #include #include #include +#include #include "nel/misc/rgba.h" #include "nel/misc/debug.h" diff --git a/code/nel/src/3d/water_height_map.cpp b/code/nel/src/3d/water_height_map.cpp index 9ab5a31f3..38ca1cacf 100644 --- a/code/nel/src/3d/water_height_map.cpp +++ b/code/nel/src/3d/water_height_map.cpp @@ -305,7 +305,11 @@ void CWaterHeightMap::makeCpy(uint buffer, uint dX, uint dY, uint sX, uint sY, { if (dest < src) { +#ifdef NL_COMP_VC14 + std::copy(src, src + width, stdext::make_unchecked_array_iterator(dest)); +#else std::copy(src, src + width, dest); +#endif } else {