165 perform_flush = true; |
165 perform_flush = true; |
166 } else { |
166 } else { |
167 // truncate data to be written, if we can neither extend nor flush |
167 // truncate data to be written, if we can neither extend nor flush |
168 len = buffer->capacity - buffer->pos; |
168 len = buffer->capacity - buffer->pos; |
169 if (size > 1) { |
169 if (size > 1) { |
170 // TODO: this is bugged - it would only discard one element and not as many as required |
|
171 len -= len % size; |
170 len -= len % size; |
172 } |
171 } |
173 nitems = len / size; |
172 nitems = len / size; |
174 } |
173 } |
175 } |
174 } |