Boost logo

Boost :

From: Rupert Kittinger (rkit_at_[hidden])
Date: 2005-08-24 14:41:32


In the tuple_io.hpp header, there seems to be a slight problem in
extract_and_check_delimiter(). The following snippet is problematic:

char c;
if (is_delimiter) {
    is >> c;
    if (c!=d) {
      is.setstate(std::ios::failbit);
    }
}

If c cannot be read because is.eof(), the result of c!=d is undefined.

A simple fix is attached.

cheers,
Rupert

-- 
Rupert Kittinger <rkit_at_[hidden]>

*** tuple_io.hpp.orig Wed Aug 24 21:05:26 2005
--- tuple_io.hpp Wed Aug 24 21:07:13 2005
***************
*** 349,355 ****
    char c;
    if (is_delimiter) {
      is >> c;
! if (c!=d) {
        is.setstate(std::ios::failbit);
      }
    }
--- 349,355 ----
    char c;
    if (is_delimiter) {
      is >> c;
! if (is.good() && c!=d) {
        is.setstate(std::ios::failbit);
      }
    }
***************
*** 443,449 ****
    CharType c;
    if (is_delimiter) {
      is >> c;
! if (c!=d) {
        is.setstate(std::ios::failbit);
      }
    }
--- 443,449 ----
    CharType c;
    if (is_delimiter) {
      is >> c;
! if (is.good() && c!=d) {
        is.setstate(std::ios::failbit);
      }
    }


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk