*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* Stores the result in *val and returns the number of input bytes read (or 0
* if the input is invalid, in which case *val is undefined).
*/
* Stores the result in *val and returns the number of input bytes read (or 0
* if the input is invalid, in which case *val is undefined).
*/
rc = upkg_decode_index(&tmp, buf+len, nbuf-len);
if (rc == 0 || tmp < 0 || tmp >= pkg->pub.name_count) goto err;
export->pub.name = pkg->names[tmp].name;
rc = upkg_decode_index(&tmp, buf+len, nbuf-len);
if (rc == 0 || tmp < 0 || tmp >= pkg->pub.name_count) goto err;
export->pub.name = pkg->names[tmp].name;
- /* This only makes sense if the assertion below is not violated. */
- long package = parent < 0 ? 0 : parent + 1;
+ if (parent_index >= 0) {
+ if (parent_index >= pkg->pub.export_count)
+ return -1;
+ parent = &pkg->exports[parent_index].pub;
+ }
for (unsigned long i = 0; i < pkg->pub.export_count; i++) {
struct upkg_export_priv *e = &pkg->exports[i];
for (unsigned long i = 0; i < pkg->pub.export_count; i++) {
struct upkg_export_priv *e = &pkg->exports[i];
- /* Assertion: an object's package is an export. */
- format_assert(e->package >= 0, continue);
- if (e->package == package && strcmp(e->pub.name, name) == 0) {
+ if (e->pub.parent == parent && !strcmp(e->pub.name, name))
.base = pkg->exports[idx].offset,
.len = pkg->exports[idx].size,
.name = pkg->exports[idx].pub.name,
.base = pkg->exports[idx].offset,
.len = pkg->exports[idx].size,
.name = pkg->exports[idx].pub.name,
- if (f != f->pkg->last_file) {
- if (fops->seek(f->pkg->f, f->base + f->offset, SEEK_SET))
+ if (f != pkg->last_file) {
+ if (fops->seek(pkg->f, f->base + f->offset, SEEK_SET))