[PATCH v2 4/8] winedbg: Use unsigned int for offset/length in GDB qXfer handler.

Jinoh Kang jinoh.kang.kr at gmail.com
Mon Nov 1 00:40:54 CDT 2021


packet_query uses sscanf format "%x" to parse out offset and length
values.  Since %x corresponds to unsigned int in the C standard, adjust
the variable types appropriately.

Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---
 programs/winedbg/gdbproxy.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index db0b8d77ba9..e6b1d998f7d 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -785,7 +785,7 @@ static void packet_reply_open_xfer(struct gdb_context* gdbctx)
     packet_reply_add(gdbctx, "m");
 }
 
-static void packet_reply_close_xfer(struct gdb_context* gdbctx, int off, int len)
+static void packet_reply_close_xfer(struct gdb_context* gdbctx, unsigned int off, unsigned int len)
 {
     int begin = gdbctx->out_curr_packet + 1;
     int plen;
@@ -802,7 +802,7 @@ static void packet_reply_close_xfer(struct gdb_context* gdbctx, int off, int len
     }
 
     plen = gdbctx->out_len - begin;
-    if (len >= 0 && plen > len) gdbctx->out_len -= (plen - len);
+    if (plen > len) gdbctx->out_len -= (plen - len);
     else gdbctx->out_buf[gdbctx->out_curr_packet] = 'l';
 
     packet_reply_close(gdbctx);
@@ -1764,7 +1764,7 @@ static void packet_query_target_xml(struct gdb_context* gdbctx, struct backend_c
 
 static enum packet_return packet_query(struct gdb_context* gdbctx)
 {
-    int off, len;
+    unsigned int off, len;
     struct backend_cpu *cpu;
 
     switch (gdbctx->in_packet[0])
-- 
2.31.1




More information about the wine-devel mailing list