aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-08-04 10:31:20 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-08-04 10:31:20 +0000
commita8951213805924a73114984e43d50899cefb6f4d (patch)
tree7f825215d5c0c965e21b98de69afe41e466700c4
parent8e645104879753898e43fa707fffe31ee5a2c3bf (diff)
replaced random() with g_random_*().
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@464 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog7
-rw-r--r--ChangeLog.ja7
-rw-r--r--src/compose.c2
-rw-r--r--src/main.c2
-rw-r--r--src/procmsg.c3
-rw-r--r--src/utils.c11
6 files changed, 17 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index e92ca477..500a2fab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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);
diff --git a/src/main.c b/src/main.c
index 82d09a55..eaf79a1d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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));