- s_size = (sbuf->GetDataLeft() < GetDataLeft()) ? sbuf->GetDataLeft() : GetDataLeft();
- if (s_size < bytes_count)
- bytes_count = s_size;
- bytes_count = sbuf->Read(buf, bytes_count);
- bytes_count = Write(buf, bytes_count);
+ b_count2 = sbuf->Read(buf, bytes_count);
+ bytes_count = Write(buf, b_count2);
+ if (b_count2 > bytes_count)
+ sbuf->WriteBack(buf+bytes_count, b_count2-bytes_count);