Replace 0 with TARGET_XFER_EOF in to_xfer_partial
Commit Message
I run splint in gdb source and get the following warnings:
../../../git/gdb/corelow.c:740: Return value type int does not match declared type enum target_xfer_status: 0
'TARGET_XFER_EOF' (enum target_xfer_status) is expected to be returned,
but 0 is returned. This patch is to replace 0 with TARGET_XFER_EOF
in the implementations of to_xfer_partial. I'll commit it in two
days.
gdb:
2014-08-06 Yao Qi <yao@codesourcery.com>
* corelow.c (core_xfer_partial): Replace 0 with TARGET_XFER_EOF.
* remote-m32r-sdi.c (m32r_xfer_memory): Likewise.
---
gdb/corelow.c | 2 +-
gdb/remote-m32r-sdi.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
Comments
>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
Yao> 'TARGET_XFER_EOF' (enum target_xfer_status) is expected to be returned,
Yao> but 0 is returned. This patch is to replace 0 with TARGET_XFER_EOF
Yao> in the implementations of to_xfer_partial. I'll commit it in two
Yao> days.
Looks good.
FWIW I think there should be a few more like this.
Maybe in ser-something.c?
And also this code in remote_xfer_partial:
/* Note: a zero OFFSET and LEN can be used to query the minimum
buffer size. */
if (offset == 0 && len == 0)
return (get_remote_packet_size ());
There's a bug filed for this one.
Tom
@@ -737,7 +737,7 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
size = bfd_section_size (core_bfd, section);
if (offset >= size)
- return 0;
+ return TARGET_XFER_EOF;
size -= offset;
if (size > len)
size = len;
@@ -1081,7 +1081,7 @@ m32r_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
if (remote_debug)
fprintf_unfiltered (gdb_stdlog,
"m32r_xfer_memory() failed\n");
- return 0;
+ return TARGET_XFER_EOF;
}
ret = send_data (writebuf, len);
}
@@ -1095,7 +1095,7 @@ m32r_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
{
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory() failed\n");
- return 0;
+ return TARGET_XFER_EOF;
}
c = serial_readchar (sdi_desc, SDI_TIMEOUT);
@@ -1103,7 +1103,7 @@ m32r_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
{
if (remote_debug)
fprintf_unfiltered (gdb_stdlog, "m32r_xfer_memory() failed\n");
- return 0;
+ return TARGET_XFER_EOF;
}
ret = recv_data (readbuf, len);