libsolv/0002-Add-repodata_lookup_dirstrarray_uninternalized-metho.patch
2016-03-08 13:12:00 +01:00

80 lines
2.5 KiB
Diff

From f362259ac2f92c6c1914974032f2f7c436ac00d4 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Fri, 26 Feb 2016 11:45:09 +0100
Subject: [PATCH 1/9] Add repodata_lookup_dirstrarray_uninternalized method
Needed for next commit.
---
src/libsolv.ver | 1 +
src/repodata.c | 25 +++++++++++++++++++++++++
src/repodata.h | 3 +++
3 files changed, 29 insertions(+)
diff --git a/src/libsolv.ver b/src/libsolv.ver
index 6508288..cc79704 100644
--- a/src/libsolv.ver
+++ b/src/libsolv.ver
@@ -201,6 +201,7 @@ SOLV_1.0 {
repodata_key2id;
repodata_localize_id;
repodata_lookup_bin_checksum;
+ repodata_lookup_bin_checksum_uninternalized;
repodata_lookup_binary;
repodata_lookup_dirstrarray_uninternalized;
repodata_lookup_id;
diff --git a/src/repodata.c b/src/repodata.c
index ad3e71a..b611afc 100644
--- a/src/repodata.c
+++ b/src/repodata.c
@@ -881,6 +881,31 @@ repodata_lookup_dirstrarray_uninternalized(Repodata *data, Id solvid, Id keyname
return 0;
}
+const unsigned char *
+repodata_lookup_bin_checksum_uninternalized(Repodata *data, Id solvid, Id keyname, Id *typep)
+{
+ Id *ap;
+ if (!data->attrs)
+ return 0;
+ ap = data->attrs[solvid - data->start];
+ if (!ap)
+ return 0;
+ for (; *ap; ap += 2)
+ {
+ if (data->keys[*ap].name != keyname)
+ continue;
+ switch (data->keys[*ap].type)
+ {
+ case_CHKSUM_TYPES:
+ *typep = data->keys[*ap].type;
+ return (const unsigned char *)data->attrdata + ap[1];
+ default:
+ break;
+ }
+ }
+ return 0;
+}
+
/************************************************************************
* data search
*/
diff --git a/src/repodata.h b/src/repodata.h
index c18c688..d72c60f 100644
--- a/src/repodata.h
+++ b/src/repodata.h
@@ -300,8 +300,11 @@ const char *repodata_chk2str(Repodata *data, Id type, const unsigned char *buf);
void repodata_set_location(Repodata *data, Id solvid, int medianr, const char *dir, const char *file);
void repodata_set_deltalocation(Repodata *data, Id handle, int medianr, const char *dir, const char *file);
void repodata_set_sourcepkg(Repodata *data, Id solvid, const char *sourcepkg);
+
+/* uninternalized data lookup */
Id repodata_lookup_id_uninternalized(Repodata *data, Id solvid, Id keyname, Id voidid);
const char *repodata_lookup_dirstrarray_uninternalized(Repodata *data, Id solvid, Id keyname, Id *didp, Id *iterp);
+const unsigned char *repodata_lookup_bin_checksum_uninternalized(Repodata *data, Id solvid, Id keyname, Id *typep);
/* stats */
unsigned int repodata_memused(Repodata *data);
--
2.5.0