Update PIDGEN2.cpp

Edited isValidChannelID(), isValidYear() and isValidDay().

isValidChannelID() and isValidYear() now return true, if the values are valid.
isValidDay() has been extended to support day 366 as a valid day.
This commit is contained in:
Lukas 2024-03-07 00:01:43 +01:00 committed by GitHub
parent d378c6499e
commit 4164b936cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -55,7 +55,7 @@ bool PIDGEN2::isValidChannelID(char* channelID) {
}
for (int i = 0; i <= 6; i++) {
if (strcmp(channelID, channelIDBlacklist[i]) != 0) {
if (strcmp(channelID, channelIDBlacklist[i]) == 0) {
return false;
}
}
@ -82,10 +82,10 @@ bool PIDGEN2::isValidOEMID(char* OEMID) {
bool PIDGEN2::isValidYear(char* year) {
for (int i = 0; i <= 7; i++) {
if (year == validYears[i]) {
return false;
return true;
}
}
return true;
return false;
}
bool PIDGEN2::isValidDay(char* day) {
@ -94,7 +94,7 @@ bool PIDGEN2::isValidDay(char* day) {
}
int iDay = std::stoi(day);
if (iDay == 0 || iDay >= 365) {
if (iDay == 0 || iDay > 366) {
return false;
}
return true;
@ -132,4 +132,4 @@ int PIDGEN2::GenerateOEM(char* year, char* day, char* oem, char* &keyout) {
strcpy(keyout, fmt::format("{}{}-OEM-{}-{}", year, day, oem, oem).c_str());
return 0;
}
}