>From 9c0cd0ba5bb5966498cad2c5a8c69ec24c4c8e34 Mon Sep 17 00:00:00 2001 From: Pauli Nieminen <suok...@gmail.com> Date: Mon, 20 Jul 2009 18:40:49 +0300 Subject: [PATCH 15/15] Fix signed/unsigned comparison warning
--- libdrm/radeon/radeon_cs_gem.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libdrm/radeon/radeon_cs_gem.c b/libdrm/radeon/radeon_cs_gem.c index 264b067..43b136f 100644 --- a/libdrm/radeon/radeon_cs_gem.c +++ b/libdrm/radeon/radeon_cs_gem.c @@ -354,21 +354,22 @@ static void cs_gem_print(struct radeon_cs *cs, FILE *file) unsigned opcode; unsigned reg; unsigned cnt; - int i, j; + unsigned i,j; for (i = 0; i < cs->cdw;) { - cnt = CP_PACKET_GET_COUNT(cs->packets[i]); + /* First word in CP is not counted so has to add one to value */ + cnt = CP_PACKET_GET_COUNT(cs->packets[i]) + 1; switch (CP_PACKET_GET_TYPE(cs->packets[i])) { case PACKET_TYPE0: - fprintf(file, "Pkt0 at %d (%d dwords):\n", i, cnt + 1); + fprintf(file, "Pkt0 at %d (%d dwords):\n", i, cnt); reg = CP_PACKET0_GET_REG(cs->packets[i]); if (CP_PACKET0_GET_ONE_REG_WR(cs->packets[i++])) { - for (j = 0; j <= cnt; j++) { + for (j = 0; j < cnt; j++) { fprintf(file, " 0x%08X -> 0x%04X\n", cs->packets[i++], reg); } } else { - for (j = 0; j <= cnt; j++) { + for (j = 0; j < cnt; j++) { fprintf(file, " 0x%08X -> 0x%04X\n", cs->packets[i++], reg); reg += 4; @@ -410,7 +411,7 @@ static void cs_gem_print(struct radeon_cs *cs, FILE *file) fprintf(file, "Unknow opcode 0x%02X at %d\n", opcode, i); return; } - for (j = 0; j <= cnt; j++) { + for (j = 0; j < cnt; j++) { fprintf(file, " 0x%08X\n", cs->packets[i++]); } break; -- 1.6.3.3 ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge -- _______________________________________________ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel