[File] GUID, UUID, endianness, and all the rest

Christoph Biedl astron.com.bwoj at manchmal.in-ulm.de
Sun May 17 08:27:34 EDT 2026


Christoph Biedl wrote...

> * The current handling of guid is buggy on BE. I don't know where to
>   fix, perhaps in mconvert.

This one does the trick for me - I doubt however it matches file's
coding philosophy (WORDS_BIGENDIAN isn't used anywhere else in the
code).

--- a/src/funcs.c
+++ b/src/funcs.c
@@ -931,6 +931,11 @@ file_parse_guid(const char *s, uint64_t *guid)
 	    !getxvalue(&g->data4[6], s + 8, 2) ||
 	    !getxvalue(&g->data4[7], s + 10, 2))
 		return -1;
+#ifdef WORDS_BIGENDIAN
+	g->data1 = file_swap4(g->data1);
+	g->data2 = file_swap2(g->data2);
+	g->data3 = file_swap2(g->data3);
+#endif
 	return 0;
 }
 


More information about the File mailing list