X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fbuffered.cpp;h=b8a2dbee7255628fa899c691cac3b041e94f164a;hp=09cc0994840d9e4959bef8a28e062208273c0a44;hb=73a21b6f495e16707ede460a2c9d8f1474bb4d93;hpb=d6b80800099c85df8d6f49b5b9d11e43f86c79b0 diff --git a/source/buffered.cpp b/source/buffered.cpp index 09cc099..b8a2dbe 100644 --- a/source/buffered.cpp +++ b/source/buffered.cpp @@ -4,6 +4,8 @@ This file is part of libmspio Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ + +#include #include "buffered.h" #include "except.h" @@ -20,7 +22,7 @@ Buffered::Buffered(Base &b, unsigned s): end(buf), cur_op(M_NONE) { - mode=below.get_mode(); + mode = below.get_mode(); below.signal_flush_required.connect(sigc::mem_fun(this, &Buffered::flush)); } @@ -30,7 +32,7 @@ unsigned Buffered::put(char c) if(end(end-begin), size); + len = min(static_cast(end-begin), size); memcpy(data, begin, len); - begin+=len; - ret+=len; + begin += len; + ret += len; } else // Read the rest directly from the underlying object - ret+=below.read(data, size); + ret += below.read(data, size); - eof_flag=(below.eof() && begin==end); + eof_flag = (below.eof() && begin==end); return ret; }