Skip to content

Commit

Permalink
Add Volume constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
shermp committed Jul 12, 2023
1 parent 2b3e8a9 commit 89305e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/ndb/NDBMetadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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 ||
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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());
Expand Down
1 change: 1 addition & 0 deletions src/ndb/NDBMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<void(Volume /*const&*/ *v)> f);
int (*Volume__isValid)(Volume* _this);
QVariantMap (*Content__getDbValues)(Content* content);
Expand Down

0 comments on commit 89305e3

Please sign in to comment.