Recode a couple files from ISO 8859-1 to UTF-8
[openafs.git] / src / util / uuid.c
index 8946eb1..af6dfa0 100644 (file)
@@ -10,7 +10,7 @@
 /* String conversion routines have the following copyright */
 
 /*
- * Copyright (c) 2002 Kungliga Tekniska Högskolan
+ * Copyright (c) 2002 Kungliga Tekniska Högskolan
  * (Royal Institute of Technology, Stockholm, Sweden).
  * All rights reserved.
  *
@@ -50,7 +50,6 @@
 
 # ifdef AFS_NT40_ENV
 #  include <rpc.h>
-#  include <process.h>
 # else
 #  include <net/if.h>
 #  if !defined(AFS_LINUX20_ENV) && !defined(AFS_ARM_DARWIN_ENV)
@@ -99,7 +98,7 @@ void uuid__get_os_time(uuid_time_t * os_time);
  * +--------------------------...-----+
  */
 
-afsUUID afs_uuid_g_nil_uuid = { 0 };
+afsUUID afs_uuid_g_nil_uuid;
 static uuid_time_t time_now, time_last;
 static u_short uuid_time_adjust, clock_seq;
 static afs_uint32 rand_m, rand_ia, rand_ib, rand_irand, uuid_init_done = 0;
@@ -199,14 +198,21 @@ afsUUID_from_string(const char *str, afsUUID * uuid)
     return 0;
 }
 
-/*
+/**
  *    Converts a UUID from binary representation to a string representation.
+ *
+ *    @param[in]  uuid pointer to a afsUUID
+ *    @param[out] buf  format work buffer
+ *
+ *    @returns pointer to buffer containing string representation of "uuid"
  */
 
-int
-afsUUID_to_string(const afsUUID * uuid, char *str, size_t strsz)
+char *
+afsUUID_to_string(const afsUUID * uuid, struct uuid_fmtbuf *buf)
 {
-    snprintf(str, strsz, "%08x-%04x-%04x-%02x-%02x-%02x%02x%02x%02x%02x%02x",
+    memset(buf, 0, sizeof(*buf));
+    snprintf(buf->buffer, sizeof(buf->buffer),
+            "%08x-%04x-%04x-%02x-%02x-%02x%02x%02x%02x%02x%02x",
             uuid->time_low, uuid->time_mid, uuid->time_hi_and_version,
             (unsigned char)uuid->clock_seq_hi_and_reserved,
             (unsigned char)uuid->clock_seq_low, (unsigned char)uuid->node[0],
@@ -214,7 +220,7 @@ afsUUID_to_string(const afsUUID * uuid, char *str, size_t strsz)
             (unsigned char)uuid->node[3], (unsigned char)uuid->node[4],
             (unsigned char)uuid->node[5]);
 
-    return 0;
+    return buf->buffer;
 }
 #endif
 
@@ -394,7 +400,7 @@ uuid_get_address(uuid_address_p_t addr)
 void
 uuid__get_os_time(uuid_time_t * os_time)
 {
-    osi_timeval_t tp;
+    osi_timeval32_t tp;
 
     osi_GetTime(&tp);
     os_time->hi = tp.tv_sec;