mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-17 09:35:46 +01:00
fix: no boolean incrementation
This commit is contained in:
@@ -14,7 +14,7 @@ int conf_procbuf(char const* restrict buf, size_t buflen, struct conf_entry cons
|
|||||||
ERR_INVALID_TYPE = 3,
|
ERR_INVALID_TYPE = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool isval = 0; // whether we're reading the value at the moment (used as index)
|
unsigned idx = 0; // index to the data below
|
||||||
char const* dat[2] = {0}; // stores key-value data
|
char const* dat[2] = {0}; // stores key-value data
|
||||||
unsigned len[2] = {0}; // stores the length of the data
|
unsigned len[2] = {0}; // stores the length of the data
|
||||||
for (size_t i = 0; i < buflen; i++) {
|
for (size_t i = 0; i < buflen; i++) {
|
||||||
@@ -31,14 +31,14 @@ int conf_procbuf(char const* restrict buf, size_t buflen, struct conf_entry cons
|
|||||||
if (brk) break;
|
if (brk) break;
|
||||||
|
|
||||||
// everything after `=` is interpreted as a value
|
// everything after `=` is interpreted as a value
|
||||||
if (buf[i] == '=' && !isval) {
|
if (buf[i] == '=' && !idx) {
|
||||||
isval++;
|
idx++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the value pointer to the current buffer char
|
// set the value pointer to the current buffer char
|
||||||
dat[isval] = dat[isval] ? dat[isval] : &buf[i];
|
dat[idx] = dat[idx] ? dat[idx] : &buf[i];
|
||||||
len[isval]++;
|
len[idx]++;
|
||||||
}
|
}
|
||||||
if (!(dat[0] && dat[1])) return ERR_ABSENT;
|
if (!(dat[0] && dat[1])) return ERR_ABSENT;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user