From 89305e3c8584b4ef7408fb0a197792e031efd948 Mon Sep 17 00:00:00 2001 From: shermp <14854761+shermp@users.noreply.github.com> Date: Sat, 24 Jun 2023 09:44:21 +1200 Subject: [PATCH] Add Volume constructor --- src/ndb/NDBMetadata.cc | 8 ++++++-- src/ndb/NDBMetadata.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ndb/NDBMetadata.cc b/src/ndb/NDBMetadata.cc index 8adb405..36d568d 100644 --- a/src/ndb/NDBMetadata.cc +++ b/src/ndb/NDBMetadata.cc @@ -52,6 +52,7 @@ NDBMetadata::NDBMetadata(QObject* parent) : QObject(parent) { nh_log("DB name is %s", dbName->toUtf8().constData()); resolveSymbolRTLD("_ZN13VolumeManager7getByIdERK7QStringS2_", nh_symoutptr(symbols.VolumeManager__getById)); + resolveSymbolRTLD("_ZN6VolumeC1Ev", nh_symoutptr(symbols.Volume__Volume)); resolveSymbolRTLD("_ZNK6Volume7isValidEv", nh_symoutptr(symbols.Volume__isValid)); resolveSymbolRTLD("_ZNK7Content11getDbValuesEv", nh_symoutptr(symbols.Content__getDbValues)); resolveSymbolRTLD("_ZNK6Volume11getDbValuesEv", nh_symoutptr(symbols.Volume__getDbValues)); @@ -60,6 +61,7 @@ NDBMetadata::NDBMetadata(QObject* parent) : QObject(parent) { resolveSymbolRTLD("_ZN6Volume4saveERK6Device", nh_symoutptr(symbols.Volume__save)); if (!symbols.VolumeManager__getById || !symbols.Content__getDbValues || + !symbols.Volume__Volume || !symbols.Volume__getDbValues || !symbols.Volume__isValid || !symbols.Volume__forEach || @@ -106,7 +108,8 @@ Volume* NDBMetadata::getByID(Volume* vol, QString const& id) { } QVariantMap NDBMetadata::getMetadata(QString const& cID) { - char va[VOLUME_SIZE]; + uint8_t va[VOLUME_SIZE] = {0}; + symbols.Volume__Volume(va); Volume* v = getByID((Volume*)va, cID); return getMetadata(v); } @@ -161,7 +164,8 @@ QStringList NDBMetadata::getBookListSideloaded() { } Result NDBMetadata::setMetadata(QString const& cID, QVariantMap md) { - char va[VOLUME_SIZE]; + uint8_t va[VOLUME_SIZE] = {0}; + symbols.Volume__Volume(va); Volume* v = getByID((Volume*)va, cID); NDB_ASSERT(NullError, v, "Error getting Volume for %s", cID.toUtf8().constData()); NDB_ASSERT(VolumeError, volIsValid(v), "Volume is not valid for %s", cID.toUtf8().constData()); diff --git a/src/ndb/NDBMetadata.h b/src/ndb/NDBMetadata.h index a1696d1..e4a89f5 100644 --- a/src/ndb/NDBMetadata.h +++ b/src/ndb/NDBMetadata.h @@ -49,6 +49,7 @@ class NDBMetadata : public QObject { // Getting Volume's VolumeManager* (*VolumeManager__sharedInstance)(); Volume* (*VolumeManager__getById)(Volume* vol, QString const& id, QString const& dbName); + void (*Volume__Volume)(Volume* _this); void (*Volume__forEach)(QString const& dbName, std::function f); int (*Volume__isValid)(Volume* _this); QVariantMap (*Content__getDbValues)(Content* content);