Skip to content

Commit

Permalink
Rename util/strings.h to util/string_utils.h
Browse files Browse the repository at this point in the history
This rename prevents an unintended include of util/strings.h from the C library on some system comfigurations. This fixes simonfuhrmann#569.
  • Loading branch information
simonfuhrmann committed Aug 20, 2024
1 parent 76302a4 commit 335bfe4
Show file tree
Hide file tree
Showing 26 changed files with 56 additions and 56 deletions.
14 changes: 7 additions & 7 deletions apps/makescene/makescene.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "util/system.h"
#include "util/timer.h"
#include "util/arguments.h"
#include "util/strings.h"
#include "util/string_utils.h"
#include "util/file_system.h"
#include "util/tokenizer.h"
#include "mve/bundle.h"
Expand Down Expand Up @@ -353,10 +353,10 @@ import_bundle_nvm_or_colmap (AppSettings const& conf, bool load_nvm = true)
if (cam_infos.size() != cameras.size())
{
if (load_nvm)
std::cerr << "Error: NVM info inconsistent with bundle!"
std::cerr << "Error: NVM info inconsistent with bundle!"
<< std::endl;
else
std::cerr << "Error: Colmap info inconsistent with bundle!"
std::cerr << "Error: Colmap info inconsistent with bundle!"
<< std::endl;
return;
}
Expand Down Expand Up @@ -860,19 +860,19 @@ is_colmap_sfm_bundle_format (AppSettings const& conf)

std::string cameras_txt_filename = join_path(model_path, "cameras.txt");
std::string cameras_bin_filename = join_path(model_path, "cameras.bin");
if (!util::fs::file_exists(cameras_txt_filename.c_str()) &&
if (!util::fs::file_exists(cameras_txt_filename.c_str()) &&
!util::fs::file_exists(cameras_bin_filename.c_str()))
return false;

std::string images_txt_filename = join_path(model_path, "images.txt");
std::string images_bin_filename = join_path(model_path, "images.bin");
if (!util::fs::file_exists(images_txt_filename.c_str()) &&
if (!util::fs::file_exists(images_txt_filename.c_str()) &&
!util::fs::file_exists(images_bin_filename.c_str()))
return false;

std::string points_3D_txt_filename = join_path(model_path, "points3D.txt");
std::string points_3D_bin_filename = join_path(model_path, "points3D.bin");
if (!util::fs::file_exists(points_3D_txt_filename.c_str()) &&
if (!util::fs::file_exists(points_3D_txt_filename.c_str()) &&
!util::fs::file_exists(points_3D_bin_filename.c_str()))
return false;

Expand Down Expand Up @@ -917,7 +917,7 @@ import_bundle (AppSettings const& conf)

/**
* Try to detect Colmap bundle format.
* In this case the input folder contains files with extension ".txt" or
* In this case the input folder contains files with extension ".txt" or
* ".bin".
*/
if (is_colmap_sfm_bundle_format(conf))
Expand Down
2 changes: 1 addition & 1 deletion apps/meshalign/meshalign.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "util/system.h"
#include "util/file_system.h"
#include "util/arguments.h"
#include "util/strings.h"
#include "util/string_utils.h"
#include "mve/mesh.h"
#include "mve/mesh_io.h"
#include "mve/mesh_tools.h"
Expand Down
2 changes: 1 addition & 1 deletion apps/meshalign/meshlab_alignment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <cerrno>

#include "util/exception.h"
#include "util/strings.h"
#include "util/string_utils.h"
#include "util/file_system.h"
#include "util/tokenizer.h"
#include "mve/mesh_io.h"
Expand Down
2 changes: 1 addition & 1 deletion apps/meshalign/stanford_alignment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <fstream>

#include "util/file_system.h"
#include "util/strings.h"
#include "util/string_utils.h"
#include "util/exception.h"
#include "util/tokenizer.h"
#include "mve/mesh.h"
Expand Down
2 changes: 1 addition & 1 deletion apps/meshconvert/meshconvert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include "util/system.h"
#include "util/arguments.h"
#include "util/strings.h"
#include "util/string_utils.h"
#include "mve/mesh_io.h"
#include "mve/mesh_io_ply.h"

Expand Down
2 changes: 1 addition & 1 deletion apps/umve/jobqueue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <iostream>
#include <QThreadPool>

#include "util/strings.h"
#include "util/string_utils.h"
#include "jobqueue.h"

JobQueue*
Expand Down
2 changes: 1 addition & 1 deletion apps/umve/scene_addins/camera_sequence.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "util/exception.h"
#include "util/tokenizer.h"
#include "util/strings.h"
#include "util/string_utils.h"

#include "scene_addins/camera_sequence.h"

Expand Down
2 changes: 1 addition & 1 deletion apps/umve/scene_addins/mesh_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <QColorDialog>

#include "util/file_system.h"
#include "util/strings.h"
#include "util/string_utils.h"
#include "mve/mesh.h"
#include "mve/mesh_io.h"
#include "mve/mesh_tools.h"
Expand Down
2 changes: 1 addition & 1 deletion apps/umve/sceneoverview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <QLineEdit>

#include "util/strings.h"
#include "util/string_utils.h"

#include "guihelpers.h"
#include "scenemanager.h"
Expand Down
2 changes: 1 addition & 1 deletion apps/umve/viewinspect/tonemapping.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <QRadioButton>

#include "util/timer.h"
#include "util/strings.h"
#include "util/string_utils.h"
#include "mve/image.h"
#include "mve/image_tools.h"

Expand Down
2 changes: 1 addition & 1 deletion libs/dmrecon/dmrecon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "mve/image.h"
#include "mve/image_tools.h"
#include "util/file_system.h"
#include "util/strings.h"
#include "util/string_utils.h"
#include "dmrecon/settings.h"
#include "dmrecon/dmrecon.h"
#include "dmrecon/global_view_selection.h"
Expand Down
2 changes: 1 addition & 1 deletion libs/dmrecon/patch_optimization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* of the BSD 3-Clause license. See the LICENSE.txt file for details.
*/

#include "util/strings.h"
#include "util/string_utils.h"
#include "math/algo.h"
#include "math/defines.h"
#include "math/matrix.h"
Expand Down
2 changes: 1 addition & 1 deletion libs/fssr/iso_octree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <limits>

#include "util/timer.h"
#include "util/strings.h"
#include "util/string_utils.h"
#include "fssr/basis_function.h"
#include "fssr/sample.h"
#include "fssr/iso_octree.h"
Expand Down
32 changes: 16 additions & 16 deletions libs/mve/bundle_io.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include "util/system.h"
#include "util/file_system.h"
#include "util/strings.h"
#include "util/string_utils.h"
#include "util/exception.h"
#include "math/matrix.h"
#include "math/vector.h"
Expand Down Expand Up @@ -562,7 +562,7 @@ create_camera_info_from_params(CameraInfo& camera_info,
camera_info.ppoint[0] = params[2] / width;
camera_info.ppoint[1] = params[3] / height;
}
else
else
{
std::string msg = "Unsupported camera model with radial distortion "
"detected! If possible, re-run the SfM reconstruction with the "
Expand Down Expand Up @@ -700,7 +700,7 @@ load_colmap_images_txt(std::string const& images_filename,
CameraInfo model = camera_colmap_id_to_model.at(camera_colmap_id);
initialize_bundle_cam(model, quat, trans, &bundle_cam);
determine_depth_map_path(depth_path, image_name, &depth_map_name);
initialize_cam_info(model, image_path, image_name, depth_path,
initialize_cam_info(model, image_path, image_name, depth_path,
depth_map_name, &colmap_cam_info);

std::string point_2d_line;
Expand All @@ -712,7 +712,7 @@ load_colmap_images_txt(std::string const& images_filename,
ref.view_id = view_id;
point_2d_line_ss >> ref.pos[0] >> ref.pos[1];
point_2d_line_ss >> feature_3d_colmap_id;
// A POINT2D that does not correspond to a POINT3D has a POINT3D_ID
// A POINT2D that does not correspond to a POINT3D has a POINT3D_ID
// of -1
if (feature_3d_colmap_id == -1)
ref.feature_id = -1;
Expand All @@ -722,7 +722,7 @@ load_colmap_images_txt(std::string const& images_filename,
}
bundle_cams.push_back(bundle_cam);
colmap_cams_info.push_back(colmap_cam_info);
}
}
if (camera_info != nullptr)
std::swap(*camera_info, colmap_cams_info);
in_images.close();
Expand Down Expand Up @@ -772,9 +772,9 @@ load_colmap_points_3D_txt(std::string const& points3D_filename,
int feature_2d_idx; // starts at 0
point_3d_line_ss >> view_colmap_id >> feature_2d_idx;
int view_id = view_colmap_id - 1;
// Make sure that each point only has a single observation per
// Make sure that each point only has a single observation per
// image, since MVE does not support multiple observations.
if (std::find(view_ids.begin(), view_ids.end(), view_id) !=
if (std::find(view_ids.begin(), view_ids.end(), view_id) !=
view_ids.end())
continue;
view_ids.push_back(view_id);
Expand Down Expand Up @@ -911,19 +911,19 @@ load_colmap_images_bin(std::string const& images_filename,
CameraInfo model = camera_colmap_id_to_model.at(camera_colmap_id);
initialize_bundle_cam(model, quat, trans, &bundle_cam);
determine_depth_map_path(depth_path, image_name, &depth_map_name);
initialize_cam_info(model, image_path, image_name, depth_path,
initialize_cam_info(model, image_path, image_name, depth_path,
depth_map_name, &colmap_cam_info);

const std::size_t num_points_2D = read_binary_little_endian<uint64_t>(
&in_images);
for (std::size_t point_2d_idx = 0; point_2d_idx < num_points_2D;
++point_2d_idx)
for (std::size_t point_2d_idx = 0; point_2d_idx < num_points_2D;
++point_2d_idx)
{
Bundle::Feature2D ref;
ref.view_id = view_id;
ref.pos[0] = (float)read_binary_little_endian<double>(&in_images);
ref.pos[1] = (float)read_binary_little_endian<double>(&in_images);
// A POINT2D that does not correspond to a POINT3D has a POINT3D_ID
// A POINT2D that does not correspond to a POINT3D has a POINT3D_ID
// of -1
feature_3d_colmap_id = (uint32_t)read_binary_little_endian<
point3D_t>(&in_images);
Expand Down Expand Up @@ -955,7 +955,7 @@ load_colmap_points_3D_bin(std::string const& points3D_filename,
Bundle::Features& features = bundle->get_features();
features.reserve(num_features);
std::size_t num_views = bundle->get_cameras().size();
for (std::size_t feature_3d_idx = 0; feature_3d_idx < num_features;
for (std::size_t feature_3d_idx = 0; feature_3d_idx < num_features;
++feature_3d_idx)
{
Bundle::Feature3D feature_3d;
Expand Down Expand Up @@ -987,9 +987,9 @@ load_colmap_points_3D_bin(std::string const& points3D_filename,
view_colmap_id = read_binary_little_endian<image_t>(&in_points3D);
int view_id = view_colmap_id - 1;
feature_2d_idx = read_binary_little_endian<point2D_t>(&in_points3D);
// Make sure that each point only has a single observation per
// Make sure that each point only has a single observation per
// image, since MVE does not support multiple observations.
if (std::find(view_ids.begin(), view_ids.end(),
if (std::find(view_ids.begin(), view_ids.end(),
view_id) != view_ids.end())
continue;
view_ids.push_back(view_id);
Expand All @@ -1006,7 +1006,7 @@ load_colmap_points_3D_bin(std::string const& points3D_filename,
num_refs = refs.size();

/* There should be at least 2 cameras that see the point. */
if (num_refs < 2 || num_refs > num_views)
if (num_refs < 2 || num_refs > num_views)
{
throw util::Exception("Invalid number of feature refs: ",
util::string::get(num_refs));
Expand Down Expand Up @@ -1154,7 +1154,7 @@ load_colmap_depth_map(int scale, mve::CameraInfo& mve_cam, int original_width,
math::Matrix3f inv_calib;
mve_cam.fill_inverse_calibration(*inv_calib, original_width,
original_height);
mve::image::depthmap_convert_conventions<float>(depth_image, inv_calib,
mve::image::depthmap_convert_conventions<float>(depth_image, inv_calib,
true);

if (depth_width == original_width && depth_height == original_height)
Expand Down
2 changes: 1 addition & 1 deletion libs/mve/image_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <memory>
#include <vector>

#include "util/strings.h"
#include "util/string_utils.h"
#include "mve/defines.h"

MVE_NAMESPACE_BEGIN
Expand Down
2 changes: 1 addition & 1 deletion libs/mve/image_exif.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <limits>

#include "util/system.h"
#include "util/strings.h"
#include "util/string_utils.h"
#include "mve/image_exif.h"

MVE_NAMESPACE_BEGIN
Expand Down
2 changes: 1 addition & 1 deletion libs/mve/image_io.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "math/algo.h"
#include "util/exception.h"
#include "util/strings.h"
#include "util/string_utils.h"
#include "util/system.h"
#include "mve/image_io.h"

Expand Down
2 changes: 1 addition & 1 deletion libs/mve/mesh_io.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <stdexcept>

#include "util/strings.h"
#include "util/string_utils.h"
#include "mve/mesh.h"
#include "mve/mesh_io.h"
#include "mve/mesh_io_ply.h"
Expand Down
2 changes: 1 addition & 1 deletion libs/mve/mesh_io_obj.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <cstring>
#include <map>

#include "util/strings.h"
#include "util/string_utils.h"
#include "util/tokenizer.h"
#include "util/exception.h"
#include "util/file_system.h"
Expand Down
2 changes: 1 addition & 1 deletion libs/ogl/check_gl_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "ogl/defines.h"
#include "ogl/opengl.h"
#include "util/strings.h"
#include "util/string_utils.h"

OGL_NAMESPACE_BEGIN

Expand Down
2 changes: 1 addition & 1 deletion libs/util/arguments.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <iomanip>
#include <limits>

#include "util/strings.h"
#include "util/string_utils.h"
#include "util/tokenizer.h"
#include "util/arguments.h"

Expand Down
2 changes: 1 addition & 1 deletion libs/util/arguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <string>
#include <stdexcept>

#include "util/strings.h"
#include "util/string_utils.h"
#include "util/defines.h"
#include "util/exception.h"

Expand Down
2 changes: 1 addition & 1 deletion libs/util/ini_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <sstream>

#include "util/exception.h"
#include "util/strings.h"
#include "util/string_utils.h"
#include "util/ini_parser.h"

UTIL_NAMESPACE_BEGIN
Expand Down
6 changes: 3 additions & 3 deletions libs/util/strings.h → libs/util/string_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* of the BSD 3-Clause license. See the LICENSE.txt file for details.
*/

#ifndef UTIL_STRING_HEADER
#define UTIL_STRING_HEADER
#ifndef UTIL_STRING_UTILS_HEADER
#define UTIL_STRING_UTILS_HEADER

#include <sstream>
#include <string>
Expand Down Expand Up @@ -511,4 +511,4 @@ get_size_string (std::size_t size)
UTIL_STRING_NAMESPACE_END
UTIL_NAMESPACE_END

#endif /* UTIL_STRING_HEADER */
#endif /* UTIL_STRING_UTILS_HEADER */
2 changes: 1 addition & 1 deletion libs/util/tokenizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <sstream>
#include <algorithm>

#include "util/strings.h"
#include "util/string_utils.h"
#include "util/defines.h"

UTIL_NAMESPACE_BEGIN
Expand Down
Loading

0 comments on commit 335bfe4

Please sign in to comment.