summaryrefslogtreecommitdiff
path: root/apps/metadata/metadata_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/metadata/metadata_common.c')
-rw-r--r--apps/metadata/metadata_common.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/metadata/metadata_common.c b/apps/metadata/metadata_common.c
index 5947098f12..318399693c 100644
--- a/apps/metadata/metadata_common.c
+++ b/apps/metadata/metadata_common.c
@@ -124,6 +124,21 @@ int read_uint32be(int fd, uint32_t* buf)
124 *buf = betoh32(*buf); 124 *buf = betoh32(*buf);
125 return n; 125 return n;
126} 126}
127/* Read an unsigned 64-bit integer from a big-endian file. */
128int read_uint64be(int fd, uint64_t* buf)
129{
130 size_t n;
131 uint8_t data[8];
132 int i;
133
134 n = read(fd, data, 8);
135
136 for (i=0, *buf=0; i<=7; i++) {
137 *buf <<= 8;
138 *buf |= data[i];
139 }
140 return n;
141}
127#else 142#else
128/* Read unsigned integers from a little-endian file. */ 143/* Read unsigned integers from a little-endian file. */
129int read_uint16le(int fd, uint16_t* buf) 144int read_uint16le(int fd, uint16_t* buf)