sources/network/bytestream.cpp

changeset 83
08bfc3d9d2ae
parent 73
07dda51a7a8e
child 88
08ccaf26cffd
equal deleted inserted replaced
82:895088452014 83:08bfc3d9d2ae
127 METHOD 127 METHOD
128 Bytestream::ensure_read_space (unsigned int bytes) -> void 128 Bytestream::ensure_read_space (unsigned int bytes) -> void
129 { 129 {
130 if (bytes_left() < bytes) 130 if (bytes_left() < bytes)
131 { 131 {
132 throw IOError (format ("attempted to read %1 byte(s) past the end of bytestream", 132 int bytesPast = bytes - bytes_left();
133 bytes - bytes_left())); 133
134 String message;
135 message.sprintf ("attempted to read %d byte%s past the end of bytestream",
136 bytesPast, bytesPast != -1 ? "s" : "");
137 throw IOError (message);
134 } 138 }
135 } 139 }
136 140
137 // ------------------------------------------------------------------------------------------------- 141 // -------------------------------------------------------------------------------------------------
138 // 142 //

mercurial