Bound region name exports for small destinations
This commit is contained in:
1 parent
df0e7c3f89
commit
f6c00be3e0
5 files changed
+419
-1
No files matched your search
@@ -486,11 +486,12 @@ size_t RegionMap::exportTo(char *dest, size_t max_len) const {
|
||||
}
|
||||
|
||||
int RegionMap::exportNamesTo(char *dest, int max_len, uint8_t mask, bool invert) {
|
||||
if (!dest || max_len <= 0) return 0;
|
||||
char *dp = dest;
|
||||
|
||||
// Check wildcard region
|
||||
bool wildcard_matches = invert ? (wildcard.flags & mask) : !(wildcard.flags & mask);
|
||||
if (wildcard_matches) {
|
||||
if (wildcard_matches && max_len >= 2) {
|
||||
*dp++ = '*';
|
||||
*dp++ = ',';
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ public:
|
||||
int getCount() const { return num_regions; }
|
||||
const RegionEntry* getByIdx(int i) const { return ®ions[i]; }
|
||||
const RegionEntry* getRoot() const { return &wildcard; }
|
||||
// Capacity includes the terminator. Null/nonpositive capacity writes nothing.
|
||||
// Every non-null destination with positive capacity is null-terminated.
|
||||
int exportNamesTo(char *dest, int max_len, uint8_t mask, bool invert = false);
|
||||
int getTransportKeysFor(const RegionEntry& src, TransportKey dest[], int max_num);
|
||||
|
||||
|
||||
Reference in new issue
Block a user