mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-31 20:04:09 +00:00
Remove some constant usage, use size from arrays
Makes more clear that we are scanning entire arrays or checking for some container boundaries. Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
This commit is contained in:
parent
e0dab7f4ef
commit
55897eba0f
@ -1751,7 +1751,7 @@ static void display_channel_marshall_migrate_data_surfaces(DisplayChannelClient
|
||||
|
||||
num_surfaces_created_ptr = spice_marshaller_reserve_space(m2, sizeof(uint32_t));
|
||||
num_surfaces_created = 0;
|
||||
for (i = 0; i < NUM_SURFACES; i++) {
|
||||
for (i = 0; i < dcc->priv->surface_client_created.size(); i++) {
|
||||
SpiceRect lossy_rect;
|
||||
|
||||
if (!dcc->priv->surface_client_created[i]) {
|
||||
|
||||
@ -323,7 +323,7 @@ static void dcc_init_stream_agents(DisplayChannelClient *dcc)
|
||||
int i;
|
||||
DisplayChannel *display = DCC_TO_DC(dcc);
|
||||
|
||||
for (i = 0; i < NUM_STREAMS; i++) {
|
||||
for (i = 0; i < dcc->priv->stream_agents.size(); i++) {
|
||||
VideoStreamAgent *agent = &dcc->priv->stream_agents[i];
|
||||
agent->stream = display_channel_get_nth_video_stream(display, i);
|
||||
region_init(&agent->vis_region);
|
||||
@ -832,7 +832,7 @@ static bool dcc_handle_stream_report(DisplayChannelClient *dcc,
|
||||
{
|
||||
VideoStreamAgent *agent;
|
||||
|
||||
if (report->stream_id >= NUM_STREAMS) {
|
||||
if (report->stream_id >= dcc->priv->stream_agents.size()) {
|
||||
spice_warning("stream_report: invalid stream id %u",
|
||||
report->stream_id);
|
||||
return FALSE;
|
||||
|
||||
@ -35,13 +35,13 @@ DisplayChannel::~DisplayChannel()
|
||||
for (drawable = priv->free_drawables; drawable; drawable = drawable->u.next) {
|
||||
++count;
|
||||
}
|
||||
spice_assert(count == NUM_DRAWABLES);
|
||||
spice_assert(count == priv->drawables.size());
|
||||
|
||||
count = 0;
|
||||
for (stream = priv->free_streams; stream; stream = stream->next) {
|
||||
++count;
|
||||
}
|
||||
spice_assert(count == NUM_STREAMS);
|
||||
spice_assert(count == priv->streams_buf.size());
|
||||
spice_assert(ring_is_empty(&priv->streams));
|
||||
|
||||
for (const auto &surface : priv->surfaces) {
|
||||
@ -1902,7 +1902,7 @@ void display_channel_draw(DisplayChannel *display, const SpiceRect *area, int su
|
||||
{
|
||||
RedSurface *surface;
|
||||
|
||||
spice_return_if_fail(surface_id >= 0 && surface_id < NUM_SURFACES);
|
||||
spice_return_if_fail(surface_id >= 0 && surface_id < display->priv->surfaces.size());
|
||||
spice_return_if_fail(area);
|
||||
spice_return_if_fail(area->left >= 0 && area->top >= 0 &&
|
||||
area->left < area->right && area->top < area->bottom);
|
||||
@ -2188,7 +2188,7 @@ DisplayChannel::DisplayChannel(RedsState *reds,
|
||||
image_surfaces_get,
|
||||
};
|
||||
|
||||
priv->n_surfaces = MIN(n_surfaces, NUM_SURFACES);
|
||||
priv->n_surfaces = MIN(n_surfaces, priv->surfaces.size());
|
||||
priv->qxl = qxl;
|
||||
|
||||
/* must be manually allocated here since g_type_class_add_private() only
|
||||
|
||||
Loading…
Reference in New Issue
Block a user