|
From: <le...@pr...> - 2005-01-29 13:06:55
|
Update of /cvsroot/meshdb/src/mailt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1879 Modified Files: index.c Log Message: correct benign endian conversion direction; add explicit casts to mmap/munmap arguments Index: index.c =================================================================== RCS file: /cvsroot/meshdb/src/mailt/index.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- index.c 29 Jan 2005 04:37:45 -0000 1.4 +++ index.c 29 Jan 2005 13:06:46 -0000 1.5 @@ -126,13 +126,13 @@ return -1; /* Initialise the mail0 record */ m0 = (struct mail0 *)m; - m0->version = betoh32(MAIL0_VERSION); - m0->size = betoh32(sizeof (struct mail)); - m0->end = betoh64(0); - m0->date = betoh32(0); - m0->msgs = betoh32(1); - m0->child = betoh32(0); - m0->flags = betoh32(0); + m0->version = htobe32(MAIL0_VERSION); + m0->size = htobe32(sizeof (struct mail)); + m0->end = htobe64(0); + m0->date = htobe32(0); + m0->msgs = htobe32(1); + m0->child = htobe32(0); + m0->flags = htobe32(0); /* Unload the index */ index_unloadn(m, 1); return 0; @@ -147,7 +147,7 @@ void *base; int64_t end = betoh64(m0->end); - base = mmap(NULL, end, PROT_READ, MAP_PRIVATE, fd, 0); + base = mmap(NULL, (size_t)end, PROT_READ, MAP_PRIVATE, fd, 0); if (base == MAP_FAILED) { perror("mmap mbox"); return NULL; @@ -162,6 +162,6 @@ cstring_t base; { int64_t end = betoh64(m0->end); - if (munmap((void *)base, end)) + if (munmap((void *)base, (size_t)end)) perror("munmap mbox"); } |