From 8f607402053e1bcc910b04be221b5cf1daaed05c Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 15 Dec 2015 22:06:11 +0300 Subject: [PATCH] fix build warning (unreachable code) and exit error codes --- samples/cpp/cloning_gui.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/samples/cpp/cloning_gui.cpp b/samples/cpp/cloning_gui.cpp index 668dd2a959..289eae8de0 100644 --- a/samples/cpp/cloning_gui.cpp +++ b/samples/cpp/cloning_gui.cpp @@ -231,7 +231,7 @@ void destination(int event, int x, int y, int, void*) if(maxxd > im1.size().width || maxyd > im1.size().height || minxd < 0 || minyd < 0) { cout << "Index out of range" << endl; - exit(0); + exit(1); } final1 = Mat::zeros(img2.size(),CV_8UC3); @@ -322,12 +322,12 @@ int main() if(img0.empty()) { cout << "Source Image does not exist" << endl; - exit(0); + exit(2); } if(img2.empty()) { cout << "Destination Image does not exist" << endl; - exit(0); + exit(2); } channel = img0.channels(); @@ -370,7 +370,7 @@ int main() if(img0.empty()) { cout << "Source Image does not exist" << endl; - exit(0); + exit(2); } res1 = Mat::zeros(img0.size(),CV_8UC1); @@ -400,7 +400,7 @@ int main() if(img0.empty()) { cout << "Source Image does not exist" << endl; - exit(0); + exit(2); } res1 = Mat::zeros(img0.size(),CV_8UC1); @@ -433,7 +433,7 @@ int main() if(img0.empty()) { cout << "Source Image does not exist" << endl; - exit(0); + exit(2); } res1 = Mat::zeros(img0.size(),CV_8UC1); @@ -448,7 +448,7 @@ int main() else { cout << "Wrong Option Choosen" << endl; - exit(0); + exit(1); } for(;;) @@ -541,7 +541,7 @@ int main() imwrite("cloned.png",blend); } else if(key == 'q') - exit(0); + break; } - waitKey(0); + return 0; }