aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2017-07-19 16:46:04 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2017-07-19 16:46:04 +0100
commite020783cd60ae60a361cd18f1a3763f65f30b0b8 (patch)
treef21ea14f429bc3dc0deb112bcd18d73b7a997dae
parent8f860bca0072af4f012e6640f1befa9bb02f4ed5 (diff)
downloadgcc-e020783cd60ae60a361cd18f1a3763f65f30b0b8.zip
gcc-e020783cd60ae60a361cd18f1a3763f65f30b0b8.tar.gz
gcc-e020783cd60ae60a361cd18f1a3763f65f30b0b8.tar.bz2
Fix indentation in std::basic_filebuf member functions
* include/bits/fstream.tcc (basic_filebuf::xsgetn) (basic_filebuf::xsputn, basic_filebuf::seekoff): Fix indentation. From-SVN: r250353
-rw-r--r--libstdc++-v3/ChangeLog3
-rw-r--r--libstdc++-v3/include/bits/fstream.tcc110
2 files changed, 57 insertions, 56 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index a6ed3c9..9ac3fca 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,8 @@
2017-07-19 Jonathan Wakely <jwakely@redhat.com>
+ * include/bits/fstream.tcc (basic_filebuf::xsgetn)
+ (basic_filebuf::xsputn, basic_filebuf::seekoff): Fix indentation.
+
* testsuite/util/testsuite_iterators.h: Fix indentation.
* testsuite/27_io/basic_filebuf/sgetn/char/81395.cc: Add dg-require.
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc
index ef51a84..12ea977 100644
--- a/libstdc++-v3/include/bits/fstream.tcc
+++ b/libstdc++-v3/include/bits/fstream.tcc
@@ -649,11 +649,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
else if (_M_writing)
{
- if (overflow() == traits_type::eof())
- return __ret;
- _M_set_buffer(-1);
- _M_writing = false;
- }
+ if (overflow() == traits_type::eof())
+ return __ret;
+ _M_set_buffer(-1);
+ _M_writing = false;
+ }
// Optimization in the always_noconv() case, to be generalized in the
// future: when __n > __buflen we read directly instead of using the
@@ -662,57 +662,55 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const streamsize __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1;
if (__n > __buflen && __check_facet(_M_codecvt).always_noconv()
- && __testin)
- {
- // First, copy the chars already present in the buffer.
- const streamsize __avail = this->egptr() - this->gptr();
- if (__avail != 0)
- {
- traits_type::copy(__s, this->gptr(), __avail);
- __s += __avail;
- this->setg(this->eback(), this->gptr() + __avail,
- this->egptr());
- __ret += __avail;
- __n -= __avail;
- }
-
- // Need to loop in case of short reads (relatively common
- // with pipes).
- streamsize __len;
- for (;;)
- {
- __len = _M_file.xsgetn(reinterpret_cast<char*>(__s),
- __n);
- if (__len == -1)
- __throw_ios_failure(__N("basic_filebuf::xsgetn "
- "error reading the file"));
- if (__len == 0)
- break;
-
- __n -= __len;
- __ret += __len;
- if (__n == 0)
- break;
+ && __testin)
+ {
+ // First, copy the chars already present in the buffer.
+ const streamsize __avail = this->egptr() - this->gptr();
+ if (__avail != 0)
+ {
+ traits_type::copy(__s, this->gptr(), __avail);
+ __s += __avail;
+ this->setg(this->eback(), this->gptr() + __avail, this->egptr());
+ __ret += __avail;
+ __n -= __avail;
+ }
- __s += __len;
- }
+ // Need to loop in case of short reads (relatively common
+ // with pipes).
+ streamsize __len;
+ for (;;)
+ {
+ __len = _M_file.xsgetn(reinterpret_cast<char*>(__s), __n);
+ if (__len == -1)
+ __throw_ios_failure(__N("basic_filebuf::xsgetn "
+ "error reading the file"));
+ if (__len == 0)
+ break;
- if (__n == 0)
- {
- // Set _M_reading. Buffer is already in initial 'read' mode.
- _M_reading = true;
- }
- else if (__len == 0)
- {
- // If end of file is reached, set 'uncommitted'
- // mode, thus allowing an immediate write without
- // an intervening seek.
- _M_set_buffer(-1);
- _M_reading = false;
- }
- }
+ __n -= __len;
+ __ret += __len;
+ if (__n == 0)
+ break;
+
+ __s += __len;
+ }
+
+ if (__n == 0)
+ {
+ // Set _M_reading. Buffer is already in initial 'read' mode.
+ _M_reading = true;
+ }
+ else if (__len == 0)
+ {
+ // If end of file is reached, set 'uncommitted'
+ // mode, thus allowing an immediate write without
+ // an intervening seek.
+ _M_set_buffer(-1);
+ _M_reading = false;
+ }
+ }
else
- __ret += __streambuf_type::xsgetn(__s, __n);
+ __ret += __streambuf_type::xsgetn(__s, __n);
return __ret;
}
@@ -729,7 +727,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const bool __testout = (_M_mode & ios_base::out
|| _M_mode & ios_base::app);
if (__check_facet(_M_codecvt).always_noconv()
- && __testout && !_M_reading)
+ && __testout && !_M_reading)
{
// Measurement would reveal the best choice.
const streamsize __chunk = 1ul << 10;
@@ -839,8 +837,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (_M_writing)
__computed_off = this->pptr() - this->pbase();
- off_type __file_off = _M_file.seekoff(0, ios_base::cur);
- if (__file_off != off_type(-1))
+ off_type __file_off = _M_file.seekoff(0, ios_base::cur);
+ if (__file_off != off_type(-1))
{
__ret = __file_off + __computed_off;
__ret.state(__state);