comparison libinterp/corefcn/c-file-ptr-stream.cc @ 21550:7ebd8ac26178

Enable seekg and tellg on octave_stream (bug #47517) * c-file-ptr-stream.cc (c_file_ptr_buf::seekoff, c_file_ptr_buf::seekpos): remove "#if 0" and replace fseek by fseeko and ftell by ftello.
author Lachlan Andrew <lachlanbis@gmail.com>
date Sun, 14 Feb 2016 10:12:30 +1100
parents 40de9f8f23a6
children aba2e6293dd8
comparison
equal deleted inserted replaced
21549:17845d0e359f 21550:7ebd8ac26178
105 ? SEEK_CUR : (dir == std::ios::end 105 ? SEEK_CUR : (dir == std::ios::end
106 ? SEEK_END : dir))); 106 ? SEEK_END : dir)));
107 } 107 }
108 108
109 std::streampos 109 std::streampos
110 c_file_ptr_buf::seekoff (std::streamoff /* offset */, 110 c_file_ptr_buf::seekoff (std::streamoff offset,
111 std::ios::seekdir /* dir */, 111 std::ios::seekdir dir,
112 std::ios::openmode) 112 std::ios::openmode)
113 { 113 {
114 // FIXME 114 if (f)
115 #if 0 115 {
116 if (f) 116 gnulib::fseeko (f, offset, seekdir_to_whence (dir));
117 { 117
118 fseek (f, offset, seekdir_to_whence (dir)); 118 return gnulib::ftello (f);
119 119 }
120 return ftell (f); 120 else
121 } 121 return 0;
122 else
123 return 0;
124 #endif
125 return -1;
126 } 122 }
127 123
128 std::streampos 124 std::streampos
129 c_file_ptr_buf::seekpos (std::streampos /* offset */, std::ios::openmode) 125 c_file_ptr_buf::seekpos (std::streampos offset, std::ios::openmode)
130 { 126 {
131 // FIXME 127 if (f)
132 #if 0 128 {
133 if (f) 129 gnulib::fseeko (f, offset, SEEK_SET);
134 { 130
135 fseek (f, offset, SEEK_SET); 131 return gnulib::ftello (f);
136 132 }
137 return ftell (f); 133 else
138 } 134 return 0;
139 else
140 return 0;
141 #endif
142 return -1;
143 } 135 }
144 136
145 int 137 int
146 c_file_ptr_buf::sync (void) 138 c_file_ptr_buf::sync (void)
147 { 139 {