@@ -434,6 +434,12 @@ bool_t xdr_set_gdl_pos(XDR *x, long int y){
434
434
return xdr_get_gdl_pos (xdrs); // end of header
435
435
}
436
436
437
+ union U
438
+ {
439
+ u_int32_t trentedeux[2 ];
440
+ u_int64_t soixantequatre;
441
+ };
442
+
437
443
inline u_int64_t updateNewRecordHeader (XDR *xdrs, u_int64_t cur) {
438
444
u_int64_t next = xdr_get_gdl_pos (xdrs);
439
445
// dirty trick for compression: write uncompressed, rewind, read what was just written, compress, write over, reset positions.
@@ -457,18 +463,18 @@ bool_t xdr_set_gdl_pos(XDR *x, long int y){
457
463
}
458
464
xdr_set_gdl_pos (xdrs, cur-12 ); // ptrs0
459
465
// copy next (64 bit) as two 32 bits. Should be OK on 32 bit machines as next is u_int64.
460
- if (BigEndian ()) { // first 32 bit is low, second high (XDRS is BigEndian)
461
- xdr_uint64_t (xdrs, &next);
462
- } else {
463
- u_int32_t first,second;
464
- first = ((u_int32_t *) &next)[0 ];
465
- second = ((u_int32_t *) &next)[1 ];
466
- xdr_uint32_t (xdrs, &first);
467
- xdr_uint32_t (xdrs, &second);
466
+ if (!BigEndian ()) { // first 32 bit is low, second high (XDRS is BigEndian)
467
+ U u;
468
+ u.soixantequatre =next;
469
+ u_int32_t temp=u.trentedeux [0 ];
470
+ u.trentedeux [0 ]=u.trentedeux [1 ];
471
+ u.trentedeux [1 ]=temp;
472
+ next=u.soixantequatre ;
468
473
}
474
+ xdr_uint64_t (xdrs, &next);
469
475
xdr_set_gdl_pos (xdrs, next);
470
476
return next;
471
- }
477
+ }
472
478
473
479
u_int64_t writeTimeUserHost (XDR *xdrs, char * FileDatestring, char * FileUser, char * FileHost) {
474
480
u_int64_t cur=writeNewRecordHeader (xdrs, TIMESTAMP);
0 commit comments