diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ChangeLog.ja | 7 | ||||
-rw-r--r-- | src/compose.c | 2 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/procmsg.c | 3 | ||||
-rw-r--r-- | src/utils.c | 11 |
6 files changed, 17 insertions, 15 deletions
@@ -1,5 +1,12 @@ 2005-08-04 + * src/compose.c + src/main.c + src/utils.c + src/procmsg.c: replaced random() with portable g_random_*(). + +2005-08-04 + * src/about.c: modified version display. * src/socket.c: added sock_init() and sock_cleanup(). diff --git a/ChangeLog.ja b/ChangeLog.ja index 27f46fe1..40166a24 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,12 @@ 2005-08-04 + * src/compose.c + src/main.c + src/utils.c + src/procmsg.c: random() を portable な g_random_*() で置き換えた。 + +2005-08-04 + * src/about.c: バージョン表示を修正。 * src/socket.c: sock_init() と sock_cleanup() を追加。 diff --git a/src/compose.c b/src/compose.c index fd3b3fa7..eca3aba2 100644 --- a/src/compose.c +++ b/src/compose.c @@ -3788,7 +3788,7 @@ static void compose_generate_msgid(Compose *compose, gchar *buf, gint len) lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday, lt->tm_hour, lt->tm_min, lt->tm_sec, - (guint)random(), addr); + g_random_int(), addr); debug_print(_("generated Message-ID: %s\n"), buf); @@ -185,8 +185,6 @@ int main(int argc, char *argv[]) ssl_init(); #endif - srandom((gint)time(NULL)); - /* parse gtkrc files */ userrc = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, ".gtkrc-2.0", NULL); diff --git a/src/procmsg.c b/src/procmsg.c index fb7c0fd4..0a5ebe31 100644 --- a/src/procmsg.c +++ b/src/procmsg.c @@ -1276,8 +1276,7 @@ gint procmsg_send_queue(FolderItem *queue, gboolean save_msgs, } g_snprintf(tmp, sizeof(tmp), "%s%ctmpmsg.out.%08x", - get_rc_dir(), G_DIR_SEPARATOR, - (guint)random()); + get_rc_dir(), G_DIR_SEPARATOR, g_random_int()); if (send_get_queue_contents(qinfo, tmp) == 0) { if (save_msgs) { diff --git a/src/utils.c b/src/utils.c index 6463698a..fb021df9 100644 --- a/src/utils.c +++ b/src/utils.c @@ -2715,18 +2715,9 @@ gchar *generate_mime_boundary(const gchar *prefix) gchar buf_uniq[17]; gchar buf_date[64]; gint i; - gint pid; - pid = getpid(); - - /* We make the boundary depend on the pid, so that all running - * processes generate different values even when they have been - * started within the same second and srandom(time(NULL)) has been - * used. I can't see whether this is really an advantage but it - * doesn't do any harm. - */ for (i = 0; i < sizeof(buf_uniq) - 1; i++) - buf_uniq[i] = tbl[(random() ^ pid) % (sizeof(tbl) - 1)]; + buf_uniq[i] = tbl[g_random_int_range(0, sizeof(tbl) - 1)]; buf_uniq[i] = '\0'; get_rfc822_date(buf_date, sizeof(buf_date)); |