# HG changeset patch # User John W. Eaton # Date 1466015357 14400 # Node ID c0604bba8da14e3400fea1e33063370595d5af31 # Parent d92dcbcd7691191d3974565279489aa046207041 provide wrappers for fseeko and ftello * liboctave/wrappers/filepos-wrappers.c, liboctave/wrappers/filepos-wrappers.h: New files. * liboctave/wrappers/module.mk: Update. * c-file-ptr-stream.cc: Use new wrapper functions. diff -r d92dcbcd7691 -r c0604bba8da1 libinterp/corefcn/c-file-ptr-stream.cc --- a/libinterp/corefcn/c-file-ptr-stream.cc Wed Jun 15 12:59:43 2016 -0400 +++ b/libinterp/corefcn/c-file-ptr-stream.cc Wed Jun 15 14:29:17 2016 -0400 @@ -26,6 +26,8 @@ #include +#include "filepos-wrappers.h" + #include "c-file-ptr-stream.h" #if ! defined (SEEK_SET) @@ -113,9 +115,9 @@ { if (f) { - gnulib::fseeko (f, offset, seekdir_to_whence (dir)); + octave_fseeko_wrapper (f, offset, seekdir_to_whence (dir)); - return gnulib::ftello (f); + return octave_ftello_wrapper (f); } else return 0; @@ -126,9 +128,9 @@ { if (f) { - gnulib::fseeko (f, offset, SEEK_SET); + octave_fseeko_wrapper (f, offset, SEEK_SET); - return gnulib::ftello (f); + return octave_ftello_wrapper (f); } else return 0; @@ -167,13 +169,13 @@ int c_file_ptr_buf::seek (off_t offset, int origin) { - return f ? gnulib::fseeko (f, offset, origin) : -1; + return f ? octave_fseeko_wrapper (f, offset, origin) : -1; } off_t c_file_ptr_buf::tell (void) { - return f ? gnulib::ftello (f) : -1; + return f ? octave_ftello_wrapper (f) : -1; } int diff -r d92dcbcd7691 -r c0604bba8da1 liboctave/wrappers/filepos-wrappers.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/filepos-wrappers.c Wed Jun 15 14:29:17 2016 -0400 @@ -0,0 +1,46 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +. + +*/ + +// ftello and fseeko may be provided by gnulib. We don't include gnulib +// headers directly in Octave's C++ source files to avoid problems that +// may be caused by the way that gnulib overrides standard library +// functions. + +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + +#include + +#include "filepos-wrappers.h" + +int +octave_fseeko_wrapper (FILE *fp, off_t offset, int whence) +{ + return fseeko (fp, offset, whence); +} + +off_t +octave_ftello_wrapper (FILE *fp) +{ + return ftello (fp); +} diff -r d92dcbcd7691 -r c0604bba8da1 liboctave/wrappers/filepos-wrappers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/wrappers/filepos-wrappers.h Wed Jun 15 14:29:17 2016 -0400 @@ -0,0 +1,46 @@ +/* + +Copyright (C) 2016 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +. + +*/ + +#if ! defined (octave_filepos_wrappers_h) +#define octave_filepos_wrappers_h 1 + +#include + +#if defined __cplusplus +# include +#else +# include +#endif + +#if defined __cplusplus +extern "C" { +#endif + +extern int octave_fseeko_wrapper (FILE *fp, off_t offset, int whence); + +extern off_t octave_ftello_wrapper (FILE *fp); + +#if defined __cplusplus +} +#endif + +#endif diff -r d92dcbcd7691 -r c0604bba8da1 liboctave/wrappers/module.mk --- a/liboctave/wrappers/module.mk Wed Jun 15 12:59:43 2016 -0400 +++ b/liboctave/wrappers/module.mk Wed Jun 15 14:29:17 2016 -0400 @@ -3,6 +3,7 @@ liboctave/wrappers/base64-wrappers.h \ liboctave/wrappers/canonicalize-file-name-wrapper.h \ liboctave/wrappers/fcntl-wrappers.h \ + liboctave/wrappers/filepos-wrappers.h \ liboctave/wrappers/fpucw-wrapper.h \ liboctave/wrappers/gen-tempname-wrapper.h \ liboctave/wrappers/hash-wrappers.h \ @@ -27,6 +28,7 @@ liboctave/wrappers/base64-wrappers.c \ liboctave/wrappers/canonicalize-file-name-wrapper.c \ liboctave/wrappers/fcntl-wrappers.c \ + liboctave/wrappers/filepos-wrappers.c \ liboctave/wrappers/fpucw-wrapper.c \ liboctave/wrappers/gen-tempname-wrapper.c \ liboctave/wrappers/hash-wrappers.c \