summaryrefslogtreecommitdiff
path: root/capplets/file-types/libuuid/pack.c
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2001-03-06 23:33:19 +0000
committerDarin Adler <darin@src.gnome.org>2001-03-06 23:33:19 +0000
commite7d9f82a0f48921d9ead9da0a584466d43dc11df (patch)
tree32858b98ff9089b89c03615b78261e38b20798c8 /capplets/file-types/libuuid/pack.c
parente0d6ca4c742dc0d59c4544996d2eecd989ff052b (diff)
downloadgnome-control-center-e7d9f82a0f48921d9ead9da0a584466d43dc11df.tar.gz
Diffstat (limited to 'capplets/file-types/libuuid/pack.c')
-rw-r--r--capplets/file-types/libuuid/pack.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/capplets/file-types/libuuid/pack.c b/capplets/file-types/libuuid/pack.c
new file mode 100644
index 000000000..94be488aa
--- /dev/null
+++ b/capplets/file-types/libuuid/pack.c
@@ -0,0 +1,46 @@
+/*
+ * Internal routine for packing UUID's
+ *
+ * Copyright (C) 1996, 1997 Theodore Ts'o.
+ *
+ * %Begin-Header%
+ * This file may be redistributed under the terms of the GNU Public
+ * License.
+ * %End-Header%
+ */
+
+#include <string.h>
+#include "uuidP.h"
+
+void uuid_pack(struct uuid *uu, uuid_t ptr)
+{
+ guint32 tmp;
+ unsigned char *out = ptr;
+
+ tmp = uu->time_low;
+ out[3] = (unsigned char) tmp;
+ tmp >>= 8;
+ out[2] = (unsigned char) tmp;
+ tmp >>= 8;
+ out[1] = (unsigned char) tmp;
+ tmp >>= 8;
+ out[0] = (unsigned char) tmp;
+
+ tmp = uu->time_mid;
+ out[5] = (unsigned char) tmp;
+ tmp >>= 8;
+ out[4] = (unsigned char) tmp;
+
+ tmp = uu->time_hi_and_version;
+ out[7] = (unsigned char) tmp;
+ tmp >>= 8;
+ out[6] = (unsigned char) tmp;
+
+ tmp = uu->clock_seq;
+ out[9] = (unsigned char) tmp;
+ tmp >>= 8;
+ out[8] = (unsigned char) tmp;
+
+ memcpy(out+10, uu->node, 6);
+}
+