From 5b6170dfa16fcea14a787989a66391238adbc962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Rombauts?= Date: Tue, 3 Sep 2013 10:30:36 +0200 Subject: [PATCH] Replace abort() by return EXIT_FAILURE --- examples/example1/main.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/example1/main.cpp b/examples/example1/main.cpp index 0c13dcf..c5a867e 100644 --- a/examples/example1/main.cpp +++ b/examples/example1/main.cpp @@ -126,7 +126,7 @@ int main (void) catch (std::exception& e) { std::cout << "SQLite exception: " << e.what() << std::endl; - abort(); // unexpected error : abort the example program + return EXIT_FAILURE; // unexpected error : exit the example program } //////////////////////////////////////////////////////////////////////////// @@ -144,7 +144,7 @@ int main (void) catch (std::exception& e) { std::cout << "SQLite exception: " << e.what() << std::endl; - abort(); // unexpected error : abort the example program + return EXIT_FAILURE; // unexpected error : exit the example program } // The execAndGet wrapper example (3/6) : @@ -163,7 +163,7 @@ int main (void) catch (std::exception& e) { std::cout << "SQLite exception: " << e.what() << std::endl; - abort(); // unexpected error : abort the example program + return EXIT_FAILURE; // unexpected error : exit the example program } //////////////////////////////////////////////////////////////////////////// @@ -203,7 +203,7 @@ int main (void) catch (std::exception& e) { std::cout << "SQLite exception: " << e.what() << std::endl; - abort(); // unexpected error : abort the example program + return EXIT_FAILURE; // unexpected error : exit the example program } remove("test.db3"); @@ -234,7 +234,7 @@ int main (void) catch (std::exception& e) { std::cout << "SQLite exception: " << e.what() << std::endl; - abort(); // unexpected error : abort the example program + return EXIT_FAILURE; // unexpected error : exit the example program } // Exemple of a rollbacked transaction : @@ -249,7 +249,7 @@ int main (void) nb = db.exec("INSERT INTO test ObviousError"); std::cout << "INSERT INTO test \"error\", returned " << nb << std::endl; - abort(); // unexpected success : abort the example program + return EXIT_FAILURE; // unexpected success : exit the example program // Commit transaction transaction.commit(); @@ -271,7 +271,7 @@ int main (void) catch (std::exception& e) { std::cout << "SQLite exception: " << e.what() << std::endl; - abort(); // unexpected error : abort the example program + return EXIT_FAILURE; // unexpected error : exit the example program } remove("transaction.db3"); @@ -309,7 +309,7 @@ int main (void) else { std::cout << "file " << filename_logo_png << " not found !\n"; - abort(); // unexpected error : abort the example program + return EXIT_FAILURE; // unexpected error : exit the example program } fp = fopen("out.png", "wb"); @@ -327,24 +327,24 @@ int main (void) size = colBlob.getBytes (); std::cout << "row (" << query.getColumn(0) << ", size=" << size << ")\n"; size_t sizew = fwrite(blob, 1, size, fp); - assert(sizew == size); + SQLITE_CPP_ASSERT(sizew == size); fclose (fp); } } else { std::cout << "file out.png not created !\n"; - abort(); // unexpected error : abort the example program + return EXIT_FAILURE; // unexpected error : exit the example program } } catch (std::exception& e) { std::cout << "SQLite exception: " << e.what() << std::endl; - abort(); // unexpected error : abort the example program + return EXIT_FAILURE; // unexpected error : exit the example program } remove("out.png"); std::cout << "everything ok, quitting\n"; - return 0; + return EXIT_SUCCESS; }