Mercurial > octave
annotate libinterp/corefcn/c-file-ptr-stream.cc @ 23449:c763214a8260
maint: Use convention 'int *x' for naming pointers.
* mycell.c, myfeval.c, mypow2.c, myprop.c, myset.c, mystruct.c, Backend.cc,
Backend.h, BaseControl.cc, BaseControl.h, ButtonControl.cc, ButtonControl.h,
ButtonGroup.cc, ButtonGroup.h, Canvas.cc, Canvas.h, CheckBoxControl.cc,
CheckBoxControl.h, Container.cc, Container.h, ContextMenu.cc, ContextMenu.h,
EditControl.cc, EditControl.h, Figure.cc, Figure.h, FigureWindow.cc,
FigureWindow.h, GLCanvas.cc, GLCanvas.h, GenericEventNotify.h,
ListBoxControl.cc, ListBoxControl.h, Logger.cc, Logger.h, Menu.cc, Menu.h,
MenuContainer.h, MouseModeActionGroup.cc, MouseModeActionGroup.h, Object.cc,
Object.h, ObjectFactory.cc, ObjectFactory.h, ObjectProxy.cc, ObjectProxy.h,
Panel.cc, Panel.h, PopupMenuControl.cc, PopupMenuControl.h,
PushButtonControl.cc, PushButtonControl.h, PushTool.cc, PushTool.h,
QtHandlesUtils.cc, QtHandlesUtils.h, RadioButtonControl.cc,
RadioButtonControl.h, SliderControl.cc, SliderControl.h, TextControl.cc,
TextControl.h, TextEdit.cc, TextEdit.h, ToggleButtonControl.cc,
ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h, ToolBar.cc, ToolBar.h,
ToolBarButton.cc, ToolBarButton.h, color-picker.cc, file-editor-tab.cc,
file-editor.cc, file-editor.h, find-dialog.cc, find-dialog.h,
octave-qscintilla.cc, main-window.cc, main-window.h, octave-cmd.cc,
octave-dock-widget.cc, parser.cc, shortcut-manager.cc, workspace-view.cc,
__ichol__.cc, __ilu__.cc, __magick_read__.cc, c-file-ptr-stream.cc,
c-file-ptr-stream.h, cellfun.cc, data.cc, gl2ps-print.cc, graphics.cc,
graphics.in.h, ls-hdf5.cc, ls-hdf5.h, ls-mat5.cc, mex.h, oct-map.cc, oct-map.h,
oct-stream.cc, octave-link.cc, profiler.cc, profiler.h, psi.cc, qz.cc,
sighandlers.cc, symtab.h, txt-eng.h, zfstream.cc, zfstream.h, __init_fltk__.cc,
audiodevinfo.cc, gzip.cc, ov-class.cc, ov-classdef.cc, ov-classdef.h,
ov-dld-fcn.h, ov-fcn-inline.cc, ov-java.cc, ov-java.h, ov.cc, pt-arg-list.cc,
pt-array-list.cc, pt-bp.cc, pt-check.cc, pt-classdef.h, pt-decl.cc, pt-eval.cc,
pt-idx.cc, pt-idx.h, pt-jit.cc, pt-misc.cc, pt-pr-code.cc, pt-select.cc,
pt-stmt.cc, Array.cc, Array.h, CMatrix.cc, MSparse.cc, Sparse.h, dMatrix.cc,
dim-vector.h, fCMatrix.cc, fMatrix.cc, CollocWt.cc, bsxfun-defs.cc,
eigs-base.cc, gsvd.cc, gsvd.h, lo-lapack-proto.h, oct-norm.cc, randmtzig.cc,
svd.cc, svd.h, mx-inlines.cc, oct-binmap.h, oct-sort.cc, oct-sort.h,
oct-string.cc, oct-string.h, sparse-sort.cc, sparse-sort.h:
Use convention 'int *x' for naming pointers.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 27 Apr 2017 15:18:20 -0700 |
parents | 092078913d54 |
children | 980f39c3ab90 |
rev | line source |
---|---|
3628 | 1 /* |
2 | |
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
23083
diff
changeset
|
3 Copyright (C) 2000-2017 John W. Eaton |
3628 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
9 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
10 (at your option) any later version. |
3628 | 11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
15 GNU General Public License for more details. |
3628 | 16 |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
3628 | 20 |
21 */ | |
22 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21550
diff
changeset
|
23 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
24 # include "config.h" |
3628 | 25 #endif |
26 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
27 #include <iostream> |
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
28 |
21913
c0604bba8da1
provide wrappers for fseeko and ftello
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
29 #include "filepos-wrappers.h" |
c0604bba8da1
provide wrappers for fseeko and ftello
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
30 |
3629 | 31 #include "c-file-ptr-stream.h" |
3628 | 32 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21550
diff
changeset
|
33 #if ! defined (SEEK_SET) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
21184
diff
changeset
|
34 # define SEEK_SET 0 |
3628 | 35 #endif |
36 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21550
diff
changeset
|
37 #if ! defined (SEEK_CUR) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
21184
diff
changeset
|
38 # define SEEK_CUR 1 |
3628 | 39 #endif |
40 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21550
diff
changeset
|
41 #if ! defined (SEEK_END) |
21200
fcac5dbbf9ed
maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents:
21184
diff
changeset
|
42 # define SEEK_END 2 |
3628 | 43 #endif |
44 | |
3642 | 45 c_file_ptr_buf::~c_file_ptr_buf (void) |
46 { | |
10288
5e972e2deffe
avoid some possible gnulib #defines
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
47 buf_close (); |
3642 | 48 } |
3628 | 49 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
50 // FIXME: I'm sure there is room for improvement here... |
3628 | 51 |
3775 | 52 c_file_ptr_buf::int_type |
53 c_file_ptr_buf::overflow (int_type c) | |
3628 | 54 { |
3775 | 55 if (f) |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21913
diff
changeset
|
56 return (c != traits_type::eof ()) ? std::fputc (c, f) : flush (); |
3775 | 57 else |
58 return traits_type::not_eof (c); | |
3628 | 59 } |
60 | |
3775 | 61 c_file_ptr_buf::int_type |
4310 | 62 c_file_ptr_buf::underflow_common (bool bump) |
3628 | 63 { |
3644 | 64 if (f) |
4310 | 65 { |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21913
diff
changeset
|
66 int_type c = std::fgetc (f); |
4310 | 67 |
21183
e7fda94aec6b
eliminate OCTAVE_CXX_ISO_COMPLIANT_LIBRARY macro
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
68 if (! bump && c != traits_type::eof ()) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10288
diff
changeset
|
69 ungetc (c, f); |
4310 | 70 |
71 return c; | |
72 } | |
3644 | 73 else |
3775 | 74 return traits_type::eof (); |
3628 | 75 } |
76 | |
3775 | 77 c_file_ptr_buf::int_type |
78 c_file_ptr_buf::pbackfail (int_type c) | |
3628 | 79 { |
21183
e7fda94aec6b
eliminate OCTAVE_CXX_ISO_COMPLIANT_LIBRARY macro
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
80 return ((c != traits_type::eof () && f) |
e7fda94aec6b
eliminate OCTAVE_CXX_ISO_COMPLIANT_LIBRARY macro
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
81 ? ungetc (c, f) : traits_type::not_eof (c)); |
3628 | 82 } |
83 | |
84 std::streamsize | |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
85 c_file_ptr_buf::xsputn (const char *s, std::streamsize n) |
3628 | 86 { |
3644 | 87 if (f) |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21913
diff
changeset
|
88 return std::fwrite (s, 1, n, f); |
3644 | 89 else |
90 return 0; | |
3628 | 91 } |
92 | |
93 std::streamsize | |
94 c_file_ptr_buf::xsgetn (char *s, std::streamsize n) | |
95 { | |
3644 | 96 if (f) |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21913
diff
changeset
|
97 return std::fread (s, 1, n, f); |
3644 | 98 else |
99 return 0; | |
3628 | 100 } |
101 | |
102 static inline int | |
103 seekdir_to_whence (std::ios::seekdir dir) | |
104 { | |
21183
e7fda94aec6b
eliminate OCTAVE_CXX_ISO_COMPLIANT_LIBRARY macro
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
105 return (dir == std::ios::beg |
e7fda94aec6b
eliminate OCTAVE_CXX_ISO_COMPLIANT_LIBRARY macro
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
106 ? SEEK_SET : (dir == std::ios::cur |
e7fda94aec6b
eliminate OCTAVE_CXX_ISO_COMPLIANT_LIBRARY macro
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
107 ? SEEK_CUR : (dir == std::ios::end |
e7fda94aec6b
eliminate OCTAVE_CXX_ISO_COMPLIANT_LIBRARY macro
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
108 ? SEEK_END : dir))); |
3628 | 109 } |
110 | |
111 std::streampos | |
21550
7ebd8ac26178
Enable seekg and tellg on octave_stream (bug #47517)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21301
diff
changeset
|
112 c_file_ptr_buf::seekoff (std::streamoff offset, |
7ebd8ac26178
Enable seekg and tellg on octave_stream (bug #47517)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21301
diff
changeset
|
113 std::ios::seekdir dir, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10288
diff
changeset
|
114 std::ios::openmode) |
3628 | 115 { |
3644 | 116 if (f) |
117 { | |
21913
c0604bba8da1
provide wrappers for fseeko and ftello
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
118 octave_fseeko_wrapper (f, offset, seekdir_to_whence (dir)); |
3628 | 119 |
21913
c0604bba8da1
provide wrappers for fseeko and ftello
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
120 return octave_ftello_wrapper (f); |
3644 | 121 } |
122 else | |
123 return 0; | |
3628 | 124 } |
125 | |
126 std::streampos | |
21550
7ebd8ac26178
Enable seekg and tellg on octave_stream (bug #47517)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21301
diff
changeset
|
127 c_file_ptr_buf::seekpos (std::streampos offset, std::ios::openmode) |
3628 | 128 { |
3644 | 129 if (f) |
130 { | |
21913
c0604bba8da1
provide wrappers for fseeko and ftello
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
131 octave_fseeko_wrapper (f, offset, SEEK_SET); |
3628 | 132 |
21913
c0604bba8da1
provide wrappers for fseeko and ftello
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
133 return octave_ftello_wrapper (f); |
3644 | 134 } |
135 else | |
136 return 0; | |
3628 | 137 } |
138 | |
139 int | |
140 c_file_ptr_buf::sync (void) | |
141 { | |
3652 | 142 flush (); |
143 | |
3628 | 144 return 0; |
145 } | |
146 | |
3652 | 147 int |
148 c_file_ptr_buf::flush (void) | |
149 { | |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21913
diff
changeset
|
150 return f ? std::fflush (f) : traits_type::eof (); |
3652 | 151 } |
152 | |
153 int | |
10288
5e972e2deffe
avoid some possible gnulib #defines
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
154 c_file_ptr_buf::buf_close (void) |
3652 | 155 { |
3693 | 156 int retval = -1; |
157 | |
3716 | 158 flush (); |
159 | |
3652 | 160 if (f) |
3693 | 161 { |
3716 | 162 retval = cf (f); |
3693 | 163 f = 0; |
164 } | |
165 | |
166 return retval; | |
3652 | 167 } |
168 | |
10411 | 169 int |
16011
8122286c69a9
initial large file support for 32-bit systems
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
170 c_file_ptr_buf::seek (off_t offset, int origin) |
12927
f9c1f7c1ead0
maint: undo part of previous gnulib changes
John W. Eaton <jwe@octave.org>
parents:
12912
diff
changeset
|
171 { |
21913
c0604bba8da1
provide wrappers for fseeko and ftello
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
172 return f ? octave_fseeko_wrapper (f, offset, origin) : -1; |
12927
f9c1f7c1ead0
maint: undo part of previous gnulib changes
John W. Eaton <jwe@octave.org>
parents:
12912
diff
changeset
|
173 } |
f9c1f7c1ead0
maint: undo part of previous gnulib changes
John W. Eaton <jwe@octave.org>
parents:
12912
diff
changeset
|
174 |
16011
8122286c69a9
initial large file support for 32-bit systems
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
175 off_t |
12927
f9c1f7c1ead0
maint: undo part of previous gnulib changes
John W. Eaton <jwe@octave.org>
parents:
12912
diff
changeset
|
176 c_file_ptr_buf::tell (void) |
f9c1f7c1ead0
maint: undo part of previous gnulib changes
John W. Eaton <jwe@octave.org>
parents:
12912
diff
changeset
|
177 { |
21913
c0604bba8da1
provide wrappers for fseeko and ftello
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
178 return f ? octave_ftello_wrapper (f) : -1; |
12927
f9c1f7c1ead0
maint: undo part of previous gnulib changes
John W. Eaton <jwe@octave.org>
parents:
12912
diff
changeset
|
179 } |
f9c1f7c1ead0
maint: undo part of previous gnulib changes
John W. Eaton <jwe@octave.org>
parents:
12912
diff
changeset
|
180 |
f9c1f7c1ead0
maint: undo part of previous gnulib changes
John W. Eaton <jwe@octave.org>
parents:
12912
diff
changeset
|
181 int |
10411 | 182 c_file_ptr_buf::file_close (FILE *f) |
183 { | |
21942
aab79a1885cc
limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents:
21913
diff
changeset
|
184 return std::fclose (f); |
10411 | 185 } |
186 | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21550
diff
changeset
|
187 #if defined (HAVE_ZLIB) |
5325 | 188 |
189 c_zfile_ptr_buf::~c_zfile_ptr_buf (void) | |
190 { | |
10288
5e972e2deffe
avoid some possible gnulib #defines
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
191 buf_close (); |
5325 | 192 } |
193 | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
194 // FIXME: I'm sure there is room for improvement here... |
5325 | 195 |
196 c_zfile_ptr_buf::int_type | |
197 c_zfile_ptr_buf::overflow (int_type c) | |
198 { | |
199 if (f) | |
200 return (c != traits_type::eof ()) ? gzputc (f, c) : flush (); | |
201 else | |
202 return traits_type::not_eof (c); | |
203 } | |
204 | |
205 c_zfile_ptr_buf::int_type | |
206 c_zfile_ptr_buf::underflow_common (bool bump) | |
207 { | |
208 if (f) | |
209 { | |
210 int_type c = gzgetc (f); | |
211 | |
21183
e7fda94aec6b
eliminate OCTAVE_CXX_ISO_COMPLIANT_LIBRARY macro
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
212 if (! bump && c != traits_type::eof ()) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10288
diff
changeset
|
213 gzungetc (c, f); |
5325 | 214 |
215 return c; | |
216 } | |
217 else | |
218 return traits_type::eof (); | |
219 } | |
220 | |
221 c_zfile_ptr_buf::int_type | |
222 c_zfile_ptr_buf::pbackfail (int_type c) | |
223 { | |
21183
e7fda94aec6b
eliminate OCTAVE_CXX_ISO_COMPLIANT_LIBRARY macro
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
224 return ((c != traits_type::eof () && f) |
e7fda94aec6b
eliminate OCTAVE_CXX_ISO_COMPLIANT_LIBRARY macro
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
225 ? gzungetc (c, f) : traits_type::not_eof (c)); |
5325 | 226 } |
227 | |
228 std::streamsize | |
23449
c763214a8260
maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
229 c_zfile_ptr_buf::xsputn (const char *s, std::streamsize n) |
5325 | 230 { |
231 if (f) | |
232 return gzwrite (f, s, n); | |
233 else | |
234 return 0; | |
235 } | |
236 | |
237 std::streamsize | |
238 c_zfile_ptr_buf::xsgetn (char *s, std::streamsize n) | |
239 { | |
240 if (f) | |
241 return gzread (f, s, n); | |
242 else | |
243 return 0; | |
244 } | |
245 | |
246 std::streampos | |
8802
061780d8da1e
c-file-ptr-stream.cc: avoid unused parameter warnings
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
247 c_zfile_ptr_buf::seekoff (std::streamoff /* offset */, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10288
diff
changeset
|
248 std::ios::seekdir /* dir */, |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10288
diff
changeset
|
249 std::ios::openmode) |
5325 | 250 { |
5775 | 251 // FIXME |
5325 | 252 #if 0 |
253 if (f) | |
254 { | |
255 gzseek (f, offset, seekdir_to_whence (dir)); | |
256 | |
257 return gztell (f); | |
258 } | |
259 else | |
260 return 0; | |
261 #endif | |
262 return -1; | |
263 } | |
264 | |
265 std::streampos | |
8802
061780d8da1e
c-file-ptr-stream.cc: avoid unused parameter warnings
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
266 c_zfile_ptr_buf::seekpos (std::streampos /* offset */, std::ios::openmode) |
5325 | 267 { |
5775 | 268 // FIXME |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
269 #if 0 |
5325 | 270 if (f) |
271 { | |
272 gzseek (f, offset, SEEK_SET); | |
273 | |
274 return gztell (f); | |
275 } | |
276 else | |
277 return 0; | |
278 #endif | |
279 return -1; | |
280 } | |
281 | |
282 int | |
283 c_zfile_ptr_buf::sync (void) | |
284 { | |
285 flush (); | |
286 | |
287 return 0; | |
288 } | |
289 | |
290 int | |
291 c_zfile_ptr_buf::flush (void) | |
292 { | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
293 // FIXME: do we need something more complex here, passing |
5325 | 294 // something other than 0 for the second argument to gzflush and |
295 // checking the return value, etc.? | |
296 | |
21184
3db899f1d54c
use istream::traits_type::eof () instead of EOF
John W. Eaton <jwe@octave.org>
parents:
21183
diff
changeset
|
297 return f ? gzflush (f, 0) : traits_type::eof (); |
5325 | 298 } |
299 | |
300 int | |
10288
5e972e2deffe
avoid some possible gnulib #defines
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
301 c_zfile_ptr_buf::buf_close (void) |
5325 | 302 { |
303 int retval = -1; | |
304 | |
305 flush (); | |
306 | |
307 if (f) | |
308 { | |
309 retval = cf (f); | |
310 f = 0; | |
311 } | |
312 | |
313 return retval; | |
314 } | |
315 | |
316 #endif |