iteration fixes

SVN revision: 19111
This commit is contained in:
doursse 2005-12-18 11:49:28 +00:00 committed by doursse
parent 7a6855c42f
commit 520ca1ff13
2 changed files with 8 additions and 9 deletions

View File

@ -1293,15 +1293,16 @@ static XCBSCREEN *
evas_engine_software_xcb_screen_get(XCBConnection *conn, int screen)
{
XCBSCREENIter i;
int cur;
if (!conn) return NULL;
i = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(conn));
if (screen > i.rem - 1) return NULL; /* screen must be between 0 and i.rem - 1 */
for (cur = 0; cur <= screen; XCBSCREENNext(&i), ++cur) {}
for (; i.rem; --screen, XCBSCREENNext(&i))
if (screen == 0)
return i.data;
return i.data;
return NULL;
}
static XCBVISUALTYPE *
@ -1310,7 +1311,6 @@ evas_engine_software_xcb_best_visual_get(XCBConnection *conn, int screen)
XCBSCREEN *scr;
XCBDEPTH *d;
XCBVISUALTYPEIter iter;
int cur;
if (!conn) return NULL;
scr = evas_engine_software_xcb_screen_get(conn, screen);
@ -1319,7 +1319,7 @@ evas_engine_software_xcb_best_visual_get(XCBConnection *conn, int screen)
if (!d) return NULL;
iter = XCBDEPTHVisualsIter(d);
for (cur = 0 ; cur < iter.rem ; XCBVISUALTYPENext(&iter), ++cur)
for (; iter.rem ; XCBVISUALTYPENext(&iter))
if (scr->root_visual.id == iter.data->visual_id.id)
return iter.data;

View File

@ -600,13 +600,12 @@ evas_software_xcb_outbuf_debug_show(Outbuf *buf,
int h)
{
int i;
XCBSCREEN *screen;
XCBSCREEN *screen = NULL;
{
XCBGetGeometryRep *geom;
XCBDRAWABLE root;
XCBSCREENIter i;
int cur;
geom = XCBGetGeometryReply (buf->priv.x.conn, XCBGetGeometry (buf->priv.x.conn, draw), 0);
root.window = geom->root;
@ -614,7 +613,7 @@ evas_software_xcb_outbuf_debug_show(Outbuf *buf,
geom = XCBGetGeometryReply (buf->priv.x.conn, XCBGetGeometry (buf->priv.x.conn, root), 0);
i = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(buf->priv.x.conn));
for (cur = 0; cur < i.rem; XCBSCREENNext(&i), ++cur)
for (; i.rem; XCBSCREENNext(&i))
if (i.data->root.xid == geom->root.xid)
{
screen = i.data;
@ -747,7 +746,7 @@ evas_software_xcb_outbuf_perf_new_x(XCBConnection *conn,
perf->x.screen_num = 0;
i = XCBConnSetupSuccessRepRootsIter(XCBGetSetup(conn));
for (cur = 0; cur < i.rem; XCBSCREENNext(&i), ++cur)
for (cur = 0; i.rem; XCBSCREENNext(&i), ++cur)
if (i.data->root.xid == geom->root.xid)
{
perf->x.screen_num = cur;