summaryrefslogtreecommitdiff
path: root/ftparchive
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-11-11 14:09:41 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2024-11-20 15:04:28 +0100
commit709adda89a575e6c542310e6632c090632bb9732 (patch)
treecd53499ae57556e016f3d87dc3e596ec69919fd9 /ftparchive
parentb888c66c7244de9b20d174555ffdc22829d6c222 (diff)
ftparchive: cachedb: Remove 600-byte key limit
Instead of snprintf() into a fixed-size buffer, construct an std::string using assign() and append(). A previous version used strprintf() which would have been hilariously inefficient. LP: #2087848
Diffstat (limited to 'ftparchive')
-rw-r--r--ftparchive/cachedb.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/ftparchive/cachedb.h b/ftparchive/cachedb.h
index 98817b9ec..0002c6059 100644
--- a/ftparchive/cachedb.h
+++ b/ftparchive/cachedb.h
@@ -34,7 +34,7 @@ class CacheDB
// Database state/access
DBT Key;
DBT Data;
- char TmpKey[600];
+ std::string TmpKey;
DB *Dbp;
bool DBLoaded;
bool ReadOnly;
@@ -45,8 +45,9 @@ class CacheDB
{
memset(&Key,0,sizeof(Key));
memset(&Data,0,sizeof(Data));
- Key.data = TmpKey;
- Key.size = snprintf(TmpKey,sizeof(TmpKey),"%s:%s",FileName.c_str(), Type);
+ TmpKey.assign(FileName).append(":").append(Type);
+ Key.data = TmpKey.data();
+ Key.size = TmpKey.size();
}
void InitQueryStats() {