diff options
| author | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-08-26 13:49:27 +0200 |
|---|---|---|
| committer | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-08-26 13:49:27 +0200 |
| commit | 118f441f80fa10a2ed552c9a68951d80868809a5 (patch) | |
| tree | 5e684ab70e99ef9192c0f793061ac62f157e43a6 /src/Daemon/RPM.cpp | |
| parent | 2fc1df53ee7f47ef90366ebfdbb998f4c7bddd5f (diff) | |
| parent | 7bf3bf2eb83ce317283ccf8ab3e7a784238a8aeb (diff) | |
| download | abrt-118f441f80fa10a2ed552c9a68951d80868809a5.tar.gz abrt-118f441f80fa10a2ed552c9a68951d80868809a5.tar.xz abrt-118f441f80fa10a2ed552c9a68951d80868809a5.zip | |
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'src/Daemon/RPM.cpp')
| -rw-r--r-- | src/Daemon/RPM.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/Daemon/RPM.cpp b/src/Daemon/RPM.cpp index 6659457..d2451ad 100644 --- a/src/Daemon/RPM.cpp +++ b/src/Daemon/RPM.cpp @@ -39,9 +39,9 @@ bool CRPM::CheckFingerprint(const std::string& pPackage) bool ret = false; rpmts ts = rpmtsCreate(); rpmdbMatchIterator iter = rpmtsInitIterator(ts, RPMTAG_NAME, pPackage.c_str(), 0); - Header header; + Header header = rpmdbNextIterator(iter); - if ((header = rpmdbNextIterator(iter)) != NULL) + if (header != NULL) { rpmTag rpmTags[] = { RPMTAG_DSAHEADER, RPMTAG_RSAHEADER, RPMTAG_SHA1HEADER }; int ii; @@ -80,13 +80,13 @@ bool CRPM::CheckFingerprint(const std::string& pPackage) return ret; } -bool CRPM::CheckHash(const std::string& pPackage, const std::string& pPath) +bool CheckHash(const std::string& pPackage, const std::string& pPath) { bool ret = false; rpmts ts = rpmtsCreate(); rpmdbMatchIterator iter = rpmtsInitIterator(ts, RPMTAG_NAME, pPackage.c_str(), 0); - Header header; - if ((header = rpmdbNextIterator(iter)) != NULL) + Header header = rpmdbNextIterator(iter); + if (header != NULL) { rpmfi fi = rpmfiNew(ts, header, RPMTAG_BASENAMES, RPMFI_NOHEADER); pgpHashAlgo hashAlgo; @@ -114,13 +114,13 @@ bool CRPM::CheckHash(const std::string& pPackage, const std::string& pPath) return ret; } -std::string CRPM::GetDescription(const std::string& pPackage) +std::string GetDescription(const std::string& pPackage) { std::string pDescription = ""; rpmts ts = rpmtsCreate(); rpmdbMatchIterator iter = rpmtsInitIterator(ts, RPMTAG_NAME, pPackage.c_str(), 0); - Header header; - if ((header = rpmdbNextIterator(iter)) != NULL) + Header header = rpmdbNextIterator(iter); + if (header != NULL) { rpmtd td = rpmtdNew(); headerGet(header, RPMTAG_SUMMARY, td, HEADERGET_DEFAULT); @@ -129,19 +129,19 @@ std::string CRPM::GetDescription(const std::string& pPackage) const char* description = rpmtdGetString(td); pDescription = summary + std::string("\n\n") + description; rpmtdFree(td); - } rpmdbFreeIterator(iter); rpmtsFree(ts); return pDescription; } -std::string CRPM::GetComponent(const std::string& pFileName) + +std::string GetComponent(const std::string& pFileName) { std::string ret = ""; rpmts ts = rpmtsCreate(); rpmdbMatchIterator iter = rpmtsInitIterator(ts, RPMTAG_BASENAMES, pFileName.c_str(), 0); - Header header; - if ((header = rpmdbNextIterator(iter)) != NULL) + Header header = rpmdbNextIterator(iter); + if (header != NULL) { rpmtd td = rpmtdNew(); headerGet(header,RPMTAG_SOURCERPM, td, HEADERGET_DEFAULT); @@ -149,7 +149,7 @@ std::string CRPM::GetComponent(const std::string& pFileName) if (srpm != NULL) { std::string srcrpm(srpm); - ret = srcrpm.erase(srcrpm.rfind('-',srcrpm.rfind('-')-1)); + ret = srcrpm.erase(srcrpm.rfind('-', srcrpm.rfind('-')-1)); } rpmtdFree(td); } @@ -158,13 +158,14 @@ std::string CRPM::GetComponent(const std::string& pFileName) rpmtsFree(ts); return ret; } -std::string CRPM::GetPackage(const std::string& pFileName) + +std::string GetPackage(const std::string& pFileName) { std::string ret = ""; rpmts ts = rpmtsCreate(); rpmdbMatchIterator iter = rpmtsInitIterator(ts, RPMTAG_BASENAMES, pFileName.c_str(), 0); - Header header; - if ((header = rpmdbNextIterator(iter)) != NULL) + Header header = rpmdbNextIterator(iter); + if (header != NULL) { char* nerv = headerGetNEVR(header, NULL); if (nerv != NULL) |
