solv_free(data->attrdata);
solv_free(data->attriddata);
+ solv_free(data->attrnum64data);
solv_free(data->dircache);
}
di_entersub,
di_leavesub,
- di_nextsolvableattr,
di_nextsolvablekey,
- di_entersolvablekey
+ di_entersolvablekey,
+ di_nextsolvableattr
};
/* see dataiterator.h for documentation */
/* special solvable attr handling follows */
- case di_nextsolvableattr:
- di->kv.id = *di->idp++;
- di->kv.entry++;
- if (!*di->idp)
- {
- di->kv.eof = 1;
- di->state = di_nextsolvablekey;
- }
- break;
-
case di_nextsolvablekey: di_nextsolvablekey:
if (di->keyname || di->key->name == RPM_RPMDBID)
goto di_enterrepodata;
case di_entersolvablekey: di_entersolvablekey:
di->idp = solvabledata_fetch(di->pool->solvables + di->solvid, &di->kv, di->key->name);
- if (!di->idp || !di->idp[0])
+ if (!di->idp || !*di->idp)
goto di_nextsolvablekey;
- di->kv.id = di->idp[0];
- di->kv.num = di->idp[0];
- di->idp++;
- if (!di->kv.eof && !di->idp[0])
- di->kv.eof = 1;
- di->kv.entry = 0;
if (di->kv.eof)
- di->state = di_nextsolvablekey;
- else
- di->state = di_nextsolvableattr;
+ {
+ /* not an array */
+ di->kv.id = *di->idp;
+ di->kv.num = *di->idp; /* for rpmdbid */
+ di->kv.entry = 0;
+ di->state = di_nextsolvablekey;
+ break;
+ }
+ di->kv.entry = -1;
+ /* FALLTHROUGH */
+
+ case di_nextsolvableattr:
+ di->state = di_nextsolvableattr;
+ di->kv.id = *di->idp++;
+ di->kv.entry++;
+ if (!*di->idp)
+ {
+ di->kv.eof = 1;
+ di->state = di_nextsolvablekey;
+ }
break;
+
}
if (di->matcher.match)
#define REPODATA_ATTRS_BLOCK 31
#define REPODATA_ATTRDATA_BLOCK 1023
#define REPODATA_ATTRIDDATA_BLOCK 63
+#define REPODATA_ATTRNUM64DATA_BLOCK 15
Id
key.type = REPOKEY_TYPE_NUM;
key.size = 0;
key.storage = KEY_STORAGE_INCORE;
+ if (num >= 0x80000000)
+ {
+ data->attrnum64data = solv_extend(data->attrnum64data, data->attrnum64datalen, 1, sizeof(unsigned long long), REPODATA_ATTRNUM64DATA_BLOCK);
+ data->attrnum64data[data->attrnum64datalen] = num;
+ num = 0x80000000 | data->attrnum64datalen++;
+ }
repodata_set(data, solvid, &key, (Id)num);
}
Repokey key;
unsigned char *dp;
+ if (len < 0)
+ return;
key.name = keyname;
key.type = REPOKEY_TYPE_BINARY;
key.size = 0;
};
static void
-data_addid(struct extdata *xd, Id x)
+data_addid(struct extdata *xd, Id sx)
{
unsigned char *dp;
+ unsigned int x = (unsigned int)sx;
xd->buf = solv_extend(xd->buf, xd->len, 5, 1, EXTDATA_BLOCK);
dp = xd->buf + xd->len;
xd->len = dp - xd->buf;
}
+static void
+data_addid64(struct extdata *xd, unsigned long long x)
+{
+ if (x >= 0x100000000)
+ {
+ if ((x >> 35) != 0)
+ {
+ data_addid(xd, (Id)(x >> 35));
+ xd->buf[xd->len - 1] |= 128;
+ }
+ data_addid(xd, (Id)((unsigned int)x | 0x80000000));
+ xd->buf[xd->len - 5] = (x >> 28) | 128;
+ }
+ else
+ data_addid(xd, (Id)x);
+}
+
static void
data_addideof(struct extdata *xd, Id x, int eof)
{
+ if (x < 0)
+ abort(); /* XXX: not yet */
if (x >= 64)
x = (x & 63) | ((x & ~63) << 1);
data_addid(xd, (eof ? x : x | 64));
case REPOKEY_TYPE_SHA256:
data_addblob(xd, data->attrdata + val, SIZEOF_SHA256);
break;
- case REPOKEY_TYPE_ID:
case REPOKEY_TYPE_NUM:
+ if (val & 0x80000000)
+ {
+ data_addid64(xd, data->attrnum64data[val ^ 0x80000000]);
+ break;
+ }
+ /* FALLTHROUGH */
+ case REPOKEY_TYPE_ID:
case REPOKEY_TYPE_DIR:
data_addid(xd, val);
break;
data->attrs = solv_free(data->attrs);
data->attrdata = solv_free(data->attrdata);
data->attriddata = solv_free(data->attriddata);
+ data->attrnum64data = solv_free(data->attrnum64data);
data->attrdatalen = 0;
data->attriddatalen = 0;
+ data->attrnum64datalen = 0;
}
void