[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] [patch] uuid generation in warc.c
From: |
Tim Ruehsen |
Subject: |
Re: [Bug-wget] [patch] uuid generation in warc.c |
Date: |
Tue, 06 Jan 2015 14:28:03 +0100 |
User-agent: |
KMail/4.14.2 (Linux/3.16.0-4-amd64; KDE/4.14.2; x86_64; ; ) |
On Monday 05 January 2015 16:40:15 Gisle Vanem wrote:
> Gisle Vanem wrote:
> > And for Windows? I guess the 'UuidCreate()' or 'UuidCreateSequential()'
> > functions from Rpcrt4.dll could be used?
> >
> > I could write a patch for loading Rpcrt4.dll at run-time if
> > there's some interest.
>
> Done that now. It was simple enough:
>
> --- Git-latest/src/warc.c 2014-12-28 18:03:37 +0000
> +++ src/warc.c 2014-12-28 18:11:48 +0000
> @@ -61,6 +61,7 @@
> #ifdef WINDOWS
> /* we need this on Windows to have O_TEMPORARY defined */
> #include <fcntl.h>
> +#include <rpc.h>
> #endif
>
> #ifndef O_TEMPORARY
> @@ -631,6 +632,18 @@
> sprintf (urn_str, "<urn:uuid:%s>", uuid_str);
> xfree (uuid_str);
> }
> +#elif defined(WINDOWS)
> +void
> +warc_uuid_str (char *urn_str)
> +{
> + BYTE *uuid_str;
> + UUID uuid;
> +
> + UuidCreate (&uuid);
> + UuidToString (&uuid, &uuid_str);
> + sprintf (urn_str, "<urn:uuid:%s>", uuid_str);
> + RpcStringFree (&uuid_str);
> +}
> #else
> /* Fills urn_str with a UUID based on random numbers in the format
> required for the WARC-Record-Id header.
>
> --------
>
> But I have no idea to specify '-lrpcrt4' or 'rpcrt4.lib' to LDADD
> conditionally for Win32. Like so?
>
> +
> +if WIN32
> + LDADD += -lrpcrt4
> +endif
> +
I would prefer dynamic linking (-lrpcrt4).
If rpcrt4.lib/.dll is *not* a basic windows library, you should check for the
library in configure.ac (case "$host_os" in ...).
There is an example check:
dnl Deal with specific hosts
case $host_os in
*mingw32* )
LIBS+=' -lws2_32'
AC_LIBOBJ([mswindows])
;;
esac
Tim
signature.asc
Description: This is a digitally signed message part.