diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-25 10:04:52 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-25 11:26:27 +0300 |
commit | 891949cbb47143420f4324cb60efc05ef5d70b39 (patch) | |
tree | fe70a45612ae96f9ce1f37378ef5ff035d3127f5 /source/blender/freestyle | |
parent | c9e35c2ced92082c86f1ecb9ecd16c6230218c7c (diff) |
Cleanup: use 'u' prefixed integer types for brevity & cast style
To use function style cast '(unsigned char)x' can't be replaced by
'unsigned char(x)'.
Diffstat (limited to 'source/blender/freestyle')
48 files changed, 163 insertions, 168 deletions
diff --git a/source/blender/freestyle/intern/application/AppCanvas.cpp b/source/blender/freestyle/intern/application/AppCanvas.cpp index ee316bbf220..0367f5c1d6d 100644 --- a/source/blender/freestyle/intern/application/AppCanvas.cpp +++ b/source/blender/freestyle/intern/application/AppCanvas.cpp @@ -89,7 +89,7 @@ void AppCanvas::init() void AppCanvas::postDraw() { - for (unsigned int i = 0; i < _StyleModules.size(); i++) { + for (uint i = 0; i < _StyleModules.size(); i++) { if (!_StyleModules[i]->getDisplayed() || !_Layers[i]) { continue; } diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index cc815b5317f..08480533937 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -1051,7 +1051,7 @@ void Controller::displayDensityCurves(int x, int y) return; } - unsigned int i, j; + uint i, j; using densityCurve = vector<Vec3r>; vector<densityCurve> curves(svm->getNumberOfOrientations() + 1); vector<densityCurve> curvesDirection(svm->getNumberOfPyramidLevels()); diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp index 82fec9bd802..27c4bbe9bc4 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp @@ -273,7 +273,7 @@ void BlenderFileLoader::addTriangle(struct LoaderState *ls, #if 0 float len; #endif - unsigned int i, j; + uint i, j; IndexedFaceSet::FaceEdgeMark marks = 0; // initialize the bounding box by the first vertex @@ -549,7 +549,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) copy_v3_v3(n3, facenormal); } - unsigned int numTris = countClippedFaces(v1, v2, v3, clip); + uint numTris = countClippedFaces(v1, v2, v3, clip); if (numTris == 0) { continue; } @@ -578,7 +578,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) } else { // find if the Blender material is already in the list - unsigned int i = 0; + uint i = 0; bool found = false; for (vector<Material *>::iterator it = meshMaterials.begin(), itend = meshMaterials.end(); @@ -624,22 +624,22 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) // We might have several times the same vertex. We want a clean // shape with no real-vertex. Here, we are making a cleaning pass. float *cleanVertices = nullptr; - unsigned int cvSize; - unsigned int *cleanVIndices = nullptr; + uint cvSize; + uint *cleanVIndices = nullptr; GeomCleaner::CleanIndexedVertexArray( vertices, vSize, VIndices, viSize, &cleanVertices, &cvSize, &cleanVIndices); float *cleanNormals = nullptr; - unsigned int cnSize; - unsigned int *cleanNIndices = nullptr; + uint cnSize; + uint *cleanNIndices = nullptr; GeomCleaner::CleanIndexedVertexArray( normals, nSize, NIndices, niSize, &cleanNormals, &cnSize, &cleanNIndices); // format materials array FrsMaterial **marray = new FrsMaterial *[meshFrsMaterials.size()]; - unsigned int mindex = 0; + uint mindex = 0; for (vector<FrsMaterial>::iterator m = meshFrsMaterials.begin(), mend = meshFrsMaterials.end(); m != mend; ++m) { @@ -695,7 +695,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) detri.v = zero; detri.n = 0; - for (unsigned int j = 0; j < viSize; j += 3) { + for (uint j = 0; j < viSize; j += 3) { if (i == j) { continue; } @@ -754,7 +754,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) if (G.debug & G_DEBUG_FREESTYLE) { printf("Warning: Object %s contains %lu degenerated triangle%s (strokes may be incorrect)\n", name, - (long unsigned int)detriList.size(), + (ulong)detriList.size(), (detriList.size() > 1) ? "s" : ""); } } diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index a3085768ea3..ba583ecb2e1 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -187,7 +187,7 @@ float BlenderStrokeRenderer::get_stroke_vertex_z() const return -z; } -unsigned int BlenderStrokeRenderer::get_stroke_mesh_id() const +uint BlenderStrokeRenderer::get_stroke_mesh_id() const { unsigned mesh_id = _mesh_id; BlenderStrokeRenderer *self = const_cast<BlenderStrokeRenderer *>(this); @@ -812,7 +812,7 @@ Object *BlenderStrokeRenderer::NewMesh() const { Object *ob; char name[MAX_ID_NAME]; - unsigned int mesh_id = get_stroke_mesh_id(); + uint mesh_id = get_stroke_mesh_id(); BLI_snprintf(name, MAX_ID_NAME, "0%08xOB", mesh_id); ob = BKE_object_add_only_object(freestyle_bmain, OB_MESH, name); diff --git a/source/blender/freestyle/intern/geometry/FastGrid.cpp b/source/blender/freestyle/intern/geometry/FastGrid.cpp index 442087040bc..f87b25ebc71 100644 --- a/source/blender/freestyle/intern/geometry/FastGrid.cpp +++ b/source/blender/freestyle/intern/geometry/FastGrid.cpp @@ -20,7 +20,7 @@ void FastGrid::clear() return; } - for (unsigned int i = 0; i < _cells_size; i++) { + for (uint i = 0; i < _cells_size; i++) { if (_cells[i]) { delete _cells[i]; } diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp index 605601af7cc..736191da87e 100644 --- a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp +++ b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp @@ -172,9 +172,9 @@ struct GeomCleanerHasher { #define _MOD 2147483647UL inline size_t operator()(const Vec3r &p) const { - size_t res = ((unsigned long)(p[0] * _MUL)) % _MOD; - res = (res + (unsigned long)(p[1]) * _MUL) % _MOD; - return (res + (unsigned long)(p[2]) * _MUL) % _MOD; + size_t res = ((ulong)(p[0] * _MUL)) % _MOD; + res = (res + (ulong)(p[1]) * _MUL) % _MOD; + return (res + (ulong)(p[2]) * _MUL) % _MOD; } #undef _MUL #undef _MOD diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.cpp b/source/blender/freestyle/intern/geometry/GeomUtils.cpp index ca1fb63ec64..742d5f2fd02 100644 --- a/source/blender/freestyle/intern/geometry/GeomUtils.cpp +++ b/source/blender/freestyle/intern/geometry/GeomUtils.cpp @@ -607,9 +607,9 @@ void transformVertex(const Vec3r &vert, const Matrix44r &matrix, Vec3r &res) { HVec3r hvert(vert), res_tmp; real scale; - for (unsigned int j = 0; j < 4; j++) { + for (uint j = 0; j < 4; j++) { scale = hvert[j]; - for (unsigned int i = 0; i < 4; i++) { + for (uint i = 0; i < 4; i++) { res_tmp[i] += matrix(i, j) * scale; } } @@ -631,9 +631,9 @@ void transformVertices(const vector<Vec3r> &vertices, const Matrix44r &trans, ve Vec3r rotateVector(const Matrix44r &mat, const Vec3r &v) { Vec3r res; - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { res[i] = 0; - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { res[i] += mat(i, j) * v[j]; } } @@ -718,9 +718,9 @@ void fromCameraToWorld(const Vec3r &p, Vec3r &q, const real model_view_matrix[4] model_view_matrix[1][3], model_view_matrix[2][3], }; - for (unsigned short i = 0; i < 3; i++) { + for (ushort i = 0; i < 3; i++) { q[i] = 0.0; - for (unsigned short j = 0; j < 3; j++) { + for (ushort j = 0; j < 3; j++) { q[i] += model_view_matrix[j][i] * (p[j] - translation[j]); } } @@ -751,7 +751,7 @@ inline bool intersect2dSegPoly(Vec2r *seg, Vec2r *poly, unsigned n) Vec2r dseg = seg[1] - seg[0]; // the segment direction vector Vec2r e; // edge vector - for (unsigned int i = 0; i < n; i++) { // process polygon edge poly[i]poly[i+1] + for (uint i = 0; i < n; i++) { // process polygon edge poly[i]poly[i+1] e = poly[i + 1] - poly[i]; N = PERP(e, seg[0] - poly[i]); D = -PERP(e, dseg); @@ -790,7 +790,7 @@ inline bool overlapPlaneBox(Vec3r &normal, real d, Vec3r &maxbox) { Vec3r vmin, vmax; - for (unsigned int q = X; q <= Z; q++) { + for (uint q = X; q <= Z; q++) { if (normal[q] > 0.0f) { vmin[q] = -maxbox[q]; vmax[q] = maxbox[q]; @@ -814,8 +814,8 @@ inline void fromCoordAToCoordB(const Vec3r &p, Vec3r &q, const real transform[4] HVec3r hp(p); HVec3r hq(0, 0, 0, 0); - for (unsigned int i = 0; i < 4; i++) { - for (unsigned int j = 0; j < 4; j++) { + for (uint i = 0; i < 4; i++) { + for (uint j = 0; j < 4; j++) { hq[i] += transform[i][j] * hp[j]; } } @@ -825,7 +825,7 @@ inline void fromCoordAToCoordB(const Vec3r &p, Vec3r &q, const real transform[4] return; } - for (unsigned int k = 0; k < 3; k++) { + for (uint k = 0; k < 3; k++) { q[k] = hq[k] / hq[3]; } } diff --git a/source/blender/freestyle/intern/geometry/Grid.cpp b/source/blender/freestyle/intern/geometry/Grid.cpp index 2b2272959e4..33c7d04cb4c 100644 --- a/source/blender/freestyle/intern/geometry/Grid.cpp +++ b/source/blender/freestyle/intern/geometry/Grid.cpp @@ -354,8 +354,8 @@ bool Grid::initInfiniteRay(const Vec3r &orig, const Vec3r &dir, unsigned timesta Vec3r boxMax(_orig + _size); BBox<Vec3r> box(boxMin, boxMax); if (box.inside(orig)) { - for (unsigned int i = 0; i < 3; i++) { - _current_cell[i] = (unsigned int)floor((orig[i] - _orig[i]) / _cell_size[i]); + for (uint i = 0; i < 3; i++) { + _current_cell[i] = (uint)floor((orig[i] - _orig[i]) / _cell_size[i]); // soc unused - unsigned u = _current_cell[i]; _pt[i] = orig[i] - _orig[i] - _current_cell[i] * _cell_size[i]; } @@ -366,7 +366,7 @@ bool Grid::initInfiniteRay(const Vec3r &orig, const Vec3r &dir, unsigned timesta if (GeomUtils::intersectRayBBox(orig, _ray_dir, boxMin, boxMax, 0, _t_end, tmin, tmax)) { BLI_assert(tmin != -1.0); Vec3r newOrig = orig + tmin * _ray_dir; - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { _current_cell[i] = (unsigned)floor((newOrig[i] - _orig[i]) / _cell_size[i]); if (_current_cell[i] == _cells_nb[i]) { _current_cell[i] = _cells_nb[i] - 1; diff --git a/source/blender/freestyle/intern/image/ImagePyramid.cpp b/source/blender/freestyle/intern/image/ImagePyramid.cpp index 2a555a22915..f595efabe0b 100644 --- a/source/blender/freestyle/intern/image/ImagePyramid.cpp +++ b/source/blender/freestyle/intern/image/ImagePyramid.cpp @@ -54,9 +54,9 @@ float ImagePyramid::pixel(int x, int y, int level) if (0 == level) { return img->pixel(x, y); } - unsigned int i = 1 << level; - unsigned int sx = x >> level; - unsigned int sy = y >> level; + uint i = 1 << level; + uint sx = x >> level; + uint sy = y >> level; if (sx >= img->width()) { sx = img->width() - 1; } @@ -141,12 +141,12 @@ void GaussianPyramid::BuildPyramid(GrayImage *level0, unsigned nbLevels) unsigned w = pLevel->width(); unsigned h = pLevel->height(); if (nbLevels != 0) { - for (unsigned int i = 0; i < nbLevels; ++i) { // soc + for (uint i = 0; i < nbLevels; ++i) { // soc w = pLevel->width() >> 1; h = pLevel->height() >> 1; GrayImage *img = new GrayImage(w, h); - for (unsigned int y = 0; y < h; ++y) { - for (unsigned int x = 0; x < w; ++x) { + for (uint y = 0; y < h; ++y) { + for (uint x = 0; x < w; ++x) { float v = gf.getSmoothedPixel<GrayImage>(pLevel, 2 * x, 2 * y); img->setPixel(x, y, v); } @@ -160,8 +160,8 @@ void GaussianPyramid::BuildPyramid(GrayImage *level0, unsigned nbLevels) w = pLevel->width() >> 1; h = pLevel->height() >> 1; GrayImage *img = new GrayImage(w, h); - for (unsigned int y = 0; y < h; ++y) { - for (unsigned int x = 0; x < w; ++x) { + for (uint y = 0; y < h; ++y) { + for (uint x = 0; x < w; ++x) { float v = gf.getSmoothedPixel<GrayImage>(pLevel, 2 * x, 2 * y); img->setPixel(x, y, v); } diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp index 02ed3f463c7..0701b1c4ef3 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.cpp +++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp @@ -236,7 +236,7 @@ PyObject *BPy_FEdge_from_FEdge(FEdge &fe) return py_fe; } -PyObject *BPy_Nature_from_Nature(unsigned short n) +PyObject *BPy_Nature_from_Nature(ushort n) { PyObject *args = PyTuple_New(1); PyTuple_SET_ITEM(args, 0, PyLong_FromLong(n)); diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp index bd37e84761e..7eccf0403ae 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp @@ -282,7 +282,7 @@ static Mathutils_Callback FrsMaterial_mathutils_cb = { FrsMaterial_mathutils_set_index, }; -static unsigned char FrsMaterial_mathutils_cb_index = -1; +static uchar FrsMaterial_mathutils_cb_index = -1; void FrsMaterial_mathutils_register_callback() { @@ -517,7 +517,7 @@ static PyObject *BPy_FrsMaterial_richcmpr(PyObject *objectA, static Py_hash_t FrsMaterial_hash(PyObject *self) { - return (Py_uhash_t)BLI_hash_mm2((const unsigned char *)self, sizeof(*self), 0); + return (Py_uhash_t)BLI_hash_mm2((const uchar *)self, sizeof(*self), 0); } /*-----------------------BPy_FrsMaterial type definition ------------------------------*/ diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp index 5bdc8ce16e8..218749b2672 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp @@ -121,7 +121,7 @@ static PyObject *FrsNoise_turbulence1(BPy_FrsNoise *self, PyObject *args, PyObje { static const char *kwlist[] = {"v", "freq", "amp", "oct", nullptr}; float f1, f2, f3; - unsigned int i = 4; + uint i = 4; if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff|I", (char **)kwlist, &f1, &f2, &f3, &i)) { return nullptr; @@ -150,7 +150,7 @@ static PyObject *FrsNoise_turbulence2(BPy_FrsNoise *self, PyObject *args, PyObje static const char *kwlist[] = {"v", "freq", "amp", "oct", nullptr}; PyObject *obj1; float f2, f3; - unsigned int i = 4; + uint i = 4; Vec2f vec; if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i)) { @@ -186,7 +186,7 @@ static PyObject *FrsNoise_turbulence3(BPy_FrsNoise *self, PyObject *args, PyObje static const char *kwlist[] = {"v", "freq", "amp", "oct", nullptr}; PyObject *obj1; float f2, f3; - unsigned int i = 4; + uint i = 4; Vec3f vec; if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i)) { diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp index fc7581a93c0..d88d3edecc0 100644 --- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp +++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp @@ -82,8 +82,8 @@ static PyObject *Integrator_integrate(PyObject * /*self*/, PyObject *args, PyObj return PyFloat_FromDouble(res); } if (BPy_UnaryFunction0DUnsigned_Check(obj1)) { - UnaryFunction0D<unsigned int> *fun = ((BPy_UnaryFunction0DUnsigned *)obj1)->uf0D_unsigned; - unsigned int res = integrate(*fun, it, it_end, t); + UnaryFunction0D<uint> *fun = ((BPy_UnaryFunction0DUnsigned *)obj1)->uf0D_unsigned; + uint res = integrate(*fun, it, it_end, t); return PyLong_FromLong(res); } diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp index 20fd091c249..1c5e90474ab 100644 --- a/source/blender/freestyle/intern/python/BPy_Operators.cpp +++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp @@ -585,7 +585,7 @@ static PyObject *Operators_get_viewedge_from_index(BPy_Operators * /*self*/, PyObject *kwds) { static const char *kwlist[] = {"i", nullptr}; - unsigned int i; + uint i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) { return nullptr; @@ -612,7 +612,7 @@ static PyObject *Operators_get_chain_from_index(BPy_Operators * /*self*/, PyObject *kwds) { static const char *kwlist[] = {"i", nullptr}; - unsigned int i; + uint i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) { return nullptr; @@ -639,7 +639,7 @@ static PyObject *Operators_get_stroke_from_index(BPy_Operators * /*self*/, PyObject *kwds) { static const char *kwlist[] = {"i", nullptr}; - unsigned int i; + uint i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) { return nullptr; diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp index fb72ed0ca62..5e504772786 100644 --- a/source/blender/freestyle/intern/python/BPy_SShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp @@ -224,7 +224,7 @@ static PyObject *SShape_vertices_get(BPy_SShape *self, void *UNUSED(closure)) vector<SVertex *> vertices = self->ss->getVertexList(); vector<SVertex *>::iterator it; PyObject *py_vertices = PyList_New(vertices.size()); - unsigned int i = 0; + uint i = 0; for (it = vertices.begin(); it != vertices.end(); it++) { PyList_SET_ITEM(py_vertices, i++, BPy_SVertex_from_SVertex(*(*it))); @@ -244,7 +244,7 @@ static PyObject *SShape_edges_get(BPy_SShape *self, void *UNUSED(closure)) vector<FEdge *> edges = self->ss->getEdgeList(); vector<FEdge *>::iterator it; PyObject *py_edges = PyList_New(edges.size()); - unsigned int i = 0; + uint i = 0; for (it = edges.begin(); it != edges.end(); it++) { PyList_SET_ITEM(py_edges, i++, Any_BPy_FEdge_from_FEdge(*(*it))); diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp index 7dddf90f2b3..86d7a726883 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp @@ -531,7 +531,7 @@ static Mathutils_Callback StrokeAttribute_mathutils_cb = { StrokeAttribute_mathutils_set_index, }; -static unsigned char StrokeAttribute_mathutils_cb_index = -1; +static uchar StrokeAttribute_mathutils_cb_index = -1; void StrokeAttribute_mathutils_register_callback() { diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp index 806739239de..319058ea719 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp @@ -200,7 +200,7 @@ static PyObject *ViewShape_vertices_get(BPy_ViewShape *self, void *UNUSED(closur vector<ViewVertex *> vertices = self->vs->vertices(); vector<ViewVertex *>::iterator it; PyObject *py_vertices = PyList_New(vertices.size()); - unsigned int i = 0; + uint i = 0; for (it = vertices.begin(); it != vertices.end(); it++) { PyList_SET_ITEM(py_vertices, i++, Any_BPy_ViewVertex_from_ViewVertex(*(*it))); @@ -219,7 +219,7 @@ static int ViewShape_vertices_set(BPy_ViewShape *self, PyObject *value, void *UN } v.reserve(PyList_GET_SIZE(value)); - for (unsigned int i = 0; i < PyList_GET_SIZE(value); i++) { + for (uint i = 0; i < PyList_GET_SIZE(value); i++) { item = PyList_GET_ITEM(value, i); if (BPy_ViewVertex_Check(item)) { v.push_back(((BPy_ViewVertex *)item)->vv); @@ -243,7 +243,7 @@ static PyObject *ViewShape_edges_get(BPy_ViewShape *self, void *UNUSED(closure)) vector<ViewEdge *> edges = self->vs->edges(); vector<ViewEdge *>::iterator it; PyObject *py_edges = PyList_New(edges.size()); - unsigned int i = 0; + uint i = 0; for (it = edges.begin(); it != edges.end(); it++) { PyList_SET_ITEM(py_edges, i++, BPy_ViewEdge_from_ViewEdge(*(*it))); diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp index ff59e5b1a10..09202127ad2 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp @@ -251,7 +251,7 @@ static Mathutils_Callback SVertex_mathutils_cb = { SVertex_mathutils_set_index, }; -static unsigned char SVertex_mathutils_cb_index = -1; +static uchar SVertex_mathutils_cb_index = -1; void SVertex_mathutils_register_callback() { @@ -338,7 +338,7 @@ static PyObject *SVertex_normals_get(BPy_SVertex *self, void *UNUSED(closure)) set<Vec3r> normals = self->sv->normals(); set<Vec3r>::iterator it; py_normals = PyList_New(normals.size()); - unsigned int i = 0; + uint i = 0; for (it = normals.begin(); it != normals.end(); it++) { Vec3r v(*it); diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp index 1c1d8bf032a..54996067e72 100644 --- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp @@ -206,7 +206,7 @@ static Mathutils_Callback StrokeVertex_mathutils_cb = { StrokeVertex_mathutils_set_index, }; -static unsigned char StrokeVertex_mathutils_cb_index = -1; +static uchar StrokeVertex_mathutils_cb_index = -1; void StrokeVertex_mathutils_register_callback() { diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp index 57c00ab1b99..1c1136bbae7 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp @@ -378,7 +378,7 @@ static PyObject *Stroke_texture_id_get(BPy_Stroke *self, void *UNUSED(closure)) static int Stroke_texture_id_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure)) { - unsigned int i = PyLong_AsUnsignedLong(value); + uint i = PyLong_AsUnsignedLong(value); if (PyErr_Occurred()) { return -1; } diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp index 840f49ff345..e32910cf53d 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp @@ -178,7 +178,7 @@ static Mathutils_Callback FEdgeSharp_mathutils_cb = { FEdgeSharp_mathutils_set_index, }; -static unsigned char FEdgeSharp_mathutils_cb_index = -1; +static uchar FEdgeSharp_mathutils_cb_index = -1; void FEdgeSharp_mathutils_register_callback() { @@ -250,7 +250,7 @@ static int FEdgeSharp_material_index_right_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure)) { - unsigned int i = PyLong_AsUnsignedLong(value); + uint i = PyLong_AsUnsignedLong(value); if (PyErr_Occurred()) { return -1; } @@ -272,7 +272,7 @@ static int FEdgeSharp_material_index_left_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure)) { - unsigned int i = PyLong_AsUnsignedLong(value); + uint i = PyLong_AsUnsignedLong(value); if (PyErr_Occurred()) { return -1; } diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp index bf62d5bd31d..93943dcda05 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp @@ -129,7 +129,7 @@ static Mathutils_Callback FEdgeSmooth_mathutils_cb = { FEdgeSmooth_mathutils_set_index, }; -static unsigned char FEdgeSmooth_mathutils_cb_index = -1; +static uchar FEdgeSmooth_mathutils_cb_index = -1; void FEdgeSmooth_mathutils_register_callback() { @@ -173,7 +173,7 @@ static int FEdgeSmooth_material_index_set(BPy_FEdgeSmooth *self, PyObject *value, void *UNUSED(closure)) { - unsigned int i = PyLong_AsUnsignedLong(value); + uint i = PyLong_AsUnsignedLong(value); if (PyErr_Occurred()) { return -1; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp index be1b9f42ce4..29e1a1d3525 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp @@ -64,7 +64,7 @@ static int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned *self, if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; } - self->uf0D_unsigned = new UnaryFunction0D<unsigned int>(); + self->uf0D_unsigned = new UnaryFunction0D<uint>(); self->uf0D_unsigned->py_uf0D = (PyObject *)self; return 0; } @@ -93,7 +93,7 @@ static PyObject *UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned *s return nullptr; } - if (typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D<unsigned int>)) { + if (typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D<uint>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return nullptr; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp index 6d17f6debdf..e0aa5af2adb 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp @@ -106,9 +106,9 @@ static PyObject *UnaryFunction0DVectorViewShape___call__(BPy_UnaryFunction0DVect return nullptr; } - const unsigned int list_len = self->uf0D_vectorviewshape->result.size(); + const uint list_len = self->uf0D_vectorviewshape->result.size(); PyObject *list = PyList_New(list_len); - for (unsigned int i = 0; i < list_len; i++) { + for (uint i = 0; i < list_len; i++) { ViewShape *v = self->uf0D_vectorviewshape->result[i]; PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None)); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp index f0435ea1294..3a2c9868014 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp @@ -47,7 +47,7 @@ static int ReadSteerableViewMapPixelF0D___init__(BPy_ReadSteerableViewMapPixelF0 PyObject *kwds) { static const char *kwlist[] = {"orientation", "level", nullptr}; - unsigned int u; + uint u; int i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "Ii", (char **)kwlist, &u, &i)) { diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp index e9023d90b42..8929e9e4024 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp @@ -74,11 +74,10 @@ static int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned *self, } if (!obj) { - self->uf1D_unsigned = new UnaryFunction1D<unsigned int>(); + self->uf1D_unsigned = new UnaryFunction1D<uint>(); } else { - self->uf1D_unsigned = new UnaryFunction1D<unsigned int>( - IntegrationType_from_BPy_IntegrationType(obj)); + self->uf1D_unsigned = new UnaryFunction1D<uint>(IntegrationType_from_BPy_IntegrationType(obj)); } self->uf1D_unsigned->py_uf1D = (PyObject *)self; @@ -109,7 +108,7 @@ static PyObject *UnaryFunction1DUnsigned___call__(BPy_UnaryFunction1DUnsigned *s return nullptr; } - if (typeid(*(self->uf1D_unsigned)) == typeid(UnaryFunction1D<unsigned int>)) { + if (typeid(*(self->uf1D_unsigned)) == typeid(UnaryFunction1D<uint>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return nullptr; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp index df504b1cdaa..44f12c9e307 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -136,9 +136,9 @@ static PyObject *UnaryFunction1DVectorViewShape___call__(BPy_UnaryFunction1DVect return nullptr; } - const unsigned int list_len = self->uf1D_vectorviewshape->result.size(); + const uint list_len = self->uf1D_vectorviewshape->result.size(); PyObject *list = PyList_New(list_len); - for (unsigned int i = 0; i < list_len; i++) { + for (uint i = 0; i < list_len; i++) { ViewShape *v = self->uf1D_vectorviewshape->result[i]; PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None)); } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp index c4d4aedc954..b513686524e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp @@ -67,7 +67,7 @@ static int GetDirectionalViewMapDensityF1D___init__(BPy_GetDirectionalViewMapDen { static const char *kwlist[] = {"orientation", "level", "integration_type", "sampling", nullptr}; PyObject *obj = nullptr; - unsigned int u1, u2; + uint u1, u2; float f = 2.0; if (!PyArg_ParseTupleAndKeywords( diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp index d02ff6990a5..c3559fe6e15 100644 --- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp +++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp @@ -68,7 +68,7 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices, _FrsMaterials = nullptr; if (iMaterials) { _FrsMaterials = new FrsMaterial *[_MSize]; - for (unsigned int i = 0; i < _MSize; ++i) { + for (uint i = 0; i < _MSize; ++i) { _FrsMaterials[i] = new FrsMaterial(*(iMaterials[i])); } } @@ -161,7 +161,7 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother) _MSize = iBrother.msize(); if (_MSize) { _FrsMaterials = new FrsMaterial *[_MSize]; - for (unsigned int i = 0; i < _MSize; ++i) { + for (uint i = 0; i < _MSize; ++i) { _FrsMaterials[i] = new FrsMaterial(*(iBrother._FrsMaterials[i])); } } @@ -224,7 +224,7 @@ IndexedFaceSet::~IndexedFaceSet() } if (nullptr != _FrsMaterials) { - for (unsigned int i = 0; i < _MSize; ++i) { + for (uint i = 0; i < _MSize; ++i) { delete _FrsMaterials[i]; } delete[] _FrsMaterials; @@ -290,7 +290,7 @@ void IndexedFaceSet::ComputeBBox() // parse all the coordinates to find the Xmax, YMax, ZMax float *v = _Vertices; - for (unsigned int i = 0; i < (_VSize / 3); ++i) { + for (uint i = 0; i < (_VSize / 3); ++i) { if (*v > XMax) { XMax = *v; } diff --git a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp index 31101e988e5..97fa07df4c9 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp +++ b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp @@ -122,7 +122,7 @@ void NodeTransform::AddBBox(const BBox<Vec3r> &iBBox) // Computes the transform iBBox HVec3r tbox[8]; - unsigned int i; + uint i; for (i = 0; i < 8; i++) { tbox[i] = _Matrix * box[i]; } @@ -130,7 +130,7 @@ void NodeTransform::AddBBox(const BBox<Vec3r> &iBBox) Vec3r newMin(tbox[0]); Vec3r newMax(tbox[0]); for (i = 0; i < 8; i++) { - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { if (newMin[j] > tbox[i][j]) { newMin[j] = tbox[i][j]; } @@ -147,9 +147,9 @@ void NodeTransform::AddBBox(const BBox<Vec3r> &iBBox) bool NodeTransform::isScaled(const Matrix44r &M) { - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { real norm = 0; - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { norm += M(i, j) * M(i, j); } if ((norm > 1.01) || (norm < 0.99)) { diff --git a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp index af41421fa72..3e6c8f924a1 100644 --- a/source/blender/freestyle/intern/scene_graph/SceneHash.cpp +++ b/source/blender/freestyle/intern/scene_graph/SceneHash.cpp @@ -20,22 +20,22 @@ string SceneHash::toString() void SceneHash::visitNodeViewLayer(NodeViewLayer &node) { struct RenderData *r = &node.scene().r; - adler32((unsigned char *)&r->xsch, sizeof(r->xsch)); // resolution_x - adler32((unsigned char *)&r->ysch, sizeof(r->ysch)); // resolution_y - adler32((unsigned char *)&r->size, sizeof(r->size)); // resolution_percentage + adler32((uchar *)&r->xsch, sizeof(r->xsch)); // resolution_x + adler32((uchar *)&r->ysch, sizeof(r->ysch)); // resolution_y + adler32((uchar *)&r->size, sizeof(r->size)); // resolution_percentage struct FreestyleConfig *config = &node.sceneLayer().freestyle_config; - adler32((unsigned char *)&config->flags, sizeof(config->flags)); - adler32((unsigned char *)&config->crease_angle, sizeof(config->crease_angle)); - adler32((unsigned char *)&config->sphere_radius, sizeof(config->sphere_radius)); - adler32((unsigned char *)&config->dkr_epsilon, sizeof(config->dkr_epsilon)); + adler32((uchar *)&config->flags, sizeof(config->flags)); + adler32((uchar *)&config->crease_angle, sizeof(config->crease_angle)); + adler32((uchar *)&config->sphere_radius, sizeof(config->sphere_radius)); + adler32((uchar *)&config->dkr_epsilon, sizeof(config->dkr_epsilon)); } void SceneHash::visitNodeCamera(NodeCamera &cam) { double *proj = cam.projectionMatrix(); for (int i = 0; i < 16; i++) { - adler32((unsigned char *)&proj[i], sizeof(double)); + adler32((uchar *)&proj[i], sizeof(double)); } } @@ -45,13 +45,13 @@ void SceneHash::visitIndexedFaceSet(IndexedFaceSet &ifs) const unsigned n = ifs.vsize(); for (unsigned i = 0; i < n; i++) { - adler32((unsigned char *)&v[i], sizeof(v[i])); + adler32((uchar *)&v[i], sizeof(v[i])); } } static const int MOD_ADLER = 65521; -void SceneHash::adler32(const unsigned char *data, int size) +void SceneHash::adler32(const uchar *data, int size) { uint32_t sum1 = _sum & 0xffff; uint32_t sum2 = (_sum >> 16) & 0xffff; diff --git a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp index 623b6b0e2bf..5ac41b6f234 100644 --- a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp +++ b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp @@ -77,7 +77,7 @@ void ScenePrettyPrinter::visitIndexedFaceSet(IndexedFaceSet &ifs) _ofs << _space << "IndexedFaceSet" << endl; const float *p = vertices; - for (unsigned int i = 0; i < vsize / 3; i++) { + for (uint i = 0; i < vsize / 3; i++) { _ofs << _space << " " << setw(3) << setfill('0') << i << ": " << p[0] << ", " << p[1] << ", " << p[2] << endl; p += 3; diff --git a/source/blender/freestyle/intern/stroke/Canvas.cpp b/source/blender/freestyle/intern/stroke/Canvas.cpp index 68a18323621..46620bbcac2 100644 --- a/source/blender/freestyle/intern/stroke/Canvas.cpp +++ b/source/blender/freestyle/intern/stroke/Canvas.cpp @@ -91,7 +91,7 @@ void Canvas::Draw() preDraw(); TimeStamp *timestamp = TimeStamp::instance(); - for (unsigned int i = 0; i < _StyleModules.size(); ++i) { + for (uint i = 0; i < _StyleModules.size(); ++i) { _current_sm = _StyleModules[i]; if (i < _Layers.size() && _Layers[i]) { @@ -184,7 +184,7 @@ void Canvas::InsertStyleModule(unsigned index, StyleModule *iStyleModule) void Canvas::RemoveStyleModule(unsigned index) { - unsigned int i = 0; + uint i = 0; if (!_StyleModules.empty()) { for (deque<StyleModule *>::iterator s = _StyleModules.begin(), send = _StyleModules.end(); s != send; @@ -257,17 +257,17 @@ void Canvas::setModified(unsigned index, bool iMod) void Canvas::resetModified(bool iMod /* = false */) { - unsigned int size = _StyleModules.size(); - for (unsigned int i = 0; i < size; ++i) { + uint size = _StyleModules.size(); + for (uint i = 0; i < size; ++i) { setModified(i, iMod); } } void Canvas::causalStyleModules(vector<unsigned> &vec, unsigned index) { - unsigned int size = _StyleModules.size(); + uint size = _StyleModules.size(); - for (unsigned int i = index; i < size; ++i) { + for (uint i = index; i < size; ++i) { if (_StyleModules[i]->getCausal()) { vec.push_back(i); } @@ -276,7 +276,7 @@ void Canvas::causalStyleModules(vector<unsigned> &vec, unsigned index) void Canvas::Render(const StrokeRenderer *iRenderer) { - for (unsigned int i = 0; i < _StyleModules.size(); ++i) { + for (uint i = 0; i < _StyleModules.size(); ++i) { if (!_StyleModules[i]->getDisplayed() || !_Layers[i]) { continue; } @@ -286,7 +286,7 @@ void Canvas::Render(const StrokeRenderer *iRenderer) void Canvas::RenderBasic(const StrokeRenderer *iRenderer) { - for (unsigned int i = 0; i < _StyleModules.size(); ++i) { + for (uint i = 0; i < _StyleModules.size(); ++i) { if (!_StyleModules[i]->getDisplayed() || !_Layers[i]) { continue; } @@ -294,10 +294,7 @@ void Canvas::RenderBasic(const StrokeRenderer *iRenderer) } } -void Canvas::loadMap(const char *iFileName, - const char *iMapName, - unsigned int iNbLevels, - float iSigma) +void Canvas::loadMap(const char *iFileName, const char *iMapName, uint iNbLevels, float iSigma) { // check whether this map was already loaded: if (!_maps.empty()) { diff --git a/source/blender/freestyle/intern/system/PseudoNoise.cpp b/source/blender/freestyle/intern/system/PseudoNoise.cpp index ad2950c73a9..354aef13115 100644 --- a/source/blender/freestyle/intern/system/PseudoNoise.cpp +++ b/source/blender/freestyle/intern/system/PseudoNoise.cpp @@ -11,7 +11,7 @@ #include "PseudoNoise.h" #include "RandGen.h" -static int modf_to_index(Freestyle::real x, unsigned int range) +static int modf_to_index(Freestyle::real x, uint range) { if (isfinite(x)) { Freestyle::real tmp; @@ -30,7 +30,7 @@ real PseudoNoise::_values[]; void PseudoNoise::init(long seed) { RandGen::srand48(seed); - for (unsigned int i = 0; i < NB_VALUE_NOISE; i++) { + for (uint i = 0; i < NB_VALUE_NOISE; i++) { _values[i] = -1.0 + 2.0 * RandGen::drand48(); } } @@ -83,7 +83,7 @@ real PseudoNoise::turbulenceSmooth(real x, unsigned nbOctave) { real y = 0; real k = 1.0; - for (unsigned int i = 0; i < nbOctave; i++) { + for (uint i = 0; i < nbOctave; i++) { y = y + k * smoothNoise(x * k); k = k / 2.0; } @@ -94,7 +94,7 @@ real PseudoNoise::turbulenceLinear(real x, unsigned nbOctave) { real y = 0; real k = 1.0; - for (unsigned int i = 0; i < nbOctave; i++) { + for (uint i = 0; i < nbOctave; i++) { y = y + k * linearNoise(x * k); k = k / 2.0; } diff --git a/source/blender/freestyle/intern/system/RandGen.cpp b/source/blender/freestyle/intern/system/RandGen.cpp index d18d53c767f..c5559f39147 100644 --- a/source/blender/freestyle/intern/system/RandGen.cpp +++ b/source/blender/freestyle/intern/system/RandGen.cpp @@ -38,7 +38,7 @@ namespace Freestyle { } \ ((void)0) -#define CARRY(x, y) ((unsigned long)((long)(x) + (long)(y)) > MASK) +#define CARRY(x, y) ((ulong)((long)(x) + (long)(y)) > MASK) #define ADDEQU(x, y, z) (z = CARRY(x, (y)), x = LOW(x + (y))) #define SET3(x, x0, x1, x2) ((x)[0] = (x0), (x)[1] = (x1), (x)[2] = (x2)) #if 0 // XXX, unused diff --git a/source/blender/freestyle/intern/system/StringUtils.cpp b/source/blender/freestyle/intern/system/StringUtils.cpp index 1ecd5a2126d..c4a96ce3305 100644 --- a/source/blender/freestyle/intern/system/StringUtils.cpp +++ b/source/blender/freestyle/intern/system/StringUtils.cpp @@ -21,7 +21,7 @@ void getPathName(const string &path, const string &base, vector<string> &pathnam pathnames.push_back(base); - for (unsigned int pos = 0, sep = path.find(Config::PATH_SEP, pos); pos < size; + for (uint pos = 0, sep = path.find(Config::PATH_SEP, pos); pos < size; pos = sep + 1, sep = path.find(Config::PATH_SEP, pos)) { if (sep == (unsigned)string::npos) { sep = size; diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.cpp b/source/blender/freestyle/intern/view_map/BoxGrid.cpp index c8a6f0a0a3e..eac6765da99 100644 --- a/source/blender/freestyle/intern/view_map/BoxGrid.cpp +++ b/source/blender/freestyle/intern/view_map/BoxGrid.cpp @@ -127,7 +127,7 @@ void BoxGrid::assignCells(OccluderSource & /*source*/, ++f) { if ((*f)->isInImage()) { Vec3r point = transform((*f)->center3d()); - unsigned int i, j; + uint i, j; getCellCoordinates(point, i, j); if (_cells[i * _cellsY + j] == nullptr) { // This is an uninitialized cell @@ -149,8 +149,8 @@ void BoxGrid::assignCells(OccluderSource & /*source*/, void BoxGrid::distributePolygons(OccluderSource &source) { - unsigned long nFaces = 0; - unsigned long nKeptFaces = 0; + ulong nFaces = 0; + ulong nKeptFaces = 0; for (source.begin(); source.isValid(); source.next()) { OccluderData *occluder = nullptr; @@ -194,7 +194,7 @@ void BoxGrid::getCellCoordinates(const Vec3r &point, unsigned &x, unsigned &y) BoxGrid::Cell *BoxGrid::findCell(const Vec3r &point) { - unsigned int x, y; + uint x, y; getCellCoordinates(point, x, y); return _cells[x * _cellsY + y]; } diff --git a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp index 8ae6bec2fb2..e2886370800 100644 --- a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp +++ b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp @@ -56,7 +56,7 @@ bool CulledOccluderSource::next() void CulledOccluderSource::getOccluderProscenium(real proscenium[4]) { - for (unsigned int i = 0; i < 4; ++i) { + for (uint i = 0; i < 4; ++i) { proscenium[i] = gridSpaceOccluderProscenium[i]; } } diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp index cd36e4b0fe9..ffbb13e5df7 100644 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp @@ -420,8 +420,8 @@ void FEdgeXDetector::ProcessRidgeFace(WXFace *iFace) WXFaceLayer *flayer = new WXFaceLayer(iFace, Nature::RIDGE | Nature::VALLEY, false); iFace->AddSmoothLayer(flayer); - unsigned int numVertices = iFace->numberOfVertices(); - for (unsigned int i = 0; i < numVertices; ++i) { + uint numVertices = iFace->numberOfVertices(); + for (uint i = 0; i < numVertices; ++i) { WVertex *wv = iFace->GetVertex(i); WXVertex *wxv = dynamic_cast<WXVertex *>(wv); flayer->PushDotP(wxv->curvatures()->K1); @@ -570,8 +570,8 @@ void FEdgeXDetector::ProcessSuggestiveContourFace(WXFace *iFace) WXFaceLayer *faceLayer = new WXFaceLayer(iFace, Nature::SUGGESTIVE_CONTOUR, true); iFace->AddSmoothLayer(faceLayer); - unsigned int numVertices = iFace->numberOfVertices(); - for (unsigned int i = 0; i < numVertices; ++i) { + uint numVertices = iFace->numberOfVertices(); + for (uint i = 0; i < numVertices; ++i) { WVertex *wv = iFace->GetVertex(i); WXVertex *wxv = dynamic_cast<WXVertex *>(wv); faceLayer->PushDotP(wxv->curvatures()->Kr); @@ -626,7 +626,7 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace) GeomUtils::intersection_test res; real kr(0), kr1(0), kr2(0), t; - for (unsigned int i = 0; i < vertices_nb; ++i) { + for (uint i = 0; i < vertices_nb; ++i) { v = (WXVertex *)(iFace->GetVertex(i)); // v is a singular vertex, skip it. diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp index 24625d39781..b77ccebe1f6 100644 --- a/source/blender/freestyle/intern/view_map/Functions0D.cpp +++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp @@ -319,7 +319,7 @@ int QuantitativeInvisibilityF0D::operator()(Interface0DIterator &iter) { ViewEdge *ve1, *ve2; getViewEdges(iter, ve1, ve2); - unsigned int qi1, qi2; + uint qi1, qi2; qi1 = ve1->qi(); if (ve2 != nullptr) { qi2 = ve2->qi(); diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp index dfe6bfdd0cf..7d9d871f586 100644 --- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp +++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp @@ -66,7 +66,7 @@ void SilhouetteGeomEngine::setTransform(const real iModelViewMatrix[4][4], const int iViewport[4], real iFocal) { - unsigned int i, j; + uint i, j; _translation[0] = iModelViewMatrix[3][0]; _translation[1] = iModelViewMatrix[3][1]; _translation[2] = iModelViewMatrix[3][2]; @@ -88,7 +88,7 @@ void SilhouetteGeomEngine::setTransform(const real iModelViewMatrix[4][4], for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { _transform[i][j] = 0; - for (unsigned int k = 0; k < 4; k++) { + for (uint k = 0; k < 4; k++) { _transform[i][j] += _projectionMatrix[i][k] * _modelViewMatrix[k][j]; } } diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp index 2a7637eb350..70f10058411 100644 --- a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp +++ b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp @@ -146,8 +146,8 @@ void SphericalGrid::assignCells(OccluderSource & /*source*/, void SphericalGrid::distributePolygons(OccluderSource &source) { - unsigned long nFaces = 0; - unsigned long nKeptFaces = 0; + ulong nFaces = 0; + ulong nKeptFaces = 0; for (source.begin(); source.isValid(); source.next()) { OccluderData *occluder = nullptr; diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp index 1211b55e8e1..88f94e152a1 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp @@ -26,11 +26,11 @@ namespace Freestyle { using namespace Geometry; -SteerableViewMap::SteerableViewMap(unsigned int nbOrientations) +SteerableViewMap::SteerableViewMap(uint nbOrientations) { _nbOrientations = nbOrientations; _bound = cos(M_PI / (float)_nbOrientations); - for (unsigned int i = 0; i < _nbOrientations; ++i) { + for (uint i = 0; i < _nbOrientations; ++i) { _directions.emplace_back(cos((float)i * M_PI / (float)_nbOrientations), sin((float)i * M_PI / (float)_nbOrientations)); } @@ -47,7 +47,7 @@ void SteerableViewMap::Build() SteerableViewMap::SteerableViewMap(const SteerableViewMap &iBrother) { _nbOrientations = iBrother._nbOrientations; - unsigned int i; + uint i; _bound = iBrother._bound; _directions = iBrother._directions; _mapping = iBrother._mapping; @@ -66,7 +66,7 @@ SteerableViewMap::~SteerableViewMap() void SteerableViewMap::Clear() { - unsigned int i; + uint i; if (_imagesPyramids) { for (i = 0; i <= _nbOrientations; ++i) { if (_imagesPyramids[i]) { @@ -77,8 +77,7 @@ void SteerableViewMap::Clear() _imagesPyramids = nullptr; } if (!_mapping.empty()) { - for (map<unsigned int, double *>::iterator m = _mapping.begin(), mend = _mapping.end(); - m != mend; + for (map<uint, double *>::iterator m = _mapping.begin(), mend = _mapping.end(); m != mend; ++m) { delete[](*m).second; } @@ -109,7 +108,7 @@ double *SteerableViewMap::AddFEdge(FEdge *iFEdge) { unsigned i; unsigned id = iFEdge->getId().getFirst(); - map<unsigned int, double *>::iterator o = _mapping.find(id); + map<uint, double *>::iterator o = _mapping.find(id); if (o != _mapping.end()) { return (*o).second; } @@ -142,7 +141,7 @@ unsigned SteerableViewMap::getSVMNumber(Vec2f dir) dir /= norm; double maxw = 0.0f; unsigned winner = _nbOrientations + 1; - for (unsigned int i = 0; i < _nbOrientations; ++i) { + for (uint i = 0; i < _nbOrientations; ++i) { double w = ComputeWeight(dir, i); if (w > maxw) { maxw = w; @@ -154,7 +153,7 @@ unsigned SteerableViewMap::getSVMNumber(Vec2f dir) unsigned SteerableViewMap::getSVMNumber(unsigned id) { - map<unsigned int, double *>::iterator o = _mapping.find(id); + map<uint, double *>::iterator o = _mapping.find(id); if (o != _mapping.end()) { double *wvalues = (*o).second; double maxw = 0.0; @@ -176,7 +175,7 @@ void SteerableViewMap::buildImagesPyramids(GrayImage **steerableBases, unsigned iNbLevels, float iSigma) { - for (unsigned int i = 0; i <= _nbOrientations; ++i) { + for (uint i = 0; i <= _nbOrientations; ++i) { ImagePyramid *svm = (_imagesPyramids)[i]; delete svm; if (copy) { @@ -215,7 +214,7 @@ float SteerableViewMap::readCompleteViewMapPixel(int iLevel, int x, int y) return readSteerableViewMapPixel(_nbOrientations, iLevel, x, y); } -unsigned int SteerableViewMap::getNumberOfPyramidLevels() const +uint SteerableViewMap::getNumberOfPyramidLevels() const { if (_imagesPyramids[0]) { return _imagesPyramids[0]->getNumberOfLevels(); @@ -225,7 +224,7 @@ unsigned int SteerableViewMap::getNumberOfPyramidLevels() const void SteerableViewMap::saveSteerableViewMap() const { - for (unsigned int i = 0; i <= _nbOrientations; ++i) { + for (uint i = 0; i <= _nbOrientations; ++i) { if (_imagesPyramids[i] == nullptr) { cerr << "SteerableViewMap warning: orientation " << i << " of steerable View Map whas not been computed yet" << endl; diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp index 17447ced5e4..bbf9962b0e6 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp @@ -1003,11 +1003,11 @@ static void computeVeryFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) } } -void ViewMapBuilder::BuildGrid(WingedEdge &we, const BBox<Vec3r> &bbox, unsigned int sceneNumFaces) +void ViewMapBuilder::BuildGrid(WingedEdge &we, const BBox<Vec3r> &bbox, uint sceneNumFaces) { _Grid->clear(); Vec3r size; - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { size[i] = fabs(bbox.getMax()[i] - bbox.getMin()[i]); // let make the grid 1/10 bigger to avoid numerical errors while computing triangles/cells // intersections. @@ -1032,7 +1032,7 @@ ViewMap *ViewMapBuilder::BuildViewMap(WingedEdge &we, visibility_algo iAlgo, real epsilon, const BBox<Vec3r> &bbox, - unsigned int sceneNumFaces) + uint sceneNumFaces) { _ViewMap = new ViewMap; _currentId = 1; @@ -1435,7 +1435,7 @@ void ViewMapBuilder::ComputeDetailedVisibility(ViewMap *ioViewMap, void ViewMapBuilder::ComputeEdgesVisibility(ViewMap *ioViewMap, WingedEdge &we, const BBox<Vec3r> &bbox, - unsigned int sceneNumFaces, + uint sceneNumFaces, visibility_algo iAlgo, real epsilon) { @@ -2270,7 +2270,7 @@ struct less_SVertex2D { { Vec3r A = x->point2D(); Vec3r B = y->point2D(); - for (unsigned int i = 0; i < 3; i++) { + for (uint i = 0; i < 3; i++) { if (fabs(A[i] - B[i]) < epsilon) { continue; } diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.cpp b/source/blender/freestyle/intern/winged_edge/WEdge.cpp index 8b9388caa86..8af34d5e0ac 100644 --- a/source/blender/freestyle/intern/winged_edge/WEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WEdge.cpp @@ -500,7 +500,7 @@ WShape::WShape(WShape &iBrother) for (v = _VertexList.begin(); v != vend; ++v) { const vector<WEdge *> &vedgeList = (*v)->GetEdges(); vector<WEdge *> newvedgelist; - unsigned int i; + uint i; for (i = 0; i < vedgeList.size(); i++) { WEdge *current = vedgeList[i]; edgedata *currentvedata = (edgedata *)current->userdata; @@ -536,11 +536,11 @@ WShape::WShape(WShape &iBrother) fend = _FaceList.end(); for (f = _FaceList.begin(); f != fend; ++f) { - unsigned int i; + uint i; const vector<WOEdge *> &oedgeList = (*f)->getEdgeList(); vector<WOEdge *> newoedgelist; - unsigned int n = oedgeList.size(); + uint n = oedgeList.size(); for (i = 0; i < n; i++) { WOEdge *current = oedgeList[i]; oedgedata *currentoedata = (oedgedata *)current->userdata; diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp index b18d232dbbe..c60088a219f 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp @@ -18,7 +18,7 @@ namespace Freestyle { * * **********************************/ -unsigned int WXFaceLayer::Get0VertexIndex() const +uint WXFaceLayer::Get0VertexIndex() const { int i = 0; int nEdges = _pWXFace->numberOfEdges(); @@ -29,7 +29,7 @@ unsigned int WXFaceLayer::Get0VertexIndex() const } return -1; } -unsigned int WXFaceLayer::GetSmoothEdgeIndex() const +uint WXFaceLayer::GetSmoothEdgeIndex() const { int i = 0; int nEdges = _pWXFace->numberOfEdges(); diff --git a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp index 3a5cdbc663c..b1daedb0cd0 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp @@ -30,7 +30,7 @@ void WXEdgeBuilder::visitIndexedFaceSet(IndexedFaceSet &ifs) void WXEdgeBuilder::buildWVertices(WShape &shape, const float *vertices, unsigned vsize) { WXVertex *vertex; - for (unsigned int i = 0; i < vsize; i += 3) { + for (uint i = 0; i < vsize; i += 3) { vertex = new WXVertex(Vec3f(vertices[i], vertices[i + 1], vertices[i + 2])); vertex->setId(i / 3); shape.AddVertex(vertex); diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp index 0a3ab97717b..d1389ac17c1 100644 --- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp @@ -65,8 +65,8 @@ void WingedEdgeBuilder::visitNodeTransformAfter(NodeTransform &UNUSED(transform) bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs) { - unsigned int vsize = ifs.vsize(); - unsigned int nsize = ifs.nsize(); + uint vsize = ifs.vsize(); + uint nsize = ifs.nsize(); // soc unused - unsigned tsize = ifs.tsize(); const float *vertices = ifs.vertices(); @@ -117,21 +117,21 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs) // create a WVertex for each vertex buildWVertices(shape, new_vertices, vsize); - const unsigned int *vindices = ifs.vindices(); - const unsigned int *nindices = ifs.nindices(); - const unsigned int *tindices = nullptr; + const uint *vindices = ifs.vindices(); + const uint *nindices = ifs.nindices(); + const uint *tindices = nullptr; if (ifs.tsize()) { tindices = ifs.tindices(); } - const unsigned int *mindices = nullptr; + const uint *mindices = nullptr; if (ifs.msize()) { mindices = ifs.mindices(); } - const unsigned int *numVertexPerFace = ifs.numVertexPerFaces(); - const unsigned int numfaces = ifs.numFaces(); + const uint *numVertexPerFace = ifs.numVertexPerFaces(); + const uint numfaces = ifs.numFaces(); - for (unsigned int index = 0; index < numfaces; index++) { + for (uint index = 0; index < numfaces; index++) { switch (faceStyle[index]) { case IndexedFaceSet::TRIANGLE_STRIP: buildTriangleStrip(new_vertices, @@ -231,7 +231,7 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs) void WingedEdgeBuilder::buildWVertices(WShape &shape, const float *vertices, unsigned vsize) { WVertex *vertex; - for (unsigned int i = 0; i < vsize; i += 3) { + for (uint i = 0; i < vsize; i += 3) { vertex = new WVertex(Vec3f(vertices[i], vertices[i + 1], vertices[i + 2])); vertex->setId(i / 3); shape.AddVertex(vertex); @@ -367,7 +367,7 @@ void WingedEdgeBuilder::buildTriangles(const float * /*vertices*/, vector<bool> triangleFaceEdgeMarks; // Each triplet of vertices is considered as an independent triangle - for (unsigned int i = 0; i < nvertices / 3; i++) { + for (uint i = 0; i < nvertices / 3; i++) { triangleVertices.push_back(currentShape->getVertexList()[vindices[3 * i] / 3]); triangleVertices.push_back(currentShape->getVertexList()[vindices[3 * i + 1] / 3]); triangleVertices.push_back(currentShape->getVertexList()[vindices[3 * i + 2] / 3]); @@ -412,10 +412,10 @@ void WingedEdgeBuilder::transformVertices(const float *vertices, const float *v = vertices; float *pv = res; - for (unsigned int i = 0; i < vsize / 3; i++) { + for (uint i = 0; i < vsize / 3; i++) { HVec3r hv_tmp(v[0], v[1], v[2]); HVec3r hv(transform * hv_tmp); - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { pv[j] = hv[j] / hv[3]; } v += 3; @@ -431,10 +431,10 @@ void WingedEdgeBuilder::transformNormals(const float *normals, const float *n = normals; float *pn = res; - for (unsigned int i = 0; i < nsize / 3; i++) { + for (uint i = 0; i < nsize / 3; i++) { Vec3r hn(n[0], n[1], n[2]); hn = GeomUtils::rotateVector(transform, hn); - for (unsigned int j = 0; j < 3; j++) { + for (uint j = 0; j < 3; j++) { pn[j] = hn[j]; } n += 3; |