[Bf-blender-cvs] [8a68f4f8081] master: Cleanup: replace unsigned with uint, use function style casts for C++

Campbell Barton noreply at git.blender.org
Mon Sep 26 02:09:55 CEST 2022


Commit: 8a68f4f80814a28d68055a0ae0b22a7efe1c2619
Author: Campbell Barton
Date:   Mon Sep 26 10:04:44 2022 +1000
Branches: master
https://developer.blender.org/rB8a68f4f80814a28d68055a0ae0b22a7efe1c2619

Cleanup: replace unsigned with uint, use function style casts for C++

===================================================================

M	intern/sky/source/sky_model.cpp
M	source/blender/blenlib/intern/math_solvers.c
M	source/blender/freestyle/intern/application/Controller.cpp
M	source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
M	source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
M	source/blender/freestyle/intern/geometry/FastGrid.cpp
M	source/blender/freestyle/intern/geometry/FitCurve.cpp
M	source/blender/freestyle/intern/geometry/GeomCleaner.cpp
M	source/blender/freestyle/intern/geometry/GeomUtils.cpp
M	source/blender/freestyle/intern/geometry/Grid.cpp
M	source/blender/freestyle/intern/geometry/HashGrid.cpp
M	source/blender/freestyle/intern/geometry/Noise.cpp
M	source/blender/freestyle/intern/image/ImagePyramid.cpp
M	source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
M	source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
M	source/blender/freestyle/intern/python/Director.cpp
M	source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp
M	source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp
M	source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp
M	source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
M	source/blender/freestyle/intern/scene_graph/SceneHash.cpp
M	source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp
M	source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp
M	source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp
M	source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
M	source/blender/freestyle/intern/stroke/Canvas.cpp
M	source/blender/freestyle/intern/stroke/ContextFunctions.cpp
M	source/blender/freestyle/intern/stroke/Operators.cpp
M	source/blender/freestyle/intern/stroke/StrokeRenderer.cpp
M	source/blender/freestyle/intern/system/PseudoNoise.cpp
M	source/blender/freestyle/intern/system/RandGen.cpp
M	source/blender/freestyle/intern/system/StringUtils.cpp
M	source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp
M	source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp
M	source/blender/freestyle/intern/view_map/BoxGrid.cpp
M	source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
M	source/blender/freestyle/intern/view_map/Functions0D.cpp
M	source/blender/freestyle/intern/view_map/HeuristicGridDensityProviderFactory.cpp
M	source/blender/freestyle/intern/view_map/OccluderSource.cpp
M	source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp
M	source/blender/freestyle/intern/view_map/SphericalGrid.cpp
M	source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
M	source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
M	source/blender/freestyle/intern/view_map/ViewMap.cpp
M	source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
M	source/blender/freestyle/intern/winged_edge/WEdge.cpp
M	source/blender/freestyle/intern/winged_edge/WXEdge.cpp
M	source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
M	source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp

===================================================================

diff --git a/intern/sky/source/sky_model.cpp b/intern/sky/source/sky_model.cpp
index 4181605b9e4..9fb80202c98 100644
--- a/intern/sky/source/sky_model.cpp
+++ b/intern/sky/source/sky_model.cpp
@@ -129,7 +129,7 @@ static void ArHosekSkyModel_CookConfiguration(ArHosekSkyModel_Dataset dataset,
 
   elev_matrix = dataset + (9 * 6 * (int_turbidity - 1));
 
-  for (unsigned int i = 0; i < 9; ++i) {
+  for (uint i = 0; i < 9; ++i) {
     //(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4;
     config[i] =
         (1.0 - albedo) * (1.0 - turbidity_rem) *
@@ -143,7 +143,7 @@ static void ArHosekSkyModel_CookConfiguration(ArHosekSkyModel_Dataset dataset,
 
   // alb 1 low turb
   elev_matrix = dataset + (9 * 6 * 10 + 9 * 6 * (int_turbidity - 1));
-  for (unsigned int i = 0; i < 9; ++i) {
+  for (uint i = 0; i < 9; ++i) {
     //(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4;
     config[i] +=
         (albedo) * (1.0 - turbidity_rem) *
@@ -161,7 +161,7 @@ static void ArHosekSkyModel_CookConfiguration(ArHosekSkyModel_Dataset dataset,
 
   // alb 0 high turb
   elev_matrix = dataset + (9 * 6 * (int_turbidity));
-  for (unsigned int i = 0; i < 9; ++i) {
+  for (uint i = 0; i < 9; ++i) {
     //(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4;
     config[i] +=
         (1.0 - albedo) * (turbidity_rem) *
@@ -175,7 +175,7 @@ static void ArHosekSkyModel_CookConfiguration(ArHosekSkyModel_Dataset dataset,
 
   // alb 1 high turb
   elev_matrix = dataset + (9 * 6 * 10 + 9 * 6 * (int_turbidity));
-  for (unsigned int i = 0; i < 9; ++i) {
+  for (uint i = 0; i < 9; ++i) {
     //(1-t).^3* A1 + 3*(1-t).^2.*t * A2 + 3*(1-t) .* t .^ 2 * A3 + t.^3 * A4;
     config[i] +=
         (albedo) * (turbidity_rem) *
@@ -313,7 +313,7 @@ SKY_ArHosekSkyModelState *SKY_arhosek_xyz_skymodelstate_alloc_init(const double
   state->albedo = albedo;
   state->elevation = elevation;
 
-  for (unsigned int channel = 0; channel < 3; ++channel) {
+  for (uint channel = 0; channel < 3; ++channel) {
     ArHosekSkyModel_CookConfiguration(
         datasetsXYZ[channel], state->configs[channel], turbidity, albedo, elevation);
 
diff --git a/source/blender/blenlib/intern/math_solvers.c b/source/blender/blenlib/intern/math_solvers.c
index b5650410a70..1196c0bed7f 100644
--- a/source/blender/blenlib/intern/math_solvers.c
+++ b/source/blender/blenlib/intern/math_solvers.c
@@ -45,7 +45,7 @@ bool BLI_tridiagonal_solve(
     return false;
   }
 
-  size_t bytes = sizeof(double) * (unsigned)count;
+  size_t bytes = sizeof(double) * (uint)count;
   double *c1 = (double *)MEM_mallocN(bytes * 2, "tridiagonal_c1d1");
   double *d1 = c1 + count;
 
@@ -112,7 +112,7 @@ bool BLI_tridiagonal_solve_cyclic(
     return BLI_tridiagonal_solve(a, b, c, d, r_x, count);
   }
 
-  size_t bytes = sizeof(float) * (unsigned)count;
+  size_t bytes = sizeof(float) * (uint)count;
   float *tmp = (float *)MEM_mallocN(bytes * 2, "tridiagonal_ex");
   float *b2 = tmp + count;
 
diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp
index 08480533937..80e58820b37 100644
--- a/source/blender/freestyle/intern/application/Controller.cpp
+++ b/source/blender/freestyle/intern/application/Controller.cpp
@@ -919,7 +919,7 @@ Render *Controller::RenderStrokes(Render *re, bool render)
   return freestyle_render;
 }
 
-void Controller::InsertStyleModule(unsigned index, const char *iFileName)
+void Controller::InsertStyleModule(uint index, const char *iFileName)
 {
   if (!BLI_path_extension_check(iFileName, ".py")) {
     cerr << "Error: Cannot load \"" << string(iFileName) << "\", unknown extension" << endl;
@@ -930,13 +930,13 @@ void Controller::InsertStyleModule(unsigned index, const char *iFileName)
   _Canvas->InsertStyleModule(index, sm);
 }
 
-void Controller::InsertStyleModule(unsigned index, const char *iName, const char *iBuffer)
+void Controller::InsertStyleModule(uint index, const char *iName, const char *iBuffer)
 {
   StyleModule *sm = new BufferedStyleModule(iBuffer, iName, _inter);
   _Canvas->InsertStyleModule(index, sm);
 }
 
-void Controller::InsertStyleModule(unsigned index, const char *iName, struct Text *iText)
+void Controller::InsertStyleModule(uint index, const char *iName, struct Text *iText)
 {
   StyleModule *sm = new BlenderStyleModule(iText, iName, _inter);
   _Canvas->InsertStyleModule(index, sm);
@@ -947,7 +947,7 @@ void Controller::AddStyleModule(const char * /*iFileName*/)
   //_pStyleWindow->Add(iFileName);
 }
 
-void Controller::RemoveStyleModule(unsigned index)
+void Controller::RemoveStyleModule(uint index)
 {
   _Canvas->RemoveStyleModule(index);
 }
@@ -957,34 +957,34 @@ void Controller::Clear()
   _Canvas->Clear();
 }
 
-void Controller::ReloadStyleModule(unsigned index, const char *iFileName)
+void Controller::ReloadStyleModule(uint index, const char *iFileName)
 {
   StyleModule *sm = new StyleModule(iFileName, _inter);
   _Canvas->ReplaceStyleModule(index, sm);
 }
 
-void Controller::SwapStyleModules(unsigned i1, unsigned i2)
+void Controller::SwapStyleModules(uint i1, uint i2)
 {
   _Canvas->SwapStyleModules(i1, i2);
 }
 
-void Controller::toggleLayer(unsigned index, bool iDisplay)
+void Controller::toggleLayer(uint index, bool iDisplay)
 {
   _Canvas->setVisible(index, iDisplay);
 }
 
-void Controller::setModified(unsigned index, bool iMod)
+void Controller::setModified(uint index, bool iMod)
 {
   //_pStyleWindow->setModified(index, iMod);
   _Canvas->setModified(index, iMod);
   updateCausalStyleModules(index + 1);
 }
 
-void Controller::updateCausalStyleModules(unsigned index)
+void Controller::updateCausalStyleModules(uint index)
 {
-  vector<unsigned> vec;
+  vector<uint> vec;
   _Canvas->causalStyleModules(vec, index);
-  for (vector<unsigned>::const_iterator it = vec.begin(); it != vec.end(); it++) {
+  for (vector<uint>::const_iterator it = vec.begin(); it != vec.end(); it++) {
     //_pStyleWindow->setModified(*it, true);
     _Canvas->setModified(*it, true);
   }
@@ -1057,8 +1057,8 @@ void Controller::displayDensityCurves(int x, int y)
   vector<densityCurve> curvesDirection(svm->getNumberOfPyramidLevels());
 
   // collect the curves values
-  unsigned nbCurves = svm->getNumberOfOrientations() + 1;
-  unsigned nbPoints = svm->getNumberOfPyramidLevels();
+  uint nbCurves = svm->getNumberOfOrientations() + 1;
+  uint nbPoints = svm->getNumberOfPyramidLevels();
   if (!nbPoints) {
     return;
   }
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
index dec443064de..19589491bc4 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
@@ -436,7 +436,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
 
   // We count the number of triangles after the clipping by the near and far view
   // planes is applied (NOTE: mesh vertices are in the camera coordinate system).
-  unsigned numFaces = 0;
+  uint numFaces = 0;
   float v1[3], v2[3], v3[3];
   float n1[3], n2[3], n3[3], facenormal[3];
   int clip[3];
@@ -471,16 +471,16 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
   NodeGroup *currentMesh = new NodeGroup;
   NodeShape *shape = new NodeShape;
 
-  unsigned vSize = 3 * 3 * numFaces;
+  uint vSize = 3 * 3 * numFaces;
   float *vertices = new float[vSize];
-  unsigned nSize = vSize;
+  uint nSize = vSize;
   float *normals = new float[nSize];
-  unsigned *numVertexPerFaces = new unsigned[numFaces];
+  uint *numVertexPerFaces = new uint[numFaces];
   vector<Material *> meshMaterials;
   vector<FrsMaterial> meshFrsMaterials;
 
   IndexedFaceSet::TRIANGLES_STYLE *faceStyle = new IndexedFaceSet::TRIANGLES_STYLE[numFaces];
-  unsigned i;
+  uint i;
   for (i = 0; i < numFaces; i++) {
     faceStyle[i] = IndexedFaceSet::TRIANGLES;
     numVertexPerFaces[i] = 3;
@@ -488,11 +488,11 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
 
   IndexedFaceSet::FaceEdgeMark *faceEdgeMarks = new IndexedFaceSet::FaceEdgeMark[numFaces];
 
-  unsigned viSize = 3 * numFaces;
-  unsigned *VIndices = new unsigned[viSize];
-  unsigned niSize = viSize;
-  unsigned *NIndices = new unsigned[niSize];
-  unsigned *MIndices = new unsigned[viSize];  // Material Indices
+  uint viSize = 3 * numFaces;
+  uint *VIndices = new uint[viSize];
+  uint niSize = viSize;
+  uint *NIndices = new uint[niSize];
+  uint *MIndices = new uint[viSize];  // Material Indices
 
   struct LoaderState ls;
   ls.pv = vertices;
@@ -662,7 +662,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
   // addressed later in WShape::MakeFace().
   vector<detri_t> detriList;
   Vec3r zero(0.0, 0.0, 0.0);
-  unsigned vi0, vi1, vi2;
+  uint vi0, vi1, vi2;
   for (i = 0; i < viSize; i += 3) {
     detri_t detri;
     vi0 = cleanVIndices[i];
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
index ba583ecb2e1..64e7be5169c 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
@@ -189,7 +189,7 @@ float BlenderStrokeRenderer::get_stroke_vertex_z() const
 
 uint BlenderStrokeRenderer::get_stroke_mesh_id() const
 {
-  unsigned mesh_id = _mesh_id;
+  uint mesh_id = _mesh_id;
   BlenderStrokeRenderer *self = const_cast<BlenderStrokeRenderer *>(this);
   self->_mesh_id--;
   return mesh_id;
diff --git a/source/blender/freestyle/intern/geometry/FastGrid.cpp b/source/blender/freestyle/intern/geometry/FastGrid.cpp
index f87b25ebc71..24ecacbad2a 100644
--- a/source/blender/freestyle/intern/geometry/FastGrid.cpp
+++ b/source/blender/freestyle/intern/geometry/FastGrid.cpp
@@ -32,7 +32,7 @@ void FastGrid::clear()
   Grid::clear();
 }
 
-void FastGrid::configure(const Vec3r &orig, const Vec3r &size, unsigned nb)
+void FastGrid::configure(const Vec3r &orig, const Vec3r &size, uint nb)
 {
   Grid::

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list