Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 24567 Details for
Bug 39706
xmms 1.2.9 is out
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
xmms-1.2.9_pre1-random.patch
xmms-1.2.9_pre1-random-dtd_v1.patch (text/plain), 2.31 KB, created by
Bret Towe
on 2004-01-28 16:27:13 UTC
(
hide
)
Description:
xmms-1.2.9_pre1-random.patch
Filename:
MIME Type:
Creator:
Bret Towe
Created:
2004-01-28 16:27:13 UTC
Size:
2.31 KB
patch
obsolete
>--- /var/tmp/portage/xmms-1.2.9_pre1/work/xmms-1.2.9-pre1/xmms/main.c.old 2004-01-28 16:02:34.174675312 -0800 >+++ /var/tmp/portage/xmms-1.2.9_pre1/work/xmms-1.2.9-pre1/xmms/main.c 2004-01-28 16:04:36.291622147 -0800 >@@ -26,6 +26,7 @@ > #include <getopt.h> > #include <signal.h> > #include <ctype.h> >+#include <fcntl.h> > #ifdef HAVE_SCHED_H > # include <sched.h> > #elif defined HAVE_SYS_SCHED_H >@@ -38,6 +39,8 @@ > #include "charset.h" > #include "xmms_mini.xpm" > >+#define RNDTBL_SIZE 93 >+ > GtkWidget *mainwin, *mainwin_url_window = NULL, *mainwin_dir_browser = NULL; > GtkWidget *mainwin_jtt = NULL, *mainwin_jtf = NULL; > GtkItemFactory *mainwin_options_menu, *mainwin_songname_menu, *mainwin_vis_menu; >@@ -3557,7 +3560,20 @@ > #if defined(HAVE_SRANDOMDEV) > srandomdev(); > #else >- srandom(time(NULL)); >+ int fd = open ("/dev/urandom", O_RDONLY); >+ int i, randnum; >+ char randtbl2[RNDTBL_SIZE + 1] = { 0 }; >+ if (fd != -1) { >+ for (i=0; i<RNDTBL_SIZE; i++) { >+ read(fd, &randnum, 4 ); >+ randtbl2[i+1] = randnum; >+ // printf("Random number : %d\n",randnum); >+ } >+ initstate(time(NULL), randtbl2, RNDTBL_SIZE+1); >+ close(fd); >+ } else { >+ srandom(time(NULL)); >+ } > #endif > > read_config(); >--- /var/tmp/portage/xmms-1.2.9_pre1/work/xmms-1.2.9-pre1/xmms/playlist.c.old 2004-01-28 16:02:42.712832791 -0800 >+++ /var/tmp/portage/xmms-1.2.9_pre1/work/xmms-1.2.9-pre1/xmms/playlist.c 2004-01-28 16:06:40.502408411 -0800 >@@ -545,7 +545,7 @@ > /* If there are entries */ > if (g_list_length(skinlist)) { > /* Get a random value to select the skin to use */ >- int randval = random() % (g_list_length(skinlist) + 1); >+ int randval = (gint)(random() / (RAND_MAX + 1.0) * (g_list_length(skinlist) + 1)); > /* If the random value is 0, use the default skin */ > /* Otherwise subtract 1 from the random value and */ > /* select the skin */ >@@ -1899,7 +1899,7 @@ > { > /* Only find new songs in our current > score section */ >- j = (rand() % (next_score_section - i)) + i; >+ j = (gint)(random() / (RAND_MAX + 1.0) * (next_score_section - i)) + i; > > assert(j < next_score_section); > } >@@ -1984,7 +1984,7 @@ > gint j; > > /* Pick a random song among the ones that are left */ >- j = (rand() % (len - i)) + i; >+ j = (gint)(random() / (RAND_MAX + 1.0) * (len - i)) + i; > > /* Swap pointer #i and pointer #j */ > swap_ptr = ptrs[i];
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 39706
: 24567