Whitespace changes.

This commit is contained in:
John Wiegley 2005-02-15 03:32:00 +00:00
parent 7a48610f42
commit 4faed720b5
2 changed files with 48 additions and 48 deletions

View file

@ -67,19 +67,19 @@ class fdoutbuf : public std::streambuf {
protected: protected:
// write one character // write one character
virtual int_type overflow (int_type c) { virtual int_type overflow (int_type c) {
if (c != EOF) { if (c != EOF) {
char z = c; char z = c;
if (write (fd, &z, 1) != 1) { if (write (fd, &z, 1) != 1) {
return EOF; return EOF;
} }
} }
return c; return c;
} }
// write multiple characters // write multiple characters
virtual virtual
std::streamsize xsputn (const char* s, std::streamsize xsputn (const char* s,
std::streamsize num) { std::streamsize num) {
return write(fd,s,num); return write(fd,s,num);
} }
}; };
@ -88,7 +88,7 @@ class fdostream : public std::ostream {
fdoutbuf buf; fdoutbuf buf;
public: public:
fdostream (int fd) : std::ostream(0), buf(fd) { fdostream (int fd) : std::ostream(0), buf(fd) {
rdbuf(&buf); rdbuf(&buf);
} }
}; };
@ -118,54 +118,54 @@ class fdinbuf : public std::streambuf {
* => force underflow() * => force underflow()
*/ */
fdinbuf (int _fd) : fd(_fd) { fdinbuf (int _fd) : fd(_fd) {
setg (buffer+pbSize, // beginning of putback area setg (buffer+pbSize, // beginning of putback area
buffer+pbSize, // read position buffer+pbSize, // read position
buffer+pbSize); // end position buffer+pbSize); // end position
} }
protected: protected:
// insert new characters into the buffer // insert new characters into the buffer
virtual int_type underflow () { virtual int_type underflow () {
#ifndef _MSC_VER #ifndef _MSC_VER
using std::memmove; using std::memmove;
#endif #endif
// is read position before end of buffer? // is read position before end of buffer?
if (gptr() < egptr()) { if (gptr() < egptr()) {
return traits_type::to_int_type(*gptr()); return traits_type::to_int_type(*gptr());
} }
/* process size of putback area /* process size of putback area
* - use number of characters read * - use number of characters read
* - but at most size of putback area * - but at most size of putback area
*/ */
int numPutback; int numPutback;
numPutback = gptr() - eback(); numPutback = gptr() - eback();
if (numPutback > pbSize) { if (numPutback > pbSize) {
numPutback = pbSize; numPutback = pbSize;
} }
/* copy up to pbSize characters previously read into /* copy up to pbSize characters previously read into
* the putback area * the putback area
*/ */
memmove (buffer+(pbSize-numPutback), gptr()-numPutback, memmove (buffer+(pbSize-numPutback), gptr()-numPutback,
numPutback); numPutback);
// read at most bufSize new characters // read at most bufSize new characters
int num; int num;
num = read (fd, buffer+pbSize, bufSize); num = read (fd, buffer+pbSize, bufSize);
if (num <= 0) { if (num <= 0) {
// ERROR or EOF // ERROR or EOF
return EOF; return EOF;
} }
// reset buffer pointers // reset buffer pointers
setg (buffer+(pbSize-numPutback), // beginning of putback area setg (buffer+(pbSize-numPutback), // beginning of putback area
buffer+pbSize, // read position buffer+pbSize, // read position
buffer+pbSize+num); // end of buffer buffer+pbSize+num); // end of buffer
// return next character // return next character
return traits_type::to_int_type(*gptr()); return traits_type::to_int_type(*gptr());
} }
}; };
@ -174,7 +174,7 @@ class fdistream : public std::istream {
fdinbuf buf; fdinbuf buf;
public: public:
fdistream (int fd) : std::istream(0), buf(fd) { fdistream (int fd) : std::istream(0), buf(fd) {
rdbuf(&buf); rdbuf(&buf);
} }
}; };

View file

@ -653,9 +653,9 @@ void write_textual_journal(journal_t& journal, std::string path,
istream_pos_type pos = 0; istream_pos_type pos = 0;
istream_pos_type jump_to; istream_pos_type jump_to;
format_t hdr_fmt(config.write_hdr_format); format_t hdr_fmt(config.write_hdr_format);
std::ifstream in(found.c_str()); std::ifstream in(found.c_str());
while (! in.eof()) { while (! in.eof()) {
entry_base_t * base = NULL; entry_base_t * base = NULL;
if (el != journal.entries.end() && if (el != journal.entries.end() &&