Yet more type-pedantry...
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 14 Dec 2007 10:54:35 +0000 (12:54 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 14 Dec 2007 10:54:35 +0000 (12:54 +0200)
- use rpm_tag_t for signature tag types too
- size_t, not rpm_count_t in signature generation
- add couple of explicit casts to rpmpgp.h to avoid spurious noise from
  inlined functions

lib/signature.c
lib/signature.h
rpmio/rpmpgp.h

index 1da1a78..c465cd8 100644 (file)
@@ -342,7 +342,7 @@ Header rpmFreeSignature(Header sigh)
  * @param passPhrase   private key pass phrase
  * @return             0 on success, 1 on failure
  */
-static int makePGPSignature(const char * file, int32_t * sigTagp,
+static int makePGPSignature(const char * file, rpm_tag_t * sigTagp,
                uint8_t ** pktp, size_t * pktlenp,
                const char * passPhrase)
 {
@@ -473,7 +473,7 @@ static int makePGPSignature(const char * file, int32_t * sigTagp,
  * @param passPhrase   private key pass phrase
  * @return             0 on success, 1 on failure
  */
-static int makeGPGSignature(const char * file, int32_t * sigTagp,
+static int makeGPGSignature(const char * file, rpm_tag_t * sigTagp,
                uint8_t ** pktp, size_t * pktlenp,
                const char * passPhrase)
 {
@@ -608,13 +608,13 @@ static int makeGPGSignature(const char * file, int32_t * sigTagp,
  * @param passPhrase   private key pass phrase
  * @return             0 on success, -1 on failure
  */
-static int makeHDRSignature(Header sigh, const char * file, int32_t sigTag,
+static int makeHDRSignature(Header sigh, const char * file, rpm_tag_t sigTag,
                const char * passPhrase)
 {
     Header h = NULL;
     FD_t fd = NULL;
     uint8_t * pkt;
-    rpm_count_t pktlen;
+    size_t pktlen;
     const char * fn = NULL;
     const char * SHA1 = NULL;
     int ret = -1;      /* assume failure. */
@@ -711,12 +711,12 @@ exit:
     return ret;
 }
 
-int rpmAddSignature(Header sigh, const char * file, int32_t sigTag,
+int rpmAddSignature(Header sigh, const char * file, rpm_tag_t sigTag,
                const char * passPhrase)
 {
     struct stat st;
     uint8_t * pkt;
-    rpm_count_t pktlen;
+    size_t pktlen;
     int ret = -1;      /* assume failure. */
 
     switch (sigTag) {
@@ -764,7 +764,7 @@ int rpmAddSignature(Header sigh, const char * file, int32_t sigTag,
     return ret;
 }
 
-static int checkPassPhrase(const char * passPhrase, const int sigTag)
+static int checkPassPhrase(const char * passPhrase, const rpm_tag_t sigTag)
 {
     int passPhrasePipe[2];
     int pid, status;
@@ -861,7 +861,7 @@ static int checkPassPhrase(const char * passPhrase, const int sigTag)
     return ((!WIFEXITED(status) || WEXITSTATUS(status)) ? 1 : 0);
 }
 
-char * rpmGetPassPhrase(const char * prompt, const int sigTag)
+char * rpmGetPassPhrase(const char * prompt, const rpm_tag_t sigTag)
 {
     char *pass = NULL;
     int aok = 0;
index 213156e..d02580c 100644 (file)
@@ -65,7 +65,7 @@ int rpmWriteSignature(FD_t fd, Header h);
  * @return             0 on success, -1 on failure
  */
 int rpmAddSignature(Header sigh, const char * file,
-                   int32_t sigTag, const char * passPhrase);
+                   rpm_tag_t sigTag, const char * passPhrase);
 
 /******************************************************************/
 
index 30e3b9b..7730b6d 100644 (file)
@@ -999,7 +999,7 @@ size_t pgpLen(const uint8_t *s, size_t * lenp)
        (*lenp) = ((((unsigned)s[0]) - 192) << 8) + s[1] + 192;
        return 2;
     } else {
-       (*lenp) = pgpGrab(s+1, 4);
+       (*lenp) = pgpGrab(s+1, (size_t) 4);
        return 5;
     }
 }
@@ -1074,7 +1074,7 @@ const char * pgpMpiStr(const uint8_t *p)
 {
     static char prbuf[8*BUFSIZ];       /* XXX ick */
     char *t = prbuf;
-    sprintf(t, "[%4u]: ", pgpGrab(p, 2));
+    sprintf(t, "[%4u]: ", pgpGrab(p, (size_t) 2));
     t += strlen(t);
     t = pgpHexCvt(t, p+2, pgpMpiLen(p)-2);
     return prbuf;