[PATCH 29/50] [avis] Use Platform Independent UUID from Common


Michael Schonberg <mschonberg@...>
 

From: Mike Schonberg <mschonberg@nyx.com>

Windows does not support libuuid (DCE Compatible Universally Unique
Identifier Library). The OpenMAMA common library provides a compatibility
layer.

Signed-off-by: Mike Schonberg <mschonberg@nyx.com>
---
mama/c_cpp/src/c/bridge/avis/Makefile.am | 2 +-
mama/c_cpp/src/c/bridge/avis/subinitial.c | 18 +++++++++---------
2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/mama/c_cpp/src/c/bridge/avis/Makefile.am b/mama/c_cpp/src/c/bridge/avis/Makefile.am
index 8cc5913..4385ff0 100644
--- a/mama/c_cpp/src/c/bridge/avis/Makefile.am
+++ b/mama/c_cpp/src/c/bridge/avis/Makefile.am
@@ -40,7 +40,7 @@ CFLAGS += -Wimplicit -Wno-long-long -Wmissing-prototypes -Wstrict-prototypes -Wa
CPPFLAGS += -Wno-long-long -Wimplicit -Wno-long-long -Wmissing-prototypes -Wstrict-prototypes -Wall
endif

-LIBS = -lavis -luuid -lmama -lm -lwombatcommon
+LIBS = -lavis -lmama -lm -lwombatcommon -luuid

libmamaavisimpl_la_SOURCES = \
bridge.c \
diff --git a/mama/c_cpp/src/c/bridge/avis/subinitial.c b/mama/c_cpp/src/c/bridge/avis/subinitial.c
index 7567732..95c8ff3 100644
--- a/mama/c_cpp/src/c/bridge/avis/subinitial.c
+++ b/mama/c_cpp/src/c/bridge/avis/subinitial.c
@@ -19,7 +19,7 @@
* 02110-1301 USA
*/

-#include <uuid/uuid.h>
+#include <wombat/wUuid.h>

#include <mama/mama.h>
#include <bridge.h>
@@ -107,27 +107,27 @@ avisBridgeMamaInbox_createByIndex (inboxBridge* bridge,
void* closure,
mamaInbox parent)
{
+ wUuid t_uuid;
+ char t_str[37];
+ mamaMsgCallbacks cb;
+ avisInboxImpl* impl = NULL;
+ mama_status status = MAMA_STATUS_OK;
if (!bridge || !transport || !queue || !msgCB) return MAMA_STATUS_NULL_ARG;
- avisInboxImpl* impl = (avisInboxImpl*)calloc(1, sizeof(avisInboxImpl));
+ impl = (avisInboxImpl*)calloc(1, sizeof(avisInboxImpl));
if (!impl)
return MAMA_STATUS_NOMEM;

- mama_status status = MAMA_STATUS_OK;
if (MAMA_STATUS_OK != (status = mamaSubscription_allocate(&impl->mSubscription))) {
mama_log (MAMA_LOG_LEVEL_ERROR, "avisBridgeMamaInbox_createByIndex(): Failed to allocate subscription ");
free(impl);
return status;
}

- uuid_t t_uuid;
// NOTE: uuid_generate is very expensive, so we use cheaper uuid_generate_time
- //uuid_generate(uuid);
- uuid_generate_time(t_uuid);
- char t_str[uuidStringLen+1];
- uuid_unparse(t_uuid, t_str);
+ wUuid_generate_time(t_uuid);
+ wUuid_unparse(t_uuid, t_str);
snprintf(impl->mInbox, sizeof(impl->mInbox) -1, "_INBOX.%s", t_str);

- mamaMsgCallbacks cb;
cb.onCreate = &avisInbox_onCreate;
cb.onError = &avisInbox_onError;
cb.onMsg = &avisInbox_onMsg;
--
1.7.7.6

Join Openmama-dev@lists.openmama.org to automatically receive all group messages.