Skip to content

Commit c161ff1

Browse files
author
Requiem
committed
fix: logical bug in VM::CLOCK
1 parent 8959c7d commit c161ff1

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/vmaware.hpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11211,22 +11211,28 @@ struct VM {
1121111211
if (util::get_manufacturer_model(&manufacturer, &model)) {
1121211212
auto ci_contains = [](const char* hay, const char* needle) noexcept -> bool {
1121311213
if (!hay || !needle || !*hay || !*needle) return false;
11214-
const unsigned char* h = reinterpret_cast<const unsigned char*>(hay);
11215-
const unsigned char* n = reinterpret_cast<const unsigned char*>(needle);
11216-
const size_t nlen = strlen(reinterpret_cast<const char*>(n));
11214+
11215+
const unsigned char* h =
11216+
reinterpret_cast<const unsigned char*>(hay);
11217+
const unsigned char* n =
11218+
reinterpret_cast<const unsigned char*>(needle);
11219+
11220+
const size_t nlen = strlen(needle);
11221+
1121711222
for (; *h; ++h) {
1121811223
size_t i = 0;
1121911224
for (;; ++i) {
1122011225
unsigned char hc = h[i];
1122111226
unsigned char nc = n[i];
11222-
if (!nc) return false; // matched whole needle
11223-
if (!hc) break; // hay ended
11224-
// ascii lowercase
11227+
11228+
if (!nc) return true;
11229+
if (!hc) break;
11230+
1122511231
if (hc >= 'A' && hc <= 'Z') hc += 32;
1122611232
if (nc >= 'A' && nc <= 'Z') nc += 32;
11233+
1122711234
if (hc != nc) break;
1122811235
}
11229-
if (i == nlen) return false;
1123011236
}
1123111237
return false;
1123211238
};

0 commit comments

Comments
 (0)