You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Greg Stein <gs...@lyra.org> on 2002/02/13 02:07:56 UTC
Re: cvs commit: apr/misc/win32 getuuid.c
-1
The code should defer to the Unix version of getuuid.c. That has a much more
robust implementation.
Cheers,
-g
On Tue, Feb 12, 2002 at 09:56:13PM -0000, wrowe@apache.org wrote:
>...
> --- getuuid.c 13 Apr 2001 15:31:31 -0000 1.6
> +++ getuuid.c 12 Feb 2002 21:56:13 -0000 1.7
> @@ -76,6 +76,16 @@
> * is therefore not only a uniqifier, but an identity (which might not
> * be appropriate in all cases.
> */
> +#ifndef _WIN32_WCE
> (void) CoCreateGuid(&guid);
> +#else
> + /* WCE lacks CoCreateGuid. So make something simple
> + * for now.
> + */
> + guid.Data1 = rand();
> + guid.Data2 = rand();
> + guid.Data3 = rand();
> + sprintf(guid.Data4, "%08X", rand());
> +#endif
> memcpy(uuid->data, &guid, sizeof(uuid->data));
> }
--
Greg Stein, http://www.lyra.org/
RE: cvs commit: apr/misc/win32 getuuid.c
Posted by Mladen Turk <mt...@mappingsoft.com>.
> -----Original Message-----
> From: Greg Stein [mailto:gstein@lyra.org]
> Sent: Wednesday, February 13, 2002 11:58 AM
> To: William A. Rowe, Jr.
> Cc: dev@apr.apache.org
> Subject: Re: cvs commit: apr/misc/win32 getuuid.c
> On Tue, Feb 12, 2002 at 08:10:26PM -0600, William A. Rowe, Jr. wrote:
> > +1, Agreed and backed out.
> >
> > Mladen - would you substitute the misc/unix implementation
> and report
> > back with a patch to that file only, if a patch is required?
> > Otherwise, just the updated build files [zipped as you had
> them] would
> > be great.
Build files...
MT.
Re: cvs commit: apr/misc/win32 getuuid.c
Posted by Greg Stein <gs...@lyra.org>.
On Tue, Feb 12, 2002 at 08:10:26PM -0600, William A. Rowe, Jr. wrote:
> +1, Agreed and backed out.
>
> Mladen - would you substitute the misc/unix implementation and report back
> with a patch to that file only, if a patch is required? Otherwise, just
> the updated build files [zipped as you had them] would be great.
Thanks Bill!
--
Greg Stein, http://www.lyra.org/
RE: cvs commit: apr/misc/win32 getuuid.c
Posted by Mladen Turk <mt...@mappingsoft.com>.
> -----Original Message-----
> From: William A. Rowe, Jr. [mailto:wrowe@covalent.net]
> Sent: Wednesday, February 13, 2002 3:10 AM
> To: Greg Stein; dev@apr.apache.org; Mladen Turk
> Subject: Re: cvs commit: apr/misc/win32 getuuid.c
>
>
> +1, Agreed and backed out.
>
> Mladen - would you substitute the misc/unix implementation
> and report back with a patch to that file only, if a patch is
> required? Otherwise, just the updated build files [zipped as
> you had them] would be great.
>
> Bill
>
> ----- Original Message -----
> From: "Greg Stein" <gs...@lyra.org>
> To: <de...@apr.apache.org>
> Sent: Tuesday, February 12, 2002 7:07 PM
> Subject: Re: cvs commit: apr/misc/win32 getuuid.c
>
>
> > -1
> >
> > The code should defer to the Unix version of getuuid.c. That has a
> > much more robust implementation.
> >
> > Cheers,
> > -g
Here it is...
The reference in EVC project should go to misc/unix/getuuid.c
Index: getuuid.c
===================================================================
RCS file: /home/cvspublic/apr/misc/unix/getuuid.c,v
retrieving revision 1.16
diff -u -r1.16 getuuid.c
--- getuuid.c 30 Nov 2001 22:26:54 -0000 1.16
+++ getuuid.c 13 Feb 2002 07:43:34 -0000
@@ -57,7 +57,9 @@
* located at
http://www.webdav.org/specs/draft-leach-uuids-guids-01.txt
*/
+#if APR_HAVE_UNISTD_H
#include <unistd.h> /* for getpid, gethostname */
+#endif
#include <stdlib.h> /* for rand, srand */
#include "apr.h"
@@ -100,7 +102,7 @@
/* Leach & Salz use Linux-specific struct sysinfo;
* replace with pid/tid for portability (in the spirit of
mod_unique_id) */
struct {
- /* Add thread id here, if applicable, when we get to pthread or
apr */
+ /* Add thread id here, if applicable, when we get to pthread or apr
*/
pid_t pid;
#ifdef NETWARE
apr_uint64_t t;
@@ -144,6 +146,15 @@
NXGetTime(NX_SINCE_1970, NX_SECONDS, &sec);
*uuid_time = (sec * 10000000) + 0x01B21DD213814000LL;
+#elif _WIN32_WCE
+ SYSTEMTIME sys;
+ FILETIME sec;
+
+ GetSystemTime(&sys);
+ FileTimeToSystemTime(&sec, &sys);
+ *uuid_time = (apr_uint64_t)(sec.dwHighDateTime << 32);
+ *uuid_time |= (apr_uint64_t)(sec.dwLowDateTime);
+ *uuid_time += 5748192000000000i64;
#else
struct timeval tp;
MT.
Re: cvs commit: apr/misc/win32 getuuid.c
Posted by "William A. Rowe, Jr." <wr...@covalent.net>.
+1, Agreed and backed out.
Mladen - would you substitute the misc/unix implementation and report back
with a patch to that file only, if a patch is required? Otherwise, just
the updated build files [zipped as you had them] would be great.
Bill
----- Original Message -----
From: "Greg Stein" <gs...@lyra.org>
To: <de...@apr.apache.org>
Sent: Tuesday, February 12, 2002 7:07 PM
Subject: Re: cvs commit: apr/misc/win32 getuuid.c
> -1
>
> The code should defer to the Unix version of getuuid.c. That has a much more
> robust implementation.
>
> Cheers,
> -g
>
> On Tue, Feb 12, 2002 at 09:56:13PM -0000, wrowe@apache.org wrote:
> >...
> > --- getuuid.c 13 Apr 2001 15:31:31 -0000 1.6
> > +++ getuuid.c 12 Feb 2002 21:56:13 -0000 1.7
> > @@ -76,6 +76,16 @@
> > * is therefore not only a uniqifier, but an identity (which might not
> > * be appropriate in all cases.
> > */
> > +#ifndef _WIN32_WCE
> > (void) CoCreateGuid(&guid);
> > +#else
> > + /* WCE lacks CoCreateGuid. So make something simple
> > + * for now.
> > + */
> > + guid.Data1 = rand();
> > + guid.Data2 = rand();
> > + guid.Data3 = rand();
> > + sprintf(guid.Data4, "%08X", rand());
> > +#endif
> > memcpy(uuid->data, &guid, sizeof(uuid->data));
> > }
>
> --
> Greg Stein, http://www.lyra.org/
>