Annotation of pkgsrc/math/octave/patches/patch-fseeko-fpos_t.c, Revision 1.2
1.2 ! dbj 1: $NetBSD: patch-fseeko-fpos_t.c,v 1.1 2012/03/23 22:32:59 christos Exp $
1.1 christos 2:
1.2 ! dbj 3: --- libgnu/fseeko.c.orig 2015-05-23 14:36:16.000000000 +0000
! 4: +++ libgnu/fseeko.c
! 5: @@ -22,6 +22,9 @@
! 6: /* Get off_t, lseek, _POSIX_VERSION. */
1.1 christos 7: #include <unistd.h>
8:
9: +/* mem* */
10: +#include <string.h>
11: +
12: #include "stdio-impl.h"
13:
14: int
1.2 ! dbj 15: @@ -132,19 +135,12 @@ fseeko (FILE *fp, off_t offset, int when
1.1 christos 16: /* fp_->_offset is typed as an integer. */
17: fp_->_offset = pos;
18: # else
19: - /* fp_->_offset is an fpos_t. */
20: - {
21: - /* Use a union, since on NetBSD, the compilation flags
22: - determine whether fpos_t is typedef'd to off_t or a struct
23: - containing a single off_t member. */
24: - union
25: - {
26: - fpos_t f;
27: - off_t o;
28: - } u;
29: - u.o = pos;
30: - fp_->_offset = u.f;
31: - }
32: + /*
33: + * fp_->_offset is an fpos_t or off_t
34: + * in either case the off_t part is the first member of it.
35: + */
36: + memset(&fp_->_offset, 0, sizeof(fp_->_offset));
37: + memcpy(&fp_->_offset, &pos, sizeof(pos));
38: # endif
39: fp_->_flags |= __SOFF;
40: fp_->_flags &= ~__SEOF;
CVSweb <webmaster@jp.NetBSD.org>