diff options
author | Timo Teräs <timo.teras@iki.fi> | 2022-03-21 09:06:15 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2022-03-21 14:09:06 +0200 |
commit | 950972a56b6c9ba6e33b33e60cab076f5a18daec (patch) | |
tree | 17978d190bca9e0c408b4c7eaec41b570ba4acc5 /src/adb.c | |
parent | 9d6c96324a0f4cbe69ca735ad3bc4f977d3c9677 (diff) | |
download | apk-tools-950972a56b6c9ba6e33b33e60cab076f5a18daec.tar.gz apk-tools-950972a56b6c9ba6e33b33e60cab076f5a18daec.tar.bz2 apk-tools-950972a56b6c9ba6e33b33e60cab076f5a18daec.tar.xz apk-tools-950972a56b6c9ba6e33b33e60cab076f5a18daec.zip |
mkndx: fix index generation for v2 and v3 packages
For v2 packages, the identity was never set.
For v3 packages, the file size was never set.
This fixes both issues.
Diffstat (limited to 'src/adb.c')
-rw-r--r-- | src/adb.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -855,6 +855,20 @@ int adb_wo_fromstring(struct adb_obj *o, apk_blob_t val) return o->schema->fromstring(o, val); } +int adb_wo_copyobj(struct adb_obj *o, struct adb_obj *src) +{ + size_t sz = adb_ro_num(src); + + assert(o->schema->kind == ADB_KIND_OBJECT); + assert(o->schema == src->schema); + + adb_wo_reset(o); + for (unsigned i = ADBI_FIRST; i < sz; i++) + adb_wo_val(o, i, adb_w_copy(o->db, src->db, adb_ro_val(src, i))); + + return 0; +} + adb_val_t adb_wo_val(struct adb_obj *o, unsigned i, adb_val_t v) { if (i >= o->obj[ADBI_NUM_ENTRIES]) return adb_w_error(o->db, E2BIG); |