summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsys.com>2012-03-28 12:43:26 (GMT)
committerChristian Mollekopf <mollekopf@kolabsys.com>2012-03-28 12:43:26 (GMT)
commitf4d2044b84f2d1e976bd51683e408f5f1ab771b4 (patch)
treee56e8e46d898e32b65279d694f00af22d8f4b3e5
parent85f98b950f43ab5df03fb9d6655f4c9d736ac756 (diff)
downloadlibkolabxml-f4d2044b84f2d1e976bd51683e408f5f1ab771b4.tar.gz
Use ossp-uuid and not the util-linux-ng version.
-rw-r--r--libkolabxml/CMakeLists.txt2
-rw-r--r--libkolabxml/lib/utils.cpp15
2 files changed, 10 insertions, 7 deletions
diff --git a/libkolabxml/CMakeLists.txt b/libkolabxml/CMakeLists.txt
index 946c93a..ffbaf57 100644
--- a/libkolabxml/CMakeLists.txt
+++ b/libkolabxml/CMakeLists.txt
@@ -23,7 +23,7 @@ if (Boost_FOUND)
endif (Boost_FOUND)
if (${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.42)
- find_library(UUID NAMES ossp-uuid uuid)
+ find_library(UUID NAMES ossp-uuid)
if(UUID)
message("uuid found")
else (UUID)
diff --git a/libkolabxml/lib/utils.cpp b/libkolabxml/lib/utils.cpp
index fb5f10b..164fd25 100644
--- a/libkolabxml/lib/utils.cpp
+++ b/libkolabxml/lib/utils.cpp
@@ -25,7 +25,7 @@
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
#else
-#include <uuid/uuid.h>
+#include <uuid.h>
#endif
#include <boost/lexical_cast.hpp>
@@ -106,11 +106,14 @@ std::string getUID(const std::string &s)
boost::uuids::uuid u; // initialize uuid
return boost::uuids::to_string(u);
#else
- uuid_t u;
- uuid_generate(u);
- char out[37];
- uuid_unparse(u,out);
- return std::string(out, 36); //We don't need the terminating \0
+ uuid_t *uuid;
+ char *str = 0;
+ uuid_create(&uuid);
+ uuid_make(uuid, UUID_MAKE_V1);
+ uuid_export(uuid, UUID_FMT_STR, &str, 0);
+ uuid_destroy(uuid);
+
+ return std::string(str, 36); //We don't need the terminating \0
#endif
}
return s;