Mercurial > hg > octave-jordi
changeset 12957:fb69561e5901 stable
maint: fix missing line continuation in src/Makefile.am
* src/Makefile.am (OCTAVE_LIBS): Fix missing line continuation
for !AMCOND_ENABLE_DYNAMIC_LINKING case.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 12 Aug 2011 14:05:48 -0400 |
parents | 5cc3b7673d25 |
children | ae88a81e5d5c 18797a4b6174 |
files | src/Makefile.am src/oct-stream.cc |
diffstat | 2 files changed, 35 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Makefile.am +++ b/src/Makefile.am @@ -539,7 +539,7 @@ ../libcruft/libcruft.la \ ../libcruft/libranlib.la \ ../libgnu/libgnu.la \ - $(FFTW_XLDFLAGS) $(FFTW_XLIBS) + $(FFTW_XLDFLAGS) $(FFTW_XLIBS) \ $(QHULL_LDFLAGS) $(QHULL_LIBS) \ $(QRUPDATE_LDFLAGS) $(QRUPDATE_LIBS) \ $(SPARSE_XLDFLAGS) $(SPARSE_XLIBS) \
--- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -3002,38 +3002,51 @@ { clearerr (); + // Find current position so we can return to it if needed. + long orig_pos = rep->tell (); - status = rep->seek (offset, origin); + // Move to end of file. If successful, find the offset of the end. + + status = rep->seek (0, SEEK_END); if (status == 0) { - long save_pos = rep->tell (); - - rep->seek (0, SEEK_END); - - long pos_eof = rep->tell (); - - // I don't think save_pos can be less than zero, but we'll - // check anyway... - - if (save_pos > pos_eof || save_pos < 0) + long eof_pos = rep->tell (); + + // Attempt to move to desired position; may be outside bounds + // of existing file. + + status = rep->seek (offset, origin); + + if (status == 0) { - // Seek outside bounds of file. Failure should leave - // position unchanged. + // Where are we after moving to desired position? + + long desired_pos = rep->tell (); + + // I don't think desired_pos can be less than zero, but + // we'll check anyway... + + if (desired_pos > eof_pos || desired_pos < 0) + { + // Seek outside bounds of file. Failure should leave + // position unchanged. + + rep->seek (orig_pos, SEEK_SET); + + status = -1; + } + } + else + { + // Seeking to the desired position failed. Move back to + // original position and return failure status. rep->seek (orig_pos, SEEK_SET); status = -1; } - else - { - // Is it possible for this to fail? We are just - // returning to a position after the first successful - // seek. - - rep->seek (save_pos, SEEK_SET); - } } }