mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
warc: Fix UUID generation on FreeBSD
This commit is contained in:
parent
f3289f76ec
commit
601401da71
@ -1,3 +1,7 @@
|
||||
2014-06-22 Giuseppe Scrivano <gscrivan@redhat.com>
|
||||
|
||||
* configure.ac: Add check for uuid_create.
|
||||
|
||||
2014-06-11 Giuseppe Scrivano <gscrivan@redhat.com>
|
||||
|
||||
* NEWS: Remove repeated word.
|
||||
|
@ -541,6 +541,12 @@ fi
|
||||
dnl
|
||||
dnl Check for UUID
|
||||
dnl
|
||||
AC_CHECK_HEADER(uuid.h,
|
||||
AC_CHECK_FUNC(uuid, uuid_create,
|
||||
[AC_DEFINE([HAVE_UUID_CREATE], 1,
|
||||
[Define if uuid_create is available.])
|
||||
])
|
||||
)
|
||||
|
||||
AC_CHECK_HEADER(uuid/uuid.h,
|
||||
AC_CHECK_LIB(uuid, uuid_generate,
|
||||
|
@ -1,3 +1,10 @@
|
||||
2014-06-22 Giuseppe Scrivano <gscrivan@redhat.com>
|
||||
|
||||
* warc.c [HAVE_UUID_CREATE]: Include <uuid.h>
|
||||
(warc_uuid_str) [HAVE_UUID_CREATE]: Use uuid_create and
|
||||
uuid_to_string to generate the UUID.
|
||||
Reported by: Alex Zimnitsky <aavzz@yandex.ru>
|
||||
|
||||
2014-06-22 Darshit Shah <darnir@gmail.com> (tiny change)
|
||||
|
||||
* progress.c (create_image): Align percentage download output better.
|
||||
|
10
src/warc.c
10
src/warc.c
@ -44,8 +44,11 @@ as that of the covered work. */
|
||||
#ifdef HAVE_LIBZ
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBUUID
|
||||
#include <uuid/uuid.h>
|
||||
#elif HAVE_UUID_CREATE
|
||||
#include <uuid.h>
|
||||
#endif
|
||||
|
||||
#ifndef WINDOWS
|
||||
@ -594,7 +597,7 @@ warc_timestamp (char *timestamp)
|
||||
strftime (timestamp, 21, "%Y-%m-%dT%H:%M:%SZ", timeinfo);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBUUID
|
||||
#if HAVE_LIBUUID || HAVE_UUID_CREATE
|
||||
/* Fills urn_str with a UUID in the format required
|
||||
for the WARC-Record-Id header.
|
||||
The string will be 47 characters long. */
|
||||
@ -604,8 +607,13 @@ warc_uuid_str (char *urn_str)
|
||||
char uuid_str[37];
|
||||
|
||||
uuid_t record_id;
|
||||
#if HAVE_UUID_CREATE
|
||||
uuid_create (&record_id, NULL);
|
||||
uuid_to_string (&record_id, &uuid_str, NULL);
|
||||
#else
|
||||
uuid_generate (record_id);
|
||||
uuid_unparse (record_id, uuid_str);
|
||||
#endif
|
||||
|
||||
sprintf (urn_str, "<urn:uuid:%s>", uuid_str);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user