1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/** \ingroup rpmdb
* \file rpmdb/hdrNVR.c
*/
#include "system.h"
#include "lib/rpmlib.h"
#include "debug.h"
int headerNVR(Header h, const char **np, const char **vp, const char **rp)
{
int type;
int count;
/*@-boundswrite@*/
if (np) {
if (!(headerGetEntry(h, RPMTAG_NAME, &type, (void **) np, &count)
&& type == RPM_STRING_TYPE && count == 1))
*np = NULL;
}
if (vp) {
if (!(headerGetEntry(h, RPMTAG_VERSION, &type, (void **) vp, &count)
&& type == RPM_STRING_TYPE && count == 1))
*vp = NULL;
}
if (rp) {
if (!(headerGetEntry(h, RPMTAG_RELEASE, &type, (void **) rp, &count)
&& type == RPM_STRING_TYPE && count == 1))
*rp = NULL;
}
/*@=boundswrite@*/
return 0;
}
int headerNEVRA(Header h, const char **np,
/*@unused@*/ const char **ep, const char **vp, const char **rp,
const char **ap)
{
int type;
int count;
/*@-boundswrite@*/
if (np) {
if (!(headerGetEntry(h, RPMTAG_NAME, &type, (void **) np, &count)
&& type == RPM_STRING_TYPE && count == 1))
*np = NULL;
}
if (vp) {
if (!(headerGetEntry(h, RPMTAG_VERSION, &type, (void **) vp, &count)
&& type == RPM_STRING_TYPE && count == 1))
*vp = NULL;
}
if (rp) {
if (!(headerGetEntry(h, RPMTAG_RELEASE, &type, (void **) rp, &count)
&& type == RPM_STRING_TYPE && count == 1))
*rp = NULL;
}
if (ap) {
if (!(headerGetEntry(h, RPMTAG_ARCH, &type, (void **) ap, &count)
&& type == RPM_STRING_TYPE && count == 1))
*ap = NULL;
}
/*@=boundswrite@*/
return 0;
}
|