summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2010-02-05 22:27:28 +0100
committerAndrea Canciani <ranma42@gmail.com>2010-03-31 13:13:36 +0200
commit4f617eaf77540ba2140086bd5a19fe6d62503d62 (patch)
tree0a69e71f367d1eff7c39dc391ff4f22450ac5a9f /util
parent35f19bc084792bbad42b86a399103ebfbf407d05 (diff)
trace: Fix trace endianness
Trace files were using host-endian to represent the length of compressed data, making the trace format not portable. Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'util')
-rw-r--r--util/cairo-trace/trace.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index 36ca3e02b..fd83ee938 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -71,6 +71,20 @@
((((uint32_t)(p))) >> 24))
#endif
+#if WORDS_BIGENDIAN
+#define le16(x) bswap_16 (x)
+#define le32(x) bswap_32 (x)
+#define be16(x) x
+#define be32(x) x
+#define to_be32(x) x
+#else
+#define le16(x) x
+#define le32(x) x
+#define be16(x) bswap_16 (x)
+#define be32(x) bswap_32 (x)
+#define to_be32(x) bswap_32 (x)
+#endif
+
#if CAIRO_HAS_SYMBOL_LOOKUP
#include "lookup-symbol.h"
#endif
@@ -1366,6 +1380,7 @@ _write_data_start (struct _data_stream *stream, uint32_t len)
_write_base85_data_start (stream);
_trace_printf ("<|");
+ len = to_be32 (len);
_write_base85_data (stream, (unsigned char *) &len, sizeof (len));
}