Skip to content

Commit

Permalink
Use nullptr (c++11 standard) instead of NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
fspindle committed Oct 28, 2023
1 parent 66fab3a commit 370a131
Show file tree
Hide file tree
Showing 434 changed files with 2,682 additions and 2,656 deletions.
2 changes: 1 addition & 1 deletion apps/calibration/visp-compute-chessboard-poses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ int main(int argc, const char **argv)


#if defined(VISP_HAVE_MODULE_GUI)
vpDisplay *display = NULL;
vpDisplay *display = nullptr;
if (opt_interactive) {
#if defined(VISP_HAVE_X11)
display = new vpDisplayX(I);
Expand Down
8 changes: 4 additions & 4 deletions demo/wireframe-simulator/servoSimu4Points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ bool getOptions(int argc, const char **argv, bool &display, bool &plot)
plot = false;
break;
case 'h':
usage(argv[0], NULL);
usage(argv[0], nullptr);
return false;

default:
Expand All @@ -146,7 +146,7 @@ bool getOptions(int argc, const char **argv, bool &display, bool &plot)

if ((c == 1) || (c == -1)) {
// standalone param or error
usage(argv[0], NULL);
usage(argv[0], nullptr);
std::cerr << "ERROR: " << std::endl;
std::cerr << " Bad argument " << optarg_ << std::endl << std::endl;
return false;
Expand Down Expand Up @@ -200,7 +200,7 @@ int main(int argc, const char **argv)
vpDisplay::flush(Iext2);
}

vpPlot *plotter = NULL;
vpPlot *plotter = nullptr;

if (opt_plot) {
plotter = new vpPlot(2, 480, 640, 750, 550, "Real time curves plotter");
Expand Down Expand Up @@ -464,7 +464,7 @@ int main(int argc, const char **argv)
std::cout << "|| s - s* || = " << (task.getError()).sumSquare() << std::endl;
}

if (opt_plot && plotter != NULL) {
if (opt_plot && plotter != nullptr) {
vpDisplay::display(Iint);
sim.getInternalImage(Iint);
vpDisplay::displayFrame(Iint, cMo, camera, 0.2, vpColor::none);
Expand Down
8 changes: 4 additions & 4 deletions demo/wireframe-simulator/servoSimuCylinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ bool getOptions(int argc, const char **argv, bool &display, bool &plot)
plot = false;
break;
case 'h':
usage(argv[0], NULL);
usage(argv[0], nullptr);
return false;

default:
Expand All @@ -147,7 +147,7 @@ bool getOptions(int argc, const char **argv, bool &display, bool &plot)

if ((c == 1) || (c == -1)) {
// standalone param or error
usage(argv[0], NULL);
usage(argv[0], nullptr);
std::cerr << "ERROR: " << std::endl;
std::cerr << " Bad argument " << optarg_ << std::endl << std::endl;
return false;
Expand Down Expand Up @@ -194,7 +194,7 @@ int main(int argc, const char **argv)
vpDisplay::flush(Iext);
}

vpPlot *plotter = NULL;
vpPlot *plotter = nullptr;

vpServo task;
vpSimulatorCamera robot;
Expand Down Expand Up @@ -436,7 +436,7 @@ int main(int argc, const char **argv)
std::cout << "|| s - s* || = " << (task.getError()).sumSquare() << std::endl;
}

if (opt_plot && plotter != NULL) {
if (opt_plot && plotter != nullptr) {
vpDisplay::display(Iint);
sim.getInternalImage(Iint);
vpDisplay::displayFrame(Iint, cMo, camera, 0.2, vpColor::none);
Expand Down
8 changes: 4 additions & 4 deletions demo/wireframe-simulator/servoSimuSphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ bool getOptions(int argc, const char **argv, bool &display, bool &plot)
plot = false;
break;
case 'h':
usage(argv[0], NULL);
usage(argv[0], nullptr);
return false;

default:
Expand All @@ -142,7 +142,7 @@ bool getOptions(int argc, const char **argv, bool &display, bool &plot)

if ((c == 1) || (c == -1)) {
// standalone param or error
usage(argv[0], NULL);
usage(argv[0], nullptr);
std::cerr << "ERROR: " << std::endl;
std::cerr << " Bad argument " << optarg_ << std::endl << std::endl;
return false;
Expand Down Expand Up @@ -254,7 +254,7 @@ int main(int argc, const char **argv)
vpDisplay::flush(Iext2);
}

vpPlot *plotter = NULL;
vpPlot *plotter = nullptr;

vpServo task;
vpSimulatorCamera robot;
Expand Down Expand Up @@ -473,7 +473,7 @@ int main(int argc, const char **argv)
std::cout << "|| s - s* || = " << (task.getError()).sumSquare() << std::endl;
}

if (opt_plot && plotter != NULL) {
if (opt_plot && plotter != nullptr) {
vpDisplay::display(Iint);
sim.getInternalImage(Iint);
vpDisplay::displayFrame(Iint, cMo, camera, 0.2, vpColor::none);
Expand Down
25 changes: 13 additions & 12 deletions example/coin-simulator/simulateCircle2DCamVelocity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ bool getOptions(int argc, const char **argv, std::string &ipath, bool &display)
display = false;
break;
case 'h':
usage(argv[0], NULL, ipath);
usage(argv[0], nullptr, ipath);
return false;
break;

Expand All @@ -149,7 +149,7 @@ bool getOptions(int argc, const char **argv, std::string &ipath, bool &display)

if ((c == 1) || (c == -1)) {
// standalone param or error
usage(argv[0], NULL, ipath);
usage(argv[0], nullptr, ipath);
std::cerr << "ERROR: " << std::endl;
std::cerr << " Bad argument " << optarg << std::endl << std::endl;
return false;
Expand Down Expand Up @@ -282,7 +282,7 @@ static void *mainLoop(void *_simu)

simu->closeMainApplication();

void *a = NULL;
void *a = nullptr;
return a;
}

Expand Down Expand Up @@ -318,19 +318,19 @@ int main(int argc, const char **argv)
if (ipath != env_ipath) {
std::cout << std::endl << "WARNING: " << std::endl;
std::cout << " Since -i <visp image path=" << ipath << "> "
<< " is different from VISP_INPUT_IMAGE_PATH=" << env_ipath << std::endl
<< " we skip the environment variable." << std::endl;
<< " is different from VISP_INPUT_IMAGE_PATH=" << env_ipath << std::endl
<< " we skip the environment variable." << std::endl;
}
}

// Test if an input path is set
if (opt_ipath.empty() && env_ipath.empty()) {
usage(argv[0], NULL, ipath);
usage(argv[0], nullptr, ipath);
std::cerr << std::endl << "ERROR:" << std::endl;
std::cerr << " Use -i <visp image path> option or set VISP_INPUT_IMAGE_PATH " << std::endl
<< " environment variable to specify the location of the " << std::endl
<< " image path where test images are located." << std::endl
<< std::endl;
<< " environment variable to specify the location of the " << std::endl
<< " image path where test images are located." << std::endl
<< std::endl;
return EXIT_FAILURE;
}

Expand Down Expand Up @@ -358,7 +358,8 @@ int main(int argc, const char **argv)
simu.mainLoop();
}
return EXIT_SUCCESS;
} catch (const vpException &e) {
}
catch (const vpException &e) {
std::cout << "Catch an exception: " << e << std::endl;
return EXIT_FAILURE;
}
Expand All @@ -370,8 +371,8 @@ int main()
std::cout << "You do not have Coin3D and SoQT or SoWin or SoXt functionalities enabled..." << std::endl;
std::cout << "Tip:" << std::endl;
std::cout
<< "- Install Coin3D and SoQT or SoWin or SoXt, configure ViSP again using cmake and build again this example"
<< std::endl;
<< "- Install Coin3D and SoQT or SoWin or SoXt, configure ViSP again using cmake and build again this example"
<< std::endl;
return EXIT_SUCCESS;
}
#endif
25 changes: 13 additions & 12 deletions example/coin-simulator/simulateFourPoints2DCartesianCamVelocity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ bool getOptions(int argc, const char **argv, std::string &ipath, bool &display)
display = false;
break;
case 'h':
usage(argv[0], NULL, ipath);
usage(argv[0], nullptr, ipath);
return false;
break;

Expand All @@ -149,7 +149,7 @@ bool getOptions(int argc, const char **argv, std::string &ipath, bool &display)

if ((c == 1) || (c == -1)) {
// standalone param or error
usage(argv[0], NULL, ipath);
usage(argv[0], nullptr, ipath);
std::cerr << "ERROR: " << std::endl;
std::cerr << " Bad argument " << optarg << std::endl << std::endl;
return false;
Expand Down Expand Up @@ -293,7 +293,7 @@ static void *mainLoop(void *_simu)

simu->closeMainApplication();

void *a = NULL;
void *a = nullptr;
return a;
}

Expand Down Expand Up @@ -329,19 +329,19 @@ int main(int argc, const char **argv)
if (ipath != env_ipath) {
std::cout << std::endl << "WARNING: " << std::endl;
std::cout << " Since -i <visp image path=" << ipath << "> "
<< " is different from VISP_IMAGE_PATH=" << env_ipath << std::endl
<< " we skip the environment variable." << std::endl;
<< " is different from VISP_IMAGE_PATH=" << env_ipath << std::endl
<< " we skip the environment variable." << std::endl;
}
}

// Test if an input path is set
if (opt_ipath.empty() && env_ipath.empty()) {
usage(argv[0], NULL, ipath);
usage(argv[0], nullptr, ipath);
std::cerr << std::endl << "ERROR:" << std::endl;
std::cerr << " Use -i <visp image path> option or set VISP_INPUT_IMAGE_PATH " << std::endl
<< " environment variable to specify the location of the " << std::endl
<< " image path where test images are located." << std::endl
<< std::endl;
<< " environment variable to specify the location of the " << std::endl
<< " image path where test images are located." << std::endl
<< std::endl;
return EXIT_FAILURE;
}

Expand All @@ -368,7 +368,8 @@ int main(int argc, const char **argv)
simu.mainLoop();
}
return EXIT_SUCCESS;
} catch (const vpException &e) {
}
catch (const vpException &e) {
std::cout << "Catch an exception: " << e << std::endl;
return EXIT_FAILURE;
}
Expand All @@ -380,8 +381,8 @@ int main()
std::cout << "You do not have Coin3D and SoQT or SoWin or SoXt functionalities enabled..." << std::endl;
std::cout << "Tip:" << std::endl;
std::cout
<< "- Install Coin3D and SoQT or SoWin or SoXt, configure ViSP again using cmake and build again this example"
<< std::endl;
<< "- Install Coin3D and SoQT or SoWin or SoXt, configure ViSP again using cmake and build again this example"
<< std::endl;
return EXIT_SUCCESS;
}
#endif
25 changes: 13 additions & 12 deletions example/coin-simulator/simulateFourPoints2DPolarCamVelocity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ bool getOptions(int argc, const char **argv, std::string &ipath, bool &display)
display = false;
break;
case 'h':
usage(argv[0], NULL, ipath);
usage(argv[0], nullptr, ipath);
return false;
break;

Expand All @@ -147,7 +147,7 @@ bool getOptions(int argc, const char **argv, std::string &ipath, bool &display)

if ((c == 1) || (c == -1)) {
// standalone param or error
usage(argv[0], NULL, ipath);
usage(argv[0], nullptr, ipath);
std::cerr << "ERROR: " << std::endl;
std::cerr << " Bad argument " << optarg << std::endl << std::endl;
return false;
Expand Down Expand Up @@ -315,7 +315,7 @@ static void *mainLoop(void *_simu)

simu->closeMainApplication();

void *a = NULL;
void *a = nullptr;
return a;
}

Expand Down Expand Up @@ -351,19 +351,19 @@ int main(int argc, const char **argv)
if (ipath != env_ipath) {
std::cout << std::endl << "WARNING: " << std::endl;
std::cout << " Since -i <visp image path=" << ipath << "> "
<< " is different from VISP_IMAGE_PATH=" << env_ipath << std::endl
<< " we skip the environment variable." << std::endl;
<< " is different from VISP_IMAGE_PATH=" << env_ipath << std::endl
<< " we skip the environment variable." << std::endl;
}
}

// Test if an input path is set
if (opt_ipath.empty() && env_ipath.empty()) {
usage(argv[0], NULL, ipath);
usage(argv[0], nullptr, ipath);
std::cerr << std::endl << "ERROR:" << std::endl;
std::cerr << " Use -i <visp image path> option or set VISP_INPUT_IMAGE_PATH " << std::endl
<< " environment variable to specify the location of the " << std::endl
<< " image path where test images are located." << std::endl
<< std::endl;
<< " environment variable to specify the location of the " << std::endl
<< " image path where test images are located." << std::endl
<< std::endl;
return EXIT_FAILURE;
}

Expand All @@ -390,7 +390,8 @@ int main(int argc, const char **argv)
simu.mainLoop();
}
return EXIT_SUCCESS;
} catch (const vpException &e) {
}
catch (const vpException &e) {
std::cout << "Catch an exception: " << e << std::endl;
return EXIT_FAILURE;
}
Expand All @@ -402,8 +403,8 @@ int main()
std::cout << "You do not have Coin3D and SoQT or SoWin or SoXt functionalities enabled..." << std::endl;
std::cout << "Tip:" << std::endl;
std::cout
<< "- Install Coin3D and SoQT or SoWin or SoXt, configure ViSP again using cmake and build again this example"
<< std::endl;
<< "- Install Coin3D and SoQT or SoWin or SoXt, configure ViSP again using cmake and build again this example"
<< std::endl;
return EXIT_SUCCESS;
}
#endif
8 changes: 4 additions & 4 deletions example/device/display/displayD3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ bool getOptions(int argc, const char **argv, std::string &ipath, std::string &op
opath = optarg;
break;
case 'h':
usage(argv[0], NULL, ipath, opath, user);
usage(argv[0], nullptr, ipath, opath, user);
return false;
break;

Expand All @@ -175,7 +175,7 @@ bool getOptions(int argc, const char **argv, std::string &ipath, std::string &op

if ((c == 1) || (c == -1)) {
// standalone param or error
usage(argv[0], NULL, ipath, opath, user);
usage(argv[0], nullptr, ipath, opath, user);
std::cerr << "ERROR: " << std::endl;
std::cerr << " Bad argument " << optarg << std::endl << std::endl;
return false;
Expand Down Expand Up @@ -232,7 +232,7 @@ int main(int argc, const char **argv)
vpIoTools::makeDirectory(odirname);
}
catch (...) {
usage(argv[0], NULL, ipath, opath, username);
usage(argv[0], nullptr, ipath, opath, username);
std::cerr << std::endl << "ERROR:" << std::endl;
std::cerr << " Cannot create " << odirname << std::endl;
std::cerr << " Check your -o " << opath << " option " << std::endl;
Expand All @@ -253,7 +253,7 @@ int main(int argc, const char **argv)

// Test if an input path is set
if (opt_ipath.empty() && env_ipath.empty()) {
usage(argv[0], NULL, ipath, opath, username);
usage(argv[0], nullptr, ipath, opath, username);
std::cerr << std::endl << "ERROR:" << std::endl;
std::cerr << " Use -i <visp image path> option or set VISP_INPUT_IMAGE_PATH " << std::endl
<< " environment variable to specify the location of the " << std::endl
Expand Down
Loading

0 comments on commit 370a131

Please sign in to comment.