base/asm-common.h (x86), and knock-on: Add macros for full-size regs.
[catacomb] / progs / dsig.c
index 5e5a3cf..3f217da 100644 (file)
@@ -39,6 +39,7 @@
 
 #include <mLib/alloc.h>
 #include <mLib/base64.h>
+#include <mLib/macros.h>
 #include <mLib/mdwopt.h>
 #include <mLib/quis.h>
 #include <mLib/report.h>
@@ -204,7 +205,7 @@ static int bget(block *b, FILE *fp, unsigned bin)
     if (getstring(fp, &d, GSF_FILE))
       return (E_EOF);
     for (tag = 0; tagtab[tag]; tag++) {
-      if (strcmp(tagtab[tag], d.buf) == 0)
+      if (STRCMP(tagtab[tag], ==, d.buf))
        goto done;
     }
     return (E_TAG);
@@ -233,12 +234,13 @@ static int bget(block *b, FILE *fp, unsigned bin)
        octet buf[8];
        if (fread(buf, sizeof(buf), 1, fp) < 1)
          return (E_EOF);
-       b->t = ((time_t)(((LOAD32(buf + 0) << 16) << 16) & ~MASK32) |
+       b->t = ((time_t)(((LOAD32(buf + 0) << 16) << 16) &
+                        ~(unsigned long)MASK32) |
                (time_t)LOAD32(buf + 4));
       } else {
        if (getstring(fp, &b->d, GSF_FILE))
          return (E_EOF);
-       if (strcmp(b->d.buf, "forever") == 0)
+       if (STRCMP(b->d.buf, ==, "forever"))
          b->t = KEXP_FOREVER;
        else if ((b->t = get_date(b->d.buf, 0)) == -1)
          return (E_DATE);
@@ -325,7 +327,8 @@ static void blob(block *b, dstr *d)
        STORE32(d->buf + d->len, 0xffffffff);
        STORE32(d->buf + d->len + 4, 0xffffffff);
       } else {
-       STORE32(d->buf + d->len, ((b->t & ~MASK32) >> 16) >> 16);
+       STORE32(d->buf + d->len,
+               ((b->t & ~(unsigned long)MASK32) >> 16) >> 16);
        STORE32(d->buf + d->len + 4, b->t);
       }
       d->len += 8;
@@ -534,7 +537,7 @@ static int sign(int argc, char *argv[])
        ki = optarg;
        break;
       case 'e':
-       if (strcmp(optarg, "forever") == 0)
+       if (STRCMP(optarg, ==, "forever"))
          exp = KEXP_FOREVER;
        else if ((exp = get_date(optarg, 0)) == -1)
          die(EXIT_FAILURE, "bad expiry time");
@@ -570,14 +573,14 @@ static int sign(int argc, char *argv[])
   /* --- Open files --- */
 
   if (hfile) ifile = hfile;
-  if (!ifile || strcmp(ifile, "-") == 0)
+  if (!ifile || STRCMP(ifile, ==, "-"))
     ifp = stdin;
   else if ((ifp = fopen(ifile, (f & f_bin) ? "rb" : "r")) == 0) {
     die(EXIT_FAILURE, "couldn't open input file `%s': %s",
        ifile, strerror(errno));
   }
 
-  if (!ofile || strcmp(ofile, "-") == 0)
+  if (!ofile || STRCMP(ofile, ==, "-"))
     ofp = stdout;
   else if ((ofp = fopen(ofile, (f & f_bin) ? "wb" : "w")) == 0) {
     die(EXIT_FAILURE, "couldn't open output file `%s': %s",
@@ -906,7 +909,7 @@ static int verify(int argc, char *argv[])
          }
          f |= f_bogus;
        } else if (b.b.len != GH_CLASS(s->h)->hashsz ||
-                  memcmp(d.buf, b.b.buf, b.b.len) != 0) {
+                  MEMCMP(d.buf, !=, b.b.buf, b.b.len)) {
          if (verb > 1)
            printf("BAD file `%s' has incorrect hash\n", b.d.buf);
          f |= f_bogus;