#include "tpl.h" #include #include #include #include #include #include #include #include #define SUM_LENGTH 16 #define MS_COUNT 9 struct sum_buf { int64_t offset; int len; uint32_t sum1; int chain; uint16_t flags; char sum2[SUM_LENGTH]; }; struct sum_struct { int64_t flength; struct sum_buf *sums; int count; int blength; int remainder; int s2length; }; const char *filename = "/tmp/test106.tpl"; int pack(int use_fd) { tpl_node *tn; struct sum_struct ms; int fd=-1,j; unsigned perms; perms = S_IRUSR|S_IWUSR; if (use_fd) { if ( (fd=open( filename,O_WRONLY|O_CREAT,perms)) == -1) { printf("failed to open %s: %s", filename, strerror(errno)); return(-1); } } ms.flength = 1000; ms.count = MS_COUNT; ms.blength = 23; ms.remainder = 43; ms.s2length = 16; ms.sums = (struct sum_buf*) malloc((sizeof(struct sum_buf))*ms.count); for(j=0;j