Add scm_t_off' type so that scm_t_port' has a fixed layout.
* libguile/gen-scmconfig.c (main): Produce a definition for `scm_t_off'. * libguile/ports.h (scm_t_port)[read_buf_size, saved_read_buf_size, write_buf_size, seek, truncate]: Use `scm_t_off' instead of `off_t' so that the layout and size of the structure does not depend on the application's `_FILE_OFFSET_BITS' value. Reported by Bill Schottstaedt, see http://lists.gnu.org/archive/html/bug-guile/2009-06/msg00018.html. (scm_set_port_seek, scm_set_port_truncate): Update. * libguile/ports.c (scm_set_port_seek, scm_set_port_truncate): Use `scm_t_off' and `off_t_or_off64_t'. * libguile/fports.c (fport_seek, fport_truncate): Use `scm_t_off' instead of `off_t'. * libguile/r6rs-ports.c (bip_seek, cbp_seek, bop_seek): Use `scm_t_off' instead of `off_t'. * libguile/rw.c (scm_write_string_partial): Likewise. * libguile/strports.c (st_resize_port, st_seek, st_truncate): Likewise. * doc/ref/api-io.texi (Port Implementation): Update prototype of `scm_set_port_seek ()' and `scm_set_port_truncate ()'. * NEWS: Update.
This commit is contained in:
parent
376b6bd7a2
commit
f1ce919933
9 changed files with 66 additions and 46 deletions
|
|
@ -400,6 +400,24 @@ main (int argc, char *argv[])
|
|||
pf ("#define SCM_HAVE_READDIR64_R 0 /* 0 or 1 */\n");
|
||||
#endif
|
||||
|
||||
/* Arrange so that we have a file offset type that reflects the one
|
||||
used when compiling Guile, regardless of what the application's
|
||||
`_FILE_OFFSET_BITS' says. See
|
||||
http://lists.gnu.org/archive/html/bug-guile/2009-06/msg00018.html
|
||||
for the original bug report.
|
||||
|
||||
Note that we can't define `scm_t_off' in terms of `off_t' or
|
||||
`off64_t' because they may or may not be available depending on
|
||||
how the application that uses Guile is compiled. */
|
||||
|
||||
#if defined GUILE_USE_64_CALLS && defined HAVE_STAT64
|
||||
pf ("typedef scm_t_int64 scm_t_off;\n");
|
||||
#elif SIZEOF_OFF_T == SIZEOF_INT
|
||||
pf ("typedef int scm_t_off;\n");
|
||||
#else
|
||||
pf ("typedef long int scm_t_off;\n");
|
||||
#endif
|
||||
|
||||
#if USE_DLL_IMPORT
|
||||
pf ("\n");
|
||||
pf ("/* Define some additional CPP macros on Win32 platforms. */\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue