comparison libfdproto/messages.c @ 792:0f566e550813

improved the previous fix... not sure it was correct
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 12 Jul 2012 22:37:32 +0200
parents 42fa209a8cc4
children c5b7d4a2cc77
comparison
equal deleted inserted replaced
791:42fa209a8cc4 792:0f566e550813
1324 } 1324 }
1325 1325
1326 /* The location is not on 64b boundary, so we split the writing in two operations to avoid sigbus */ 1326 /* The location is not on 64b boundary, so we split the writing in two operations to avoid sigbus */
1327 #define PUT_in_buf_64( _u64data, _bufptr ) { \ 1327 #define PUT_in_buf_64( _u64data, _bufptr ) { \
1328 uint64_t __v = htonll((uint64_t)(_u64data)); \ 1328 uint64_t __v = htonll((uint64_t)(_u64data)); \
1329 *(uint32_t *)(_bufptr) = (uint32_t)(__v); \ 1329 memcpy(_bufptr, &__v, sizeof(__v)); \
1330 *(((uint32_t *)(_bufptr))+1) = (uint32_t)(__v >> 32); \
1331 } 1330 }
1332 1331
1333 /* Write a message header in the buffer */ 1332 /* Write a message header in the buffer */
1334 static int bufferize_msg(unsigned char * buffer, size_t buflen, size_t * offset, struct msg * msg) 1333 static int bufferize_msg(unsigned char * buffer, size_t buflen, size_t * offset, struct msg * msg)
1335 { 1334 {
"Welcome to our mercurial repository"