Skip to content

Commit 5f9d316

Browse files
authored
Fix MSVC compilation errors for mrcal_wrapper (#11)
* Fix MSVC compilation errors for mrcal_wrapper * Fix * Fix
1 parent 41d7868 commit 5f9d316

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/mrcal_wrapper.cpp

+9-8
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class CholmodCtx {
4040
};
4141
static CholmodCtx cctx;
4242

43-
#define BARF(args...) std::fprintf(stderr, ##args)
43+
#define BARF(...) std::fprintf(stderr, __VA_ARGS__)
4444

4545
// forward declarations for functions borrowed from mrcal-pywrap
4646
static mrcal_problem_selections_t construct_problem_selections(
@@ -54,11 +54,10 @@ bool lensmodel_one_validate_args(mrcal_lensmodel_t *mrcal_lensmodel,
5454
std::vector<double> intrinsics,
5555
bool do_check_layout);
5656

57-
// Empty vector just to pass in so it's not NULL?
58-
mrcal_point3_t observations_point[0];
59-
mrcal_pose_t
60-
extrinsics_rt_fromref[0]; // Always zero for single camera, it seems?
61-
mrcal_point3_t points[0]; // Seems to always to be None for single camera?
57+
mrcal_point3_t* observations_point = nullptr;
58+
mrcal_pose_t*
59+
extrinsics_rt_fromref = nullptr; // Always zero for single camera, it seems?
60+
mrcal_point3_t* points = nullptr; // Seems to always to be None for single camera?
6261

6362
static std::unique_ptr<mrcal_result> mrcal_calibrate(
6463
// List, depth is ordered array observation[N frames, object_height,
@@ -119,8 +118,10 @@ static std::unique_ptr<mrcal_result> mrcal_calibrate(
119118
auto c_observations_board = observations_board_data.data();
120119
// Try to make sure we don't accidentally make a zero-length array or
121120
// something stupid
122-
mrcal_observation_point_t
123-
c_observations_point[std::max(Nobservations_point, 1)];
121+
std::vector<mrcal_observation_point_t>
122+
observations_point_data(std::max(Nobservations_point, 1));
123+
mrcal_observation_point_t*
124+
c_observations_point = observations_point_data.data();
124125

125126
for (int i_observation = 0; i_observation < Nobservations_board;
126127
i_observation++) {

0 commit comments

Comments
 (0)