Add missing permission notice in each source file
[babeltrace.git] / include / babeltrace / uuid.h
index dfe1e020646ce6c6b24069813d37a932d399e90f..2ce74670796506645c1527d48743e8f0f06d6a22 100644 (file)
@@ -2,16 +2,27 @@
 #define _BABELTRACE_UUID_H
 
 /*
+ * babeltrace/uuid.h
+ *
  * Copyright (C) 2011   Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
- * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
  *
- * Permission is hereby granted to use or copy this program
- * for any purpose,  provided the above notices are retained on all copies.
- * Permission to modify the code and to distribute modified code is granted,
- * provided the above notices are retained, and a notice that the code was
- * modified is included with the above copyright notice.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
  */
 
 #include <config.h>
@@ -31,9 +42,10 @@ int babeltrace_uuid_generate(unsigned char *uuid_out)
 }
 
 static inline
-void babeltrace_uuid_unparse(const unsigned char *uuid_in, char *str_out)
+int babeltrace_uuid_unparse(const unsigned char *uuid_in, char *str_out)
 {
-       return uuid_unparse(uuid_in, str_out);
+       uuid_unparse(uuid_in, str_out);
+       return 0;
 }
 
 static inline
@@ -52,6 +64,8 @@ int babeltrace_uuid_compare(const unsigned char *uuid_a,
 #elif defined(BABELTRACE_HAVE_LIBC_UUID)
 #include <uuid.h>
 #include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
 
 static inline
 int babeltrace_uuid_generate(unsigned char *uuid_out)
@@ -66,15 +80,21 @@ int babeltrace_uuid_generate(unsigned char *uuid_out)
 }
 
 static inline
-void babeltrace_uuid_unparse(const unsigned char *uuid_in, char *str_out)
+int babeltrace_uuid_unparse(const unsigned char *uuid_in, char *str_out)
 {
        uint32_t status;
-
-       uuid_to_string((uuid_t *) uuid_in, str_out, &status);
-       if (status == uuid_s_ok)
-               return 0;
-       else
-               return -1;
+       char *alloc_str;
+       int ret;
+
+       uuid_to_string((uuid_t *) uuid_in, &alloc_str, &status);
+       if (status == uuid_s_ok) {
+               strcpy(str_out, alloc_str);
+               ret = 0;
+       } else {
+               ret = -1;
+       }
+       free(alloc_str);
+       return ret;
 }
 
 static inline
This page took 0.025007 seconds and 4 git commands to generate.