Skip to content

Commit b31a21a

Browse files
generatedunixname89002005287564meta-codesync[bot]
authored andcommitted
Fix CQS signal cppcoreguidelines-pro-type-member-init in fbcode/mapillary/opensfm
Differential Revision: D89353241 fbshipit-source-id: 5150f66460bcc83775bec32b778410ff84afb613
1 parent cff716c commit b31a21a

File tree

8 files changed

+29
-29
lines changed

8 files changed

+29
-29
lines changed

opensfm/src/bundle/reconstruction_alignment.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ enum {
3636

3737
struct RAShot {
3838
std::string id;
39-
double parameters[RA_SHOT_NUM_PARAMS];
40-
bool constant;
39+
double parameters[RA_SHOT_NUM_PARAMS]{};
40+
bool constant{};
4141

4242
double GetRX() { return parameters[RA_SHOT_RX]; }
4343
double GetRY() { return parameters[RA_SHOT_RY]; }
@@ -55,8 +55,8 @@ struct RAShot {
5555

5656
struct RAReconstruction {
5757
std::string id;
58-
double parameters[RA_RECONSTRUCTION_NUM_PARAMS];
59-
bool constant;
58+
double parameters[RA_RECONSTRUCTION_NUM_PARAMS]{};
59+
bool constant{};
6060

6161
double GetRX() { return parameters[RA_RECONSTRUCTION_RX]; }
6262
double GetRY() { return parameters[RA_RECONSTRUCTION_RY]; }
@@ -110,8 +110,8 @@ struct RARelativeMotionConstraint {
110110

111111
std::string reconstruction_id;
112112
std::string shot_id;
113-
double parameters[RA_SHOT_NUM_PARAMS];
114-
double scale_matrix[RA_SHOT_NUM_PARAMS * RA_SHOT_NUM_PARAMS];
113+
double parameters[RA_SHOT_NUM_PARAMS]{};
114+
double scale_matrix[RA_SHOT_NUM_PARAMS * RA_SHOT_NUM_PARAMS]{};
115115
};
116116

117117
struct RAAbsolutePositionConstraint {
@@ -420,7 +420,7 @@ class ReconstructionAlignment {
420420

421421
void AddAbsolutePositionConstraint(const std::string& shot_id, double x,
422422
double y, double z, double std_deviation) {
423-
RAAbsolutePositionConstraint a;
423+
RAAbsolutePositionConstraint a{};
424424
a.shot = &shots_[shot_id];
425425
a.position[0] = x;
426426
a.position[1] = y;
@@ -432,7 +432,7 @@ class ReconstructionAlignment {
432432
void AddRelativeAbsolutePositionConstraint(
433433
const std::string& reconstruction_id, const std::string& shot_id,
434434
double x, double y, double z, double std_deviation) {
435-
RARelativeAbsolutePositionConstraint a;
435+
RARelativeAbsolutePositionConstraint a{};
436436
a.reconstruction = &reconstructions_[reconstruction_id];
437437
a.shot = &shots_[shot_id];
438438
a.position[0] = x;
@@ -447,7 +447,7 @@ class ReconstructionAlignment {
447447
const std::string& reconstruction_b_id,
448448
double xb, double yb, double zb,
449449
double std_deviation) {
450-
RACommonPointConstraint c;
450+
RACommonPointConstraint c{};
451451
c.reconstruction_a = &reconstructions_[reconstruction_a_id];
452452
c.point_a[0] = xa;
453453
c.point_a[1] = ya;
@@ -466,7 +466,7 @@ class ReconstructionAlignment {
466466
const std::string& shot_b_id,
467467
double std_deviation_center,
468468
double std_deviation_rotation) {
469-
RACommonCameraConstraint c;
469+
RACommonCameraConstraint c{};
470470
c.reconstruction_a = &reconstructions_[reconstruction_a_id];
471471
c.shot_a = &shots_[shot_a_id];
472472
c.reconstruction_b = &reconstructions_[reconstruction_b_id];

opensfm/src/bundle/test/reprojection_errors_test.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ class ReprojectionError2DFixtureBase : public ::testing::Test {
2020
AScalar residual_adiff[size_residual];
2121
AScalar point_adiff[size_point];
2222

23-
double residuals[size_residual];
24-
double jac_point[size_residual * size_point];
23+
double residuals[size_residual]{};
24+
double jac_point[size_residual * size_point]{};
2525
};
2626

2727
class ReprojectionError2DFixture : public ReprojectionError2DFixtureBase {
@@ -104,11 +104,11 @@ class ReprojectionError2DFixture : public ReprojectionError2DFixtureBase {
104104

105105
const double rt_instance[size_rt] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6};
106106
AScalar rt_instance_adiff[size_rt];
107-
double jac_rt_instance[size_residual * size_rt];
107+
double jac_rt_instance[size_residual * size_rt]{};
108108

109109
const double rt_camera[size_rt] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6};
110110
AScalar rt_camera_adiff[size_rt];
111-
double jac_rt_camera[size_residual * size_rt];
111+
double jac_rt_camera[size_residual * size_rt]{};
112112
};
113113

114114
TEST_F(ReprojectionError2DFixture, BrownAnalyticErrorEvaluatesOK) {
@@ -234,10 +234,10 @@ class ReprojectionError3DFixture : public ::testing::Test {
234234
AScalar rt_instance_adiff[size_rt];
235235
AScalar rt_camera_adiff[size_rt];
236236

237-
double residuals[size];
238-
double jac_instance_rt[size * size_rt];
239-
double jac_camera_rt[size * size_rt];
240-
double jac_point[size * size_point];
237+
double residuals[size]{};
238+
double jac_instance_rt[size * size_rt]{};
239+
double jac_camera_rt[size * size_rt]{};
240+
double jac_point[size * size_point]{};
241241
};
242242

243243
TEST_F(ReprojectionError3DFixture, AnalyticErrorEvaluatesOK) {

opensfm/src/geometry/absolute_pose.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ std::vector<Eigen::Matrix<double, 3, 4>> AbsolutePoseThreePoints(IT begin,
7676
const auto alpha0 = SQUARE(g7) - SQUARE(g2) - SQUARE(g4);
7777

7878
std::array<double, 5> coefficients = {alpha0, alpha1, alpha2, alpha3, alpha4};
79-
std::array<double, 4> roots;
79+
std::array<double, 4> roots{};
8080
const auto solve_result = foundation::SolveQuartic(coefficients, roots);
8181
if (!solve_result) {
8282
return RTs;

opensfm/src/geometry/camera_distortions_functions.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ struct Disto62 : Functor<2, 8, 2> {
465465

466466
Mat2<T> derivative(const Vec2<T>& point) const {
467467
Mat2<T> jacobian;
468-
std::array<double, 2> dummy;
468+
std::array<double, 2> dummy{};
469469
std::array<double, 8> ks{k1, k2, k3, k4, k5, k6, p1, p2};
470470
Disto62::ForwardDerivatives<T, false>(point.data(), ks.data(),
471471
dummy.data(), jacobian.data());
@@ -683,7 +683,7 @@ struct Disto624 : Functor<2, 12, 2> {
683683

684684
Mat2<T> derivative(const Vec2<T>& point) const {
685685
Mat2<T> jacobian;
686-
std::array<double, 2> dummy;
686+
std::array<double, 2> dummy{};
687687
std::array<double, 12> ks{k1, k2, k3, k4, k5, k6, p1, p2, s0, s1, s2, s3};
688688
Disto624::ForwardDerivatives<T, false>(point.data(), ks.data(),
689689
dummy.data(), jacobian.data());
@@ -815,7 +815,7 @@ struct DistoBrown : Functor<2, 5, 2> {
815815

816816
Mat2<T> derivative(const Vec2<T>& point) const {
817817
Mat2<T> jacobian;
818-
std::array<double, 2> dummy;
818+
std::array<double, 2> dummy{};
819819
std::array<double, 5> ks{k1, k2, k3, p1, p2};
820820
DistoBrown::ForwardDerivatives<T, false>(point.data(), ks.data(),
821821
dummy.data(), jacobian.data());

opensfm/src/geometry/test/camera_functions_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,13 @@ class CameraDerivativesFixture : public ::testing::Test {
302302
Vec2d distortion_radial;
303303
Vec2d principal_point;
304304

305-
double point[3];
305+
double point[3]{};
306306
using AScalar = Eigen::AutoDiffScalar<VecXd>;
307307
AScalar point_adiff[3];
308308
VecX<AScalar> camera_adiff;
309309

310310
AScalar projection_expected[2];
311-
double projected[2];
311+
double projected[2]{};
312312
};
313313

314314
TEST_F(CameraDerivativesFixture, ComputePerspectiveAnalyticalDerivatives) {

opensfm/src/geometry/test/camera_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ class CameraFixture : public ::testing::Test {
6262
Vec2d distortion_radial;
6363
Vec2d principal_point;
6464

65-
double point[3];
66-
double projected[2];
65+
double point[3]{};
66+
double projected[2]{};
6767
};
6868

6969
TEST_F(CameraFixture, PerspectiveIsConsistent) {

opensfm/src/geometry/test/covariance_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class CovarianceFixture : public ::testing::Test {
6666
}
6767

6868
const double focal{1.0};
69-
double point[3];
69+
double point[3]{};
7070
using AScalar = Eigen::AutoDiffScalar<VecXd>;
7171
AScalar point_adiff[3];
7272
AScalar projection_expected[2];

opensfm/src/map/observation.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ struct Observation {
4343
int feature_id{0};
4444

4545
// Optional data : semantics
46-
int segmentation_id;
47-
int instance_id;
46+
int segmentation_id{};
47+
int instance_id{};
4848

4949
// Optional data : depth prior
5050
std::optional<Depth> depth_prior;

0 commit comments

Comments
 (0)