Explorar el Código

* Convert some egg_snprintf() to simple_snprintf() now that it supports zero padding

Bryan Drewery hace 17 años
padre
commit
1840f83445
Se han modificado 6 ficheros con 7 adiciones y 7 borrados
  1. 1 1
      src/core_binds.c
  2. 1 1
      src/crypt.c
  3. 2 2
      src/misc.c
  4. 1 1
      src/mod/channels.mod/userchan.c
  5. 1 1
      src/mod/irc.mod/irc.c
  6. 1 1
      src/users.c

+ 1 - 1
src/core_binds.c

@@ -284,6 +284,6 @@ void check_bind_chof(char *hand, int idx)
 void check_bind_time(struct tm *tm)
 {
 	char full[32] = "";
-	egg_snprintf(full, sizeof(full), "%02d %02d %02d %02d %04d", tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year + 1900);
+	simple_snprintf(full, sizeof(full), "%02d %02d %02d %02d %04d", tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year + 1900);
 	check_bind(BT_time, full, NULL, tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year + 1900);
 }

+ 1 - 1
src/crypt.c

@@ -342,7 +342,7 @@ int sha1cmp(const char *hash, const char *string) {
 
 void btoh(const unsigned char *md, size_t md_len, char *buf, const size_t buf_len)
 {
-#define doblock(n) snprintf(&(buf[(i + n) << 1]), buf_len - ((i + n) << 1), "%02x", md[i + n]);
+#define doblock(n) simple_snprintf(&(buf[(i + n) << 1]), buf_len - ((i + n) << 1), "%02x", md[i + n]);
   for (size_t i = 0; i < md_len; i+=4) {
     doblock(0);
     doblock(1);

+ 2 - 2
src/misc.c

@@ -342,7 +342,7 @@ void daysdur(time_t mynow, time_t then, char *out, size_t outsiz)
   mynow -= then;
   int hrs = (int) (mynow / 3600);
   int mins = (int) ((mynow - (hrs * 3600)) / 60);
-  egg_snprintf(s, sizeof(s), "%02d:%02d", hrs, mins);
+  simple_snprintf(s, sizeof(s), "%02d:%02d", hrs, mins);
   strlcat(out, s, outsiz);
 }
 
@@ -492,7 +492,7 @@ char *str_escape(const char *str, const char divc, const char mask)
     }
 
     if (*s == divc || *s == mask) {
-      egg_snprintf(b, buflen, "%c%02x", mask, *s);
+      simple_snprintf(b, buflen, "%c%02x", mask, *s);
       b += 3;
       blen += 3;
     } else {

+ 1 - 1
src/mod/channels.mod/userchan.c

@@ -543,7 +543,7 @@ static void tell_masks(const char type, int idx, bool show_inact, char *match, b
 	  if (ml->timer != 0) {
 	    min = (now - ml->timer) / 60;
 	    sec = (now - ml->timer) - (min * 60);
-	    egg_snprintf(s, sizeof(s), " (active %02d:%02d)", min, sec);
+	    simple_snprintf(s, sizeof(s), " (active %02d:%02d)", min, sec);
 	    strlcat(fill, s, sizeof(fill));
 	  }
 	  if ((!match[0]) || (wild_match(match, ml->mask)))

+ 1 - 1
src/mod/irc.mod/irc.c

@@ -362,7 +362,7 @@ void makecookie(char *out, size_t len, const char *chname, const memberlist* opp
 
   make_rand_str(randstring, 4);
   /* &ts[4] is now last 6 digits of time */
-  egg_snprintf(ts, sizeof(ts), "%010li", (long) (now + timesync));
+  simple_snprintf(ts, sizeof(ts), "%010li", (long) (now + timesync));
   
   const char* hash1 = cookie_hash(chname, opper, m1, ts, randstring);
   const char* hash2 = m2 ? cookie_hash(chname, opper, m2, ts, randstring) : NULL;

+ 1 - 1
src/users.c

@@ -965,7 +965,7 @@ void link_pref_val(struct userrec *u, char *val)
   if (!ba->hublevel || ba->hublevel == 999) {
     return;
   }
-  egg_snprintf(val, HANDLEN + 4, "%02d%s", ba->hublevel, u->handle);
+  simple_snprintf(val, HANDLEN + 4, "%02d%s", ba->hublevel, u->handle);
 }
 
 /*