From 569a3206f61c2d08e1c4984cb483c043275544eb Mon Sep 17 00:00:00 2001 From: Markus Date: Sat, 31 Aug 2019 20:15:23 +0200 Subject: [PATCH] ersetzte code mit isNumber Function --- parameterManager.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/parameterManager.cpp b/parameterManager.cpp index 99d5c8d..760ee6d 100644 --- a/parameterManager.cpp +++ b/parameterManager.cpp @@ -174,7 +174,7 @@ int loadDefaulOptions(Settings &settings) } else if (what == "default-CheckMaxDirs") { settings.default_maxDirs = atoi(data.c_str()); - if(std::to_string(settings.default_maxDirs) != data ) { + if(!isNumber(data) ) { std::cout << " => Error_Defaults: default-CheckMaxDirs: Ungültige Zahl: " << data << std::endl; return 18; } @@ -184,7 +184,7 @@ int loadDefaulOptions(Settings &settings) } else if (what == "default-maxThreads") { settings.maxThreads = static_cast(atoi(data.c_str())); - if(std::to_string(settings.maxThreads) != data ) { + if(isNumber(data) ) { std::cout << " => Error_Defaults: Thread-Max Ungültige Zahl: " << data << std::endl; return 18; } else if (settings.maxThreads > 10) { @@ -322,7 +322,7 @@ int unterOption_default(Settings *settings, int argc, char ** argv) if(!optarg) break; settings->startEpisode = atoi(optarg); - if (std::to_string(settings->startEpisode) != optarg) { + if (!isNumber(optarg)) { std::cout << " => Error: -e [Folge]: '" << optarg << "' ist keine Zahl." << std::endl; return 11; } else if (settings->startEpisode <= 0) { @@ -336,7 +336,7 @@ int unterOption_default(Settings *settings, int argc, char ** argv) if(!optarg) break; settings->stopEpisode = atoi(optarg); - if (std::to_string(settings->stopEpisode) != optarg) { + if (!isNumber(optarg)) { std::cout << " => Error: -E [Folge]: '" << optarg << "' ist keine Zahl." << std::endl; return 14; } else if (settings->debugMode) @@ -346,7 +346,7 @@ int unterOption_default(Settings *settings, int argc, char ** argv) if(!optarg) break; settings->startSeason = atoi(optarg); - if (std::to_string(settings->startSeason) != optarg) { + if (!isNumber(optarg)) { std::cout << " => Error: -s [Staffel]: '" << optarg << "' ist keine Zahl." << std::endl; return 15; } else if (settings->startSeason < 0) { @@ -359,7 +359,7 @@ int unterOption_default(Settings *settings, int argc, char ** argv) if(!optarg) break; settings->stopSeason = atoi(optarg); - if (std::to_string(settings->stopSeason) != optarg) { + if (!isNumber(optarg)) { std::cout << " => Error: -S [Staffel]: '" << optarg << "' ist keine Zahl." << std::endl; return 18; } else if(settings->debugMode) @@ -375,8 +375,8 @@ int unterOption_default(Settings *settings, int argc, char ** argv) if(!optarg) break; settings->default_maxDirs = atoi(optarg); - if(std::to_string(settings->default_maxDirs) != std::string(optarg) ) { - std::cout << " => Error: [-D]: Invalid Count: " << optarg << std::endl; + if(!isNumber(optarg)) { + std::cout << " => Error: [-D]: Ungültige Zahl: " << optarg << std::endl; return 18; } if(settings->debugMode) @@ -387,7 +387,7 @@ int unterOption_default(Settings *settings, int argc, char ** argv) if(!optarg) break; settings->maxThreads = static_cast(atoi(optarg)); - if(std::to_string(settings->maxThreads) != std::string(optarg) ) { + if(!isNumber(optarg)) { std::cout << " => Error: [-t]: Thread-Max: Ungültige Zahl: " << optarg << std::endl; return 18; } else if (settings->maxThreads > 10 && !settings->debugMode) {