forked from markus/S_New4
ersetzte code mit isNumber Function
This commit is contained in:
parent
c7bb9702db
commit
569a3206f6
@ -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<unsigned>(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<unsigned>(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) {
|
||||
|
Loading…
Reference in New Issue
Block a user