Commit 93d2f49c authored by Michael Natterer's avatar Michael Natterer 😴

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.
parent f2306abc
......@@ -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;
for (shake = 0; shake < 10; shake++)
{
timespec_get (&ts, TIME_UTC);
time = ts.tv_nsec / 1000;
srand (time);
}
GRand *rand;
gint bake;
gchar *GUID;
const gchar *szHex = "0123456789abcdef-";
GUID = g_malloc0 (DALLOC);
rand = g_rand_new ();
bake = 0;
szHex = "0123456789abcdef-";
#define DALLOC 36
GUID = g_malloc0 (DALLOC);
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment