fix stream wrapper initializer

fix initialization warning

add special wrapper for AutoUTFInputStream
This commit is contained in:
KaitoHH 2017-09-26 16:03:09 +08:00
parent b16ff281f8
commit 79d9c71f98
2 changed files with 13 additions and 7 deletions

View File

@ -108,9 +108,9 @@ struct ParseResult {
typedef bool (ParseResult::*BooleanType)() const;
public:
//! Default constructor, no error.
ParseResult() : code_(kParseErrorNone), offset_(0) {}
ParseResult() : code_(kParseErrorNone), offset_(0), line_(0), col_(0) {}
//! Constructor to set an error.
ParseResult(ParseErrorCode code, size_t offset) : code_(code), offset_(offset) {}
ParseResult(ParseErrorCode code, size_t offset) : code_(code), offset_(offset), line_(0), col_(0) {}
//! Get the error code.
ParseErrorCode Code() const { return code_; }

View File

@ -115,7 +115,7 @@ public:
typedef typename Encoding::Ch Ch;
size_t line_;
size_t col_;
GenericStreamWrapper(InputStream& is): is_(is), line_(1), col_(0) {}
GenericStreamWrapper(InputStream& is): line_(1), col_(0), is_(is) {}
Ch Peek() const { return is_.Peek(); }
@ -133,11 +133,17 @@ public:
size_t Tell() { return is_.Tell(); }
Ch* PutBegin() { return is_.PutBegin(); }
void Put(Ch ch) { return is_.Put(ch); }
void Flush() { return is_.Flush(); }
size_t PutEnd(Ch* ch) { is_.PutEnd(ch); }
void Put(Ch ch) { is_.Put(ch); }
void Flush() { is_.Flush(); }
size_t PutEnd(Ch* ch) { return is_.PutEnd(ch); }
// wrapper for MemoryStream
const Ch* Peek4() const { return is_.Peek4(); }
// wrapper for AutoUTFInputStream
UTFType GetType() const { return is_.GetType(); }
bool HasBOM() const { return is_.HasBOM(); }
const Ch* Peek4() const { is_.Peek4(); }
private:
InputStream& is_;
};