Selaa lähdekoodia

Fix clang 3.6 warnings

Bryan Drewery 11 vuotta sitten
vanhempi
commit
597a1b2a98
5 muutettua tiedostoa jossa 25 lisäystä ja 27 poistoa
  1. 21 23
      src/binary.cc
  2. 1 1
      src/botcmd.cc
  3. 1 1
      src/botmsg.cc
  4. 1 1
      src/botnet.cc
  5. 1 1
      src/mod/channels.mod/cmdschan.cc

+ 21 - 23
src/binary.cc

@@ -543,32 +543,30 @@ static void edpack(settings_t *incfg, const char *in_hash, int what)
   else
   else
     enc_dec_string = aes_decrypt_ecb_binary;
     enc_dec_string = aes_decrypt_ecb_binary;
 
 
-#define dofield(_field) 		do {							\
-	if (_field) {										\
-		len = sizeof(_field) - 1;							\
-		tmp = (char *) enc_dec_string(hash, (unsigned char *) _field, &len);		\
-		if (what == PACK_ENC) 								\
-		  memcpy(_field, tmp, len);							\
-		else 										\
-		  simple_snprintf(_field, sizeof(_field), "%s", tmp);				\
-		OPENSSL_cleanse(tmp, len);							\
-		free(tmp);									\
-	}											\
+#define dofield(_field) 		do {				\
+    len = sizeof(_field) - 1;						\
+    tmp = (char *) enc_dec_string(hash, (unsigned char *) _field, &len);\
+    if (what == PACK_ENC) 						\
+      memcpy(_field, tmp, len);						\
+    else 								\
+      simple_snprintf(_field, sizeof(_field), "%s", tmp);		\
+    OPENSSL_cleanse(tmp, len);						\
+    free(tmp);								\
 } while (0)
 } while (0)
 
 
-#define dohash(_field)		do {								\
-	if (what == PACK_ENC)									\
-	  strlcat(nhash, _field, sizeof(nhash));						\
-	dofield(_field);									\
-	if (what == PACK_DEC)									\
-	  strlcat(nhash, _field, sizeof(nhash));						\
+#define dohash(_field)		do {					\
+	if (what == PACK_ENC)						\
+	  strlcat(nhash, _field, sizeof(nhash));			\
+	dofield(_field);						\
+	if (what == PACK_DEC)						\
+	  strlcat(nhash, _field, sizeof(nhash));			\
 } while (0)
 } while (0)
 
 
-#define update_hash()		do {				\
-	MD5(NULL);						\
-	hash = MD5(nhash);					\
-	OPENSSL_cleanse(nhash, sizeof(nhash));			\
-	nhash[0] = 0;						\
+#define update_hash()		do {					\
+	MD5(NULL);							\
+	hash = MD5(nhash);						\
+	OPENSSL_cleanse(nhash, sizeof(nhash));				\
+	nhash[0] = 0;							\
 } while (0)
 } while (0)
 
 
   /* -- STATIC -- */
   /* -- STATIC -- */
@@ -793,7 +791,7 @@ void conf_to_bin(conf_t *in, bool move, int die)
     strlcpy(settings.homedir, in->homedir, sizeof(settings.homedir));
     strlcpy(settings.homedir, in->homedir, sizeof(settings.homedir));
   for (bot = in->bots; bot && bot->nick; bot = bot->next) {
   for (bot = in->bots; bot && bot->nick; bot = bot->next) {
     simple_snprintf(settings.bots, sizeof(settings.bots), STR("%s%s%s %s %s%s %s,"), 
     simple_snprintf(settings.bots, sizeof(settings.bots), STR("%s%s%s %s %s%s %s,"), 
-                           settings.bots && settings.bots[0] ? settings.bots : "",
+                           settings.bots[0] ? settings.bots : "",
                            bot->disabled ? "/" : "",
                            bot->disabled ? "/" : "",
                            bot->nick,
                            bot->nick,
                            bot->net.ip ? bot->net.ip : "*", 
                            bot->net.ip ? bot->net.ip : "*", 

+ 1 - 1
src/botcmd.cc

@@ -1332,7 +1332,7 @@ void bounce_simul(int idx, char *buf)
 {
 {
   char rmsg[SGRAB - 110] = "";
   char rmsg[SGRAB - 110] = "";
 
 
-  if (!buf || !buf[0] || !dcc[idx].simulbot || !dcc[idx].simulbot[0] || idx < 0)
+  if (!buf || !buf[0] || !dcc[idx].simulbot[0] || idx < 0)
     return;
     return;
 
 
   /* Truncate out the newline that was put in from the dprintf() */
   /* Truncate out the newline that was put in from the dprintf() */

+ 1 - 1
src/botmsg.cc

@@ -268,7 +268,7 @@ void botnet_send_update(int idx, tand_t * ptr)
   if (tands > 0) {
   if (tands > 0) {
     /* the D0gc is a lingering hack which probably will never be able to come out. */
     /* the D0gc is a lingering hack which probably will never be able to come out. */
     const size_t len = simple_snprintf(OBUF, sizeof(OBUF), "u %s %cD0gc %d %d %s %s\n", ptr->bot, ptr->share, ptr->localhub,
     const size_t len = simple_snprintf(OBUF, sizeof(OBUF), "u %s %cD0gc %d %d %s %s\n", ptr->bot, ptr->share, ptr->localhub,
-                                                          (int) ptr->buildts, ptr->commit, ptr->version ? ptr->version : "");
+                                                          (int) ptr->buildts, ptr->commit, ptr->version);
     send_tand_but(idx, OBUF, len);
     send_tand_but(idx, OBUF, len);
   }
   }
 }
 }

+ 1 - 1
src/botnet.cc

@@ -799,7 +799,7 @@ void dump_links(int z)
         p = bot->uplink->bot;
         p = bot->uplink->bot;
 
 
       l = simple_snprintf(x, sizeof(x), "n %s %s %cD0gc %d %d %s %s\n", bot->bot, p, bot->share, bot->localhub,
       l = simple_snprintf(x, sizeof(x), "n %s %s %cD0gc %d %d %s %s\n", bot->bot, p, bot->share, bot->localhub,
-                                                        (int) bot->buildts, bot->commit, bot->version ? bot->version : "");
+                                                        (int) bot->buildts, bot->commit, bot->version);
       tputs(dcc[z].sock, x, l);
       tputs(dcc[z].sock, x, l);
     }
     }
   }
   }

+ 1 - 1
src/mod/channels.mod/cmdschan.cc

@@ -1172,7 +1172,7 @@ static void cmd_chaninfo(int idx, char *par)
       strftime(date, sizeof date, "%c %Z", gmtime(&(chan->added_ts)));
       strftime(date, sizeof date, "%c %Z", gmtime(&(chan->added_ts)));
     } else
     } else
       date[0] = 0;
       date[0] = 0;
-    if (chan->added_by && chan->added_by[0])
+    if (chan->added_by[0])
       strlcpy(nick, chan->added_by, sizeof(nick));
       strlcpy(nick, chan->added_by, sizeof(nick));
     else
     else
       nick[0] = 0;
       nick[0] = 0;