mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Use 32-bit offsets in the string pool search tree to reduce its size
This commit is contained in:
@@ -35,7 +35,7 @@ int swizzlecmp(const char *a, const char *b) {
|
||||
}
|
||||
|
||||
long long addpool(struct memfile *poolfile, struct memfile *treefile, const char *s, char type) {
|
||||
long long *sp = &treefile->tree;
|
||||
unsigned long *sp = &treefile->tree;
|
||||
size_t depth = 0;
|
||||
|
||||
// In typical data, traversal depth generally stays under 2.5x
|
||||
@@ -95,6 +95,16 @@ long long addpool(struct memfile *poolfile, struct memfile *treefile, const char
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (off >= LONG_MAX || treefile->off >= LONG_MAX) {
|
||||
// Tree or pool is bigger than 2GB
|
||||
static bool warned = false;
|
||||
if (!warned) {
|
||||
fprintf(stderr, "Warning: string pool is very large.\n");
|
||||
warned = true;
|
||||
}
|
||||
return off;
|
||||
}
|
||||
|
||||
struct stringpool tsp;
|
||||
tsp.left = 0;
|
||||
tsp.right = 0;
|
||||
|
||||
Reference in New Issue
Block a user