Hi, Neil Jerram writes: > ludo@gnu.org (Ludovic Courtès) writes: > >> The attached patch adds a new `scm_t_off' type, whose definition does >> not depend on the application's `_FILE_OFFSET_BITS' value. Can you >> confirm that it allows you to build Guile with 32-bit offsets and Snd >> with 64-bit offsets (or vice versa)? >> >> Neil: Does this sound like the right approach? > > Yes, this looks great. (In case it makes a difference, I've reviewed > the master commit, not the patch that you put in email.) Perfect, thank you! > Also I think it means that we can delete some code that was needed to > handle the possibility that off_t might be 32-bit on a platform that > also supports large files. > > - In scm_seek (), the "if (SCM_OPFPORTP (fd_port))" block is now not > needed, because the following more general "if (SCM_OPPORTP > (fd_port))" case will handle 64-bit correctly. > > - Therefore scm_i_fport_seek () can be removed. > > - The "#if GUILE_USE_64_CALLS && HAVE_STAT64 && SIZEOF_OFF_T != > SIZEOF_OFF64_T" implementation of fport_seek () can be removed, > because fport_seek () is now always identical to > fport_seek_or_seek64 (). > > - Plus the same things again but for "truncate" instead of "seek". Also: - `scm_t_off' and `off_t_or_off64_t' are now identical, so the latter could be removed. > Would you agree? Yes. What do you think of the attached patch? On my GNU/Linux machine where 64-bit offsets are used, I see this: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (open-input-file "/dev/zero") $1 = # scheme@(guile-user)> (seek $1 (expt 2 33) SEEK_SET) $2 = 0 --8<---------------cut here---------------end--------------->8--- I can't think of a better test case, though. Thanks, Ludo'.