Quash various warnings from higher levels of compiler warnings.
authorMichael Poole <mdpoole@troilus.org>
Fri, 25 Apr 2014 00:34:06 +0000 (20:34 -0400)
committerMichael Poole <mdpoole@troilus.org>
Fri, 25 Apr 2014 00:34:06 +0000 (20:34 -0400)
Two changes are to avoid never-true checks that a local array is not a
null pointer; two changes are to the length arguments of memset/memcpy.
(The MD5 change is just for cleaning up; the parser change should only
affect systems where sizeof(long) != sizeof(struct ListenerFlags*), but
that is not true of any system that is likely to run ircu2.)

ircd/crule.c
ircd/ircd_md5.c
ircd/ircd_parser.y
ircd/m_pass.c

index 1a1fd2150e53a46cbf8224b771d703bb8d2d6a6e..a91aecb41b76021a64c7b5be61e1d4859b05a899 100644 (file)
@@ -737,7 +737,7 @@ static int crule_parsearglist(CRuleNodePtr argrootp, int *next_tokp, const char*
 #if !defined(CR_DEBUG) && !defined(CR_CHKCONF)
         collapse(currarg);
 #endif
-        if (!BadPtr(currarg))
+        if (currarg[0] != '\0')
         {
           DupString(argelemp, currarg);
           argrootp->arg[argrootp->numargs++] = (void *)argelemp;
index fd14a34e083914d23d02a1f1063a8c0be666ee32..0d7d73e23a4d36faf59b9f2721c71376c37337c3 100644 (file)
@@ -154,7 +154,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
        MD5Transform(ctx->buf, (uint32 *) ctx->in);
        byteReverse((unsigned char *) ctx->buf, 4);
        memcpy(digest, ctx->buf, 16);
-       memset(ctx, 0, sizeof(ctx));    /* In case it's sensitive */
+       memset(ctx, 0, sizeof(*ctx));   /* In case it's sensitive */
 }
 
 #ifndef ASM_MD5
index a43b9446cd7619768bafb7e301ea67525065901f..64a112cb9e54000097c2ef1df176debd3c6b7db9 100644 (file)
@@ -709,7 +709,7 @@ portblock: PORT '{' portitems '}' ';' {
     hosts = link;
   }
   for (link = hosts; link != NULL; link = link->next) {
-    memcpy(&flags_here, &listen_flags, sizeof(&flags_here));
+    memcpy(&flags_here, &listen_flags, sizeof(flags_here));
     switch (link->flags & (USE_IPV4 | USE_IPV6)) {
     case USE_IPV4:
       FlagSet(&flags_here, LISTEN_IPV4);
index eb08e9f6b6a22a36b0e77947e56721480de1692e..e34e6819aba9b17c7a183417cf5ab76632b2ee44 100644 (file)
@@ -116,7 +116,7 @@ int mr_pass(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     --len;
   password[len] = '\0';
 
-  if (EmptyString(password))
+  if (password[0] == '\0')
     return need_more_params(cptr, "PASS");
 
   ircd_strncpy(cli_passwd(cptr), password, PASSWDLEN);