diff options
author | Michael Schroeder <mls@suse.de> | 2009-09-22 18:49:30 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2009-09-22 18:49:30 +0200 |
commit | 2809498f0ceebc98709443afcbfdd799d5bb35b1 (patch) | |
tree | 40455aefe0d90f640456fed149545a9099e349e9 /src/repodata.c | |
parent | a415136ab9806fd4bb83743ba974c6288b3a1a1a (diff) | |
download | libsolv-2809498f0ceebc98709443afcbfdd799d5bb35b1.tar.gz libsolv-2809498f0ceebc98709443afcbfdd799d5bb35b1.tar.bz2 libsolv-2809498f0ceebc98709443afcbfdd799d5bb35b1.zip |
- get missing translations from other solvables
- fix solvable_lookup_str_poollang bug
- add support for REPOKEY_TYPE_BINARY
- do not add provides when extending susetags solvables
- fix susetags language handling in demo application
Diffstat (limited to 'src/repodata.c')
-rw-r--r-- | src/repodata.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/src/repodata.c b/src/repodata.c index 1b657f7..e0072e6 100644 --- a/src/repodata.c +++ b/src/repodata.c @@ -1940,6 +1940,35 @@ repodata_set_str(Repodata *data, Id solvid, Id keyname, const char *str) data->attrdatalen += l; } +void +repodata_set_binary(Repodata *data, Id solvid, Id keyname, void *buf, int len) +{ + Repokey key; + unsigned char *dp; + + key.name = keyname; + key.type = REPOKEY_TYPE_BINARY; + key.size = 0; + key.storage = KEY_STORAGE_INCORE; + data->attrdata = sat_extend(data->attrdata, data->attrdatalen, len + 5, 1, REPODATA_ATTRDATA_BLOCK); + dp = data->attrdata + data->attrdatalen; + if (len >= (1 << 14)) + { + if (len >= (1 << 28)) + *dp++ = (len >> 28) | 128; + if (len >= (1 << 21)) + *dp++ = (len >> 21) | 128; + *dp++ = (len >> 14) | 128; + } + if (len >= (1 << 7)) + *dp++ = (len >> 7) | 128; + *dp++ = len & 127; + if (len) + memcpy(dp, buf, len); + repodata_set(data, solvid, &key, data->attrdatalen); + data->attrdatalen = dp + len - data->attrdata; +} + /* add an array element consisting of entrysize Ids to the repodata. modifies attriddata * so that the caller can append the new element there */ static void @@ -2260,7 +2289,7 @@ repodata_merge_some_attrs(Repodata *data, Id dest, Id src, Map *keyidmap, int ov /**********************************************************************/ -/* TODO: unify with repo_write! */ +/* TODO: unify with repo_write and repo_solv! */ #define EXTDATA_BLOCK 1023 @@ -2273,6 +2302,7 @@ static void data_addid(struct extdata *xd, Id x) { unsigned char *dp; + xd->buf = sat_extend(xd->buf, xd->len, 5, 1, EXTDATA_BLOCK); dp = xd->buf + xd->len; @@ -2295,7 +2325,7 @@ data_addideof(struct extdata *xd, Id x, int eof) { if (x >= 64) x = (x & 63) | ((x & ~63) << 1); - data_addid(xd, (eof ? x: x | 64)); + data_addid(xd, (eof ? x : x | 64)); } static void @@ -2350,6 +2380,14 @@ repodata_serialize_key(Repodata *data, struct extdata *newincore, case REPOKEY_TYPE_DIR: data_addid(xd, val); break; + case REPOKEY_TYPE_BINARY: + { + Id len; + unsigned char *dp = data_read_id(data->attrdata + val, &len); + dp += len; + data_addblob(xd, data->attrdata + val, dp - (data->attrdata + val)); + } + break; case REPOKEY_TYPE_IDARRAY: for (ida = data->attriddata + val; *ida; ida++) data_addideof(xd, ida[0], ida[1] ? 0 : 1); |