summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrzemyslaw Pawelczyk <przemoc@gmail.com>2018-01-23 15:36:20 +0100
committerPrzemyslaw Pawelczyk <przemoc@gmail.com>2018-01-23 15:36:20 +0100
commit076fc6198041d58705c2decc3596d12910284bc4 (patch)
treef438907b9eb8d5bcbdd66dc79ee160ef7488577e
parent75c68929c302b7d3cca77c3cf542dd299d18394a (diff)
Fix documentation: integers are stored in little-endian byte order.
David misdocumented read/write int functions back in commit 5fed2f9169fdd0585cc83ff0fa8210d97da77cb2 (2007-05-19) and later it probably got copy-pasted to the documentation of file format.
-rw-r--r--FILEFORMAT2
-rw-r--r--src/utils.c4
-rw-r--r--src/utils.h4
3 files changed, 5 insertions, 5 deletions
diff --git a/FILEFORMAT b/FILEFORMAT
index fcd3d41..0fddf85 100644
--- a/FILEFORMAT
+++ b/FILEFORMAT
@@ -8,7 +8,7 @@ Following sections explain internals of metastore file (.metadata).
CSTRING = NUL-terminated binary string
BSTRING(N) = binary string of length N
- INT(N) = N byte integer in big endian byte order
+ INT(N) = N byte integer in little-endian byte order
### File layout
diff --git a/src/utils.c b/src/utils.c
index 4cba896..0485216 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -116,7 +116,7 @@ xfwrite(const void *ptr, size_t size, FILE *stream)
}
}
-/* Writes an int to a file, using len bytes, in bigendian order */
+/* Writes an int to a file, using len bytes, in little-endian order */
void
write_int(uint64_t value, size_t len, FILE *to)
{
@@ -142,7 +142,7 @@ write_string(const char *string, FILE *to)
xfwrite(string, strlen(string) + 1, to);
}
-/* Reads an int from a file, using len bytes, in bigendian order */
+/* Reads an int from a file, using len bytes, in little-endian order */
uint64_t
read_int(char **from, size_t len, const char *max)
{
diff --git a/src/utils.h b/src/utils.h
index 2dd61c9..b6e5958 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -57,7 +57,7 @@ void binary_print(const char *s, ssize_t len);
/* Writes data to a file or exits on failure */
void xfwrite(const void *ptr, size_t size, FILE *stream);
-/* Writes an int to a file, using len bytes, in bigendian order */
+/* Writes an int to a file, using len bytes, in little-endian order */
void write_int(uint64_t value, size_t len, FILE *to);
/* Writes a binary string to a file */
@@ -66,7 +66,7 @@ void write_binary_string(const char *string, size_t len, FILE *to);
/* Writes a normal C string to a file */
void write_string(const char *string, FILE *to);
-/* Reads an int from a file, using len bytes, in bigendian order */
+/* Reads an int from a file, using len bytes, in little-endian order */
uint64_t read_int(char **from, size_t len, const char *max);
/* Reads a binary string from a file */