exit(1);
}
- for (int i = 0; i < serialized.suitable_starting_point_size(); ++i) {
- ssize_t point = serialized.suitable_starting_point(i);
+ for (ssize_t point : serialized.suitable_starting_point()) {
if (point == -1) {
// Can happen when upgrading from before 1.1.3,
// where this was an optional field with -1 signifying
serialized.set_backlog_size(backlog_size);
serialized.set_prebuffering_bytes(prebuffering_bytes);
serialized.set_bytes_received(bytes_received);
- for (size_t i = 0; i < suitable_starting_points.size(); ++i) {
- serialized.add_suitable_starting_point(suitable_starting_points[i]);
+ for (size_t point : suitable_starting_points) {
+ serialized.add_suitable_starting_point(point);
}
serialized.set_url(url);
data_fd = -1;
// data, and 10 kB is a very fine granularity in most streams.
static const int minimum_start_point_distance = 10240;
size_t byte_position = bytes_received;
- for (size_t i = 0; i < queued_data_copy.size(); ++i) {
- if ((queued_data_copy[i].metacube_flags & METACUBE_FLAGS_NOT_SUITABLE_FOR_STREAM_START) == 0) {
+ for (const DataElement &elem : queued_data_copy) {
+ if ((elem.metacube_flags & METACUBE_FLAGS_NOT_SUITABLE_FOR_STREAM_START) == 0) {
size_t num_points = suitable_starting_points.size();
if (num_points >= 2 &&
suitable_starting_points[num_points - 1] - suitable_starting_points[num_points - 2] < minimum_start_point_distance) {
}
suitable_starting_points.push_back(byte_position);
}
- byte_position += queued_data_copy[i].data.iov_len;
+ byte_position += elem.data.iov_len;
}
add_data_raw(queued_data_copy);
remove_obsolete_starting_points();
- for (size_t i = 0; i < queued_data_copy.size(); ++i) {
- char *data = reinterpret_cast<char *>(queued_data_copy[i].data.iov_base);
+ for (const DataElement &elem : queued_data_copy) {
+ char *data = reinterpret_cast<char *>(elem.data.iov_base);
delete[] data;
}