b6d7e4446453c3ab019b30024741247171a2f040 markd Mon Jun 29 20:04:40 2020 +0000 make sure data is 64-bit aligned, store offsets in headers to simplify diff --git src/inc/common.h src/inc/common.h index ff03488..2a33ab7 100644 --- src/inc/common.h +++ src/inc/common.h @@ -1182,30 +1182,35 @@ #define readOneFd(fd, var) (read((fd), &(var), sizeof(var)) == sizeof(var)) /* Read one variable from file. Returns FALSE if can't do it. */ #define mustReadOneFd(fd, var) mustReadFd((fd), &(var), sizeof(var)) /* Read one variable from file or die. */ #define memReadOne(pPt, var) memRead((pPt), &(var), sizeof(var)) /* Read one variable from memory. */ void writeString(FILE *f, char *s); /* Write a 255 or less character string to a file. * This will write the length of the string in the first * byte then the string itself. */ +void writeStringSafe(FILE *f, char *s); +/* Write a 255 or less character string to a file. Generate an error if + * longer. This will write the length of the string in the first byte then + * the string itself. */ + char *readString(FILE *f); /* Read a string (written with writeString) into * memory. freeMem the result when done. Returns * NULL at EOF. */ char *mustReadString(FILE *f); /* Read a string. Squawk and die at EOF or if any problem. */ boolean fastReadString(FILE *f, char buf[256]); /* Read a string into buffer, which must be long enough * to hold it. String is in 'writeString' format. * Returns FALSE at EOF. */ void msbFirstWriteBits64(FILE *f, bits64 x); /* Write out 64 bit number in manner that is portable across architectures */