From 969eeb4b52bc5551c461f5dca42246a0661559cf Mon Sep 17 00:00:00 2001 From: get <45425365+Minty-Meeo@users.noreply.github.com> Date: Wed, 14 Jun 2023 23:27:14 -0500 Subject: DolphinTool: Use EXIT_SUCCESS and EXIT_FAILURE --- Source/Core/DolphinTool/ConvertCommand.cpp | 31 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'Source/Core/DolphinTool/ConvertCommand.cpp') diff --git a/Source/Core/DolphinTool/ConvertCommand.cpp b/Source/Core/DolphinTool/ConvertCommand.cpp index 386ae2bc8c..d96e571d28 100644 --- a/Source/Core/DolphinTool/ConvertCommand.cpp +++ b/Source/Core/DolphinTool/ConvertCommand.cpp @@ -3,6 +3,7 @@ #include "DolphinTool/ConvertCommand.h" +#include #include #include #include @@ -123,7 +124,7 @@ int ConvertCommand(const std::vector& args) if (input_file_path.empty()) { std::cerr << "Error: No input set" << std::endl; - return 1; + return EXIT_FAILURE; } // --output @@ -131,7 +132,7 @@ int ConvertCommand(const std::vector& args) if (output_file_path.empty()) { std::cerr << "Error: No output set" << std::endl; - return 1; + return EXIT_FAILURE; } // --format @@ -140,7 +141,7 @@ int ConvertCommand(const std::vector& args) if (!format_o.has_value()) { std::cerr << "Error: No output format set" << std::endl; - return 1; + return EXIT_FAILURE; } const DiscIO::BlobType format = format_o.value(); @@ -149,7 +150,7 @@ int ConvertCommand(const std::vector& args) if (!blob_reader) { std::cerr << "Error: The input file could not be opened." << std::endl; - return 1; + return EXIT_FAILURE; } // --scrub @@ -162,7 +163,7 @@ int ConvertCommand(const std::vector& args) if (scrub) { std::cerr << "Error: Scrubbing is only supported for GC/Wii disc images." << std::endl; - return 1; + return EXIT_FAILURE; } std::cerr << "Warning: The input file is not a GC/Wii disc image. Continuing anyway." @@ -174,7 +175,7 @@ int ConvertCommand(const std::vector& args) if (volume->IsDatelDisc()) { std::cerr << "Error: Scrubbing a Datel disc is not supported." << std::endl; - return 1; + return EXIT_FAILURE; } blob_reader = DiscIO::ScrubbedBlob::Create(input_file_path); @@ -182,7 +183,7 @@ int ConvertCommand(const std::vector& args) if (!blob_reader) { std::cerr << "Error: Unable to process disc image. Try again without --scrub." << std::endl; - return 1; + return EXIT_FAILURE; } } @@ -225,13 +226,13 @@ int ConvertCommand(const std::vector& args) if (!block_size_o.has_value()) { std::cerr << "Error: Block size must be set for GCZ/RVZ/WIA" << std::endl; - return 1; + return EXIT_FAILURE; } if (!DiscIO::IsDiscImageBlockSizeValid(block_size_o.value(), format)) { std::cerr << "Error: Block size is not valid for this format" << std::endl; - return 1; + return EXIT_FAILURE; } if (block_size_o.value() < DiscIO::PREFERRED_MIN_BLOCK_SIZE || @@ -265,7 +266,7 @@ int ConvertCommand(const std::vector& args) if (!compression_o.has_value()) { std::cerr << "Error: Compression format must be set for WIA or RVZ" << std::endl; - return 1; + return EXIT_FAILURE; } if ((format == DiscIO::BlobType::WIA && @@ -274,7 +275,7 @@ int ConvertCommand(const std::vector& args) compression_o.value() == DiscIO::WIARVZCompressionType::Purge)) { std::cerr << "Error: Compression type is not supported for the container format" << std::endl; - return 1; + return EXIT_FAILURE; } if (compression_o.value() == DiscIO::WIARVZCompressionType::None) @@ -287,7 +288,7 @@ int ConvertCommand(const std::vector& args) { std::cerr << "Error: Compression level must be set when compression type is not 'none'" << std::endl; - return 1; + return EXIT_FAILURE; } const std::pair range = @@ -295,7 +296,7 @@ int ConvertCommand(const std::vector& args) if (compression_level_o.value() < range.first || compression_level_o.value() > range.second) { std::cerr << "Error: Compression level not in acceptable range" << std::endl; - return 1; + return EXIT_FAILURE; } } } @@ -349,9 +350,9 @@ int ConvertCommand(const std::vector& args) if (!success) { std::cerr << "Error: Conversion failed" << std::endl; - return 1; + return EXIT_FAILURE; } - return 0; + return EXIT_SUCCESS; } } // namespace DolphinTool -- cgit v1.2.3