Bug 784961 - Undeclared identifier 'TIME_UTC' - GIMP fails to build...
...on macOS (with macports) Changed gimp_metadata_get_guid() to use a GRand that automatically seeds itself from /dev/urandom (if available) or the current time.
This commit is contained in:
parent
f2306abc0a
commit
93d2f49c16
1 changed files with 10 additions and 17 deletions
|
|
@ -206,29 +206,20 @@ gimp_metadata_init (GimpMetadata *metadata)
|
|||
gchar *
|
||||
gimp_metadata_get_guid (void)
|
||||
{
|
||||
const int DALLOC = 36;
|
||||
struct timespec ts;
|
||||
long time;
|
||||
gint shake;
|
||||
gint bake;
|
||||
gchar *GUID;
|
||||
gchar *szHex;
|
||||
GRand *rand;
|
||||
gint bake;
|
||||
gchar *GUID;
|
||||
const gchar *szHex = "0123456789abcdef-";
|
||||
|
||||
for (shake = 0; shake < 10; shake++)
|
||||
{
|
||||
timespec_get (&ts, TIME_UTC);
|
||||
time = ts.tv_nsec / 1000;
|
||||
srand (time);
|
||||
}
|
||||
rand = g_rand_new ();
|
||||
|
||||
#define DALLOC 36
|
||||
|
||||
GUID = g_malloc0 (DALLOC);
|
||||
|
||||
bake = 0;
|
||||
szHex = "0123456789abcdef-";
|
||||
|
||||
for (bake = 0; bake < DALLOC; bake++)
|
||||
{
|
||||
gint r = rand () % 16;
|
||||
gint r = g_rand_int (rand) % 16;
|
||||
gchar c = ' ';
|
||||
|
||||
switch (bake)
|
||||
|
|
@ -256,6 +247,8 @@ gimp_metadata_get_guid (void)
|
|||
GUID[bake] = (bake < DALLOC) ? c : 0x00;
|
||||
}
|
||||
|
||||
g_rand_free (rand);
|
||||
|
||||
return GUID;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue