Skip to content

Commit

Permalink
Merge pull request #2758 from SunBlack/readability-redundant-string-init
Browse files Browse the repository at this point in the history
Remove redundant string initialization with ""
  • Loading branch information
taketwo authored Jan 8, 2019
2 parents 574dae6 + d60425c commit eb30368
Show file tree
Hide file tree
Showing 20 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ namespace pcl

//get models in directory
std::vector < std::string > files;
std::string start = "";
std::string start;
std::string ext = std::string ("ply");
bf::path dir = path_;
getModelsInDirectory (dir, start, files, ext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ template<template<class > class DistT, typename PointT, typename FeatureT>
//read mians scenes
bf::path ply_files_dir = scenes_dir;
std::vector < std::string > files;
std::string start = "";
std::string start;
getScenesInDirectory (ply_files_dir, start, files);

std::sort (files.begin (), files.end (), sortFiles);
Expand Down Expand Up @@ -314,10 +314,10 @@ float CG_THRESHOLD_ = 0.005f;
int
main (int argc, char ** argv)
{
std::string path = "";
std::string path;
std::string desc_name = "shot_omp";
std::string training_dir = "trained_models/";
std::string mians_scenes = "";
std::string mians_scenes;
int force_retrain = 0;
int icp_iterations = 20;
int use_cache = 1;
Expand Down Expand Up @@ -366,7 +366,7 @@ main (int argc, char ** argv)
else
{
std::vector < std::string > files;
std::string start = "";
std::string start;
std::string ext = std::string ("ply");
bf::path dir = models_dir_path;
getModelsInDirectory (dir, start, files, ext);
Expand Down
2 changes: 1 addition & 1 deletion apps/point_cloud_editor/src/statistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ std::vector<Statistics*> Statistics::stat_vec_;
std::string
Statistics::getStats()
{
std::string result = "";
std::string result;
std::vector<Statistics*>::const_iterator stat_vec_it;
for(stat_vec_it = stat_vec_.begin(); stat_vec_it != stat_vec_.end(); ++stat_vec_it)
{
Expand Down
2 changes: 1 addition & 1 deletion apps/src/face_detection/face_trainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ int main(int argc, char ** argv)
int ntrees = 10;
std::string forest_fn = "forest.txt";
int n_features = 1000;
std::string directory = "";
std::string directory;
int use_normals = 0;
int num_images = 3000;

Expand Down
2 changes: 1 addition & 1 deletion apps/src/face_detection/filesystem_face_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ int main(int argc, char ** argv)
if (test_directory.compare ("") != 0)
{
//recognize all files in directory...
std::string start = "";
std::string start;
std::string ext = std::string ("pcd");
bf::path dir = test_directory;

Expand Down
2 changes: 1 addition & 1 deletion apps/src/openni_klt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ boost::shared_ptr<pcl::visualization::ImageViewer> img;
int
main (int argc, char** argv)
{
std::string device_id("");
std::string device_id;
pcl::OpenNIGrabber::Mode depth_mode = pcl::OpenNIGrabber::OpenNI_Default_Mode;
pcl::OpenNIGrabber::Mode image_mode = pcl::OpenNIGrabber::OpenNI_Default_Mode;
bool xyz = false;
Expand Down
2 changes: 1 addition & 1 deletion apps/src/openni_mobile_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ main (int argc, char ** argv)

int port = 11111;
float leaf_x = 0.01f, leaf_y = 0.01f, leaf_z = 0.01f;
std::string device_id = "";
std::string device_id;

pcl::console::parse_argument (argc, argv, "-port", port);
pcl::console::parse_3x_arguments (argc, argv, "-leaf", leaf_x, leaf_y, leaf_z, false);
Expand Down
2 changes: 1 addition & 1 deletion examples/segmentation/example_cpc_segmentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ CPCSegmentation Parameters: \n\
bool save_binary_pcd = pcl::console::find_switch (argc, argv, "-bin");

/// Create variables needed for preparations
std::string outputname ("");
std::string outputname;
pcl::PointCloud<PointT>::Ptr input_cloud_ptr (new pcl::PointCloud<PointT>);
pcl::PointCloud<pcl::Normal>::Ptr input_normals_ptr (new pcl::PointCloud<pcl::Normal>);
bool has_normals = false;
Expand Down
2 changes: 1 addition & 1 deletion examples/segmentation/example_lccp_segmentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ LCCPSegmentation Parameters: \n\
bool save_binary_pcd = pcl::console::find_switch (argc, argv, "-bin");

/// Create variables needed for preparations
std::string outputname ("");
std::string outputname;
pcl::PointCloud<PointT>::Ptr input_cloud_ptr (new pcl::PointCloud<PointT>);
pcl::PointCloud<pcl::Normal>::Ptr input_normals_ptr (new pcl::PointCloud<pcl::Normal>);
bool has_normals = false;
Expand Down
2 changes: 1 addition & 1 deletion io/tools/openni_pcd_recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ main (int argc, char** argv)
{
print_highlight ("PCL OpenNI Recorder for saving buffered PCD (binary compressed to disk). See %s -h for options.\n", argv[0]);

std::string device_id ("");
std::string device_id;
int buff_size = BUFFER_SIZE;

if (argc >= 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace pcl
template<class FeatureType, class DataSet, class LabelType, class ExampleIndex, class NodeType>
void pcl::face_detection::FaceDetectorDataProvider<FeatureType, DataSet, LabelType, ExampleIndex, NodeType>::initialize(std::string & data_dir)
{
std::string start = "";
std::string start;
std::string ext = std::string ("pcd");
bf::path dir = data_dir;

Expand Down
2 changes: 1 addition & 1 deletion tools/openni_save_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ usage (char ** argv)
int
main(int argc, char ** argv)
{
std::string device_id ("");
std::string device_id;
pcl::OpenNIGrabber::Mode image_mode = pcl::OpenNIGrabber::OpenNI_Default_Mode;
pcl::OpenNIGrabber::Mode depth_mode = pcl::OpenNIGrabber::OpenNI_Default_Mode;

Expand Down
2 changes: 1 addition & 1 deletion visualization/src/pcl_visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4512,7 +4512,7 @@ pcl::visualization::PCLVisualizer::textureFromTexMaterial (const pcl::TexMateria
boost::filesystem::path parent_dir = full_path.parent_path ();
std::string upper_filename = tex_mat.tex_file;
boost::to_upper (upper_filename);
std::string real_name = "";
std::string real_name;

try
{
Expand Down
4 changes: 2 additions & 2 deletions visualization/tools/image_grabber_saver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ main (int argc, char** argv)
float focal_length = 525.0;
pcl::console::parse (argc, argv, "-focal", focal_length);

std::string depth_path = "";
std::string depth_path;
pcl::console::parse_argument (argc, argv, "-depth_dir", depth_path);

std::string rgb_path = "";
std::string rgb_path;
pcl::console::parse_argument (argc, argv, "-rgb_dir", rgb_path);

pcl::console::parse_argument (argc, argv, "-out_dir", out_folder);
Expand Down
2 changes: 1 addition & 1 deletion visualization/tools/image_grabber_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ main (int argc, char** argv)
bool use_pclzf = (pcl::console::find_argument (argc, argv, "-pclzf") != -1);

std::cout << "fps: " << frames_per_second << " , repeat: " << repeat << std::endl;
std::string path = "";
std::string path;
pcl::console::parse_argument (argc, argv, "-dir", path);
std::cout << "path: " << path << std::endl;
if (path != "" && boost::filesystem::exists (path))
Expand Down
2 changes: 1 addition & 1 deletion visualization/tools/oni_viewer_simple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ usage(char ** argv)
int
main(int argc, char ** argv)
{
std::string arg("");
std::string arg;

unsigned frame_rate = 0;
if (argc >= 2)
Expand Down
2 changes: 1 addition & 1 deletion visualization/tools/openni2_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ boost::shared_ptr<pcl::visualization::ImageViewer> img;
int
main (int argc, char** argv)
{
std::string device_id ("");
std::string device_id;
pcl::io::OpenNI2Grabber::Mode depth_mode = pcl::io::OpenNI2Grabber::OpenNI_Default_Mode;
pcl::io::OpenNI2Grabber::Mode image_mode = pcl::io::OpenNI2Grabber::OpenNI_Default_Mode;
bool xyz = false;
Expand Down
2 changes: 1 addition & 1 deletion visualization/tools/openni_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ main (int argc, char ** argv)
else
print_highlight ("Using default buffer size of %d frames.\n", buff_size);

string device_id ("");
string device_id;
OpenNIGrabber::Mode image_mode = OpenNIGrabber::OpenNI_Default_Mode;
OpenNIGrabber::Mode depth_mode = OpenNIGrabber::OpenNI_Default_Mode;

Expand Down
2 changes: 1 addition & 1 deletion visualization/tools/openni_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ boost::shared_ptr<pcl::visualization::ImageViewer> img;
int
main (int argc, char** argv)
{
std::string device_id("");
std::string device_id;
pcl::OpenNIGrabber::Mode depth_mode = pcl::OpenNIGrabber::OpenNI_Default_Mode;
pcl::OpenNIGrabber::Mode image_mode = pcl::OpenNIGrabber::OpenNI_Default_Mode;
bool xyz = false;
Expand Down
2 changes: 1 addition & 1 deletion visualization/tools/pcd_grabber_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ main (int argc, char** argv)
bool repeat = (pcl::console::find_argument (argc, argv, "-repeat") != -1);

std::cout << "fps: " << frames_per_second << " , repeat: " << repeat << std::endl;
std::string path = "";
std::string path;
pcl::console::parse_argument (argc, argv, "-file", path);
std::cout << "path: " << path << std::endl;
if (path != "" && boost::filesystem::exists (path))
Expand Down

0 comments on commit eb30368

Please sign in to comment.