projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement __repr__ for _EnumerationField
[babeltrace.git]
/
compat
/
compat_uuid.c
diff --git
a/compat/compat_uuid.c
b/compat/compat_uuid.c
index 6216f7994cb97f6750607be3c6ba04a223f3633e..a79a01e763b89977c8bb8f1f93ce5e489940bd86 100644
(file)
--- a/
compat/compat_uuid.c
+++ b/
compat/compat_uuid.c
@@
-22,11
+22,23
@@
* SOFTWARE.
*/
* SOFTWARE.
*/
-/* This file is only built under MINGW32 */
+#define BT_LOG_TAG "COMPAT-UUID"
+#include "logging.h"
-#include <windows.h>
+#ifdef __APPLE__
+/*
+ * On macOS, we need a dummy symbol so that the linker won't
+ * complain of an empty table of contents.
+ */
+BT_HIDDEN
+int bt_uuid_dummy_symbol;
+#endif /* __APPLE__ */
+
+#ifdef __MINGW32__
+
+#include <rpc.h>
#include <stdlib.h>
#include <stdlib.h>
-#include <babeltrace/compat/uuid.h>
+#include <babeltrace/compat/uuid
-internal
.h>
/* MinGW does not provide byteswap - implement our own version. */
static
/* MinGW does not provide byteswap - implement our own version. */
static
@@
-42,24
+54,24
@@
void swap(unsigned char *ptr, unsigned int i, unsigned int j)
static
void fix_uuid_endian(unsigned char * ptr)
{
static
void fix_uuid_endian(unsigned char * ptr)
{
- swap(ptr, 0, 3)
- swap(ptr, 1, 2)
- swap(ptr, 4, 5)
- swap(ptr, 6, 7)
+ swap(ptr, 0, 3)
;
+ swap(ptr, 1, 2)
;
+ swap(ptr, 4, 5)
;
+ swap(ptr, 6, 7)
;
}
}
-int b
abeltrace
_uuid_generate(unsigned char *uuid_out)
+int b
t
_uuid_generate(unsigned char *uuid_out)
{
RPC_STATUS status;
{
RPC_STATUS status;
- status = UuidCreate((
struct UUID *)
uuid_out);
+ status = UuidCreate((
UUID *)
uuid_out);
if (status == RPC_S_OK)
return 0;
else
return -1;
}
if (status == RPC_S_OK)
return 0;
else
return -1;
}
-int b
abeltrace
_uuid_unparse(const unsigned char *uuid_in, char *str_out)
+int b
t
_uuid_unparse(const unsigned char *uuid_in, char *str_out)
{
RPC_STATUS status;
unsigned char *alloc_str;
{
RPC_STATUS status;
unsigned char *alloc_str;
@@
-70,7
+82,7
@@
int babeltrace_uuid_unparse(const unsigned char *uuid_in, char *str_out)
memcpy(copy_of_uuid_in, uuid_in, BABELTRACE_UUID_LEN);
fix_uuid_endian(copy_of_uuid_in);
memcpy(copy_of_uuid_in, uuid_in, BABELTRACE_UUID_LEN);
fix_uuid_endian(copy_of_uuid_in);
- status = UuidToString((
struct
UUID *) copy_of_uuid_in, &alloc_str);
+ status = UuidToString((UUID *) copy_of_uuid_in, &alloc_str);
if (status == RPC_S_OK) {
strncpy(str_out, (char *) alloc_str, BABELTRACE_UUID_STR_LEN);
if (status == RPC_S_OK) {
strncpy(str_out, (char *) alloc_str, BABELTRACE_UUID_STR_LEN);
@@
-83,12
+95,12
@@
int babeltrace_uuid_unparse(const unsigned char *uuid_in, char *str_out)
return ret;
}
return ret;
}
-int b
abeltrace
_uuid_parse(const char *str_in, unsigned char *uuid_out)
+int b
t
_uuid_parse(const char *str_in, unsigned char *uuid_out)
{
RPC_STATUS status;
status = UuidFromString((unsigned char *) str_in,
{
RPC_STATUS status;
status = UuidFromString((unsigned char *) str_in,
- (
struct
UUID *) uuid_out);
+ (UUID *) uuid_out);
fix_uuid_endian(uuid_out);
if (status == RPC_S_OK)
fix_uuid_endian(uuid_out);
if (status == RPC_S_OK)
@@
-97,15
+109,12
@@
int babeltrace_uuid_parse(const char *str_in, unsigned char *uuid_out)
return -1;
}
return -1;
}
-int b
abeltrace
_uuid_compare(const unsigned char *uuid_a,
+int b
t
_uuid_compare(const unsigned char *uuid_a,
const unsigned char *uuid_b)
{
RPC_STATUS status;
const unsigned char *uuid_b)
{
RPC_STATUS status;
- if (!UuidCompare((struct UUID *) uuid_a, (struct UUID *) uuid_b,
- &status)) {
- return 0;
- } else {
- return -1;
- }
+ return !UuidCompare((UUID *) uuid_a, (UUID *) uuid_b, &status) ? 0 : -1;
}
}
+
+#endif
This page took
0.03346 seconds
and
4
git commands to generate.