[Libguestfs] [PATCH libguestfs 1/9] edit.c: avoid warning about signed/unsigned comparison
Richard W.M. Jones
rjones at redhat.com
Fri Aug 21 13:32:49 UTC 2009
On Fri, Aug 21, 2009 at 03:28:11PM +0200, Jim Meyering wrote:
> From: Jim Meyering <meyering at redhat.com>
>
> * fish/edit.c (load_file): Change type of param from int to size_t.
> (do_edit): Adjust caller.
> ---
> fish/edit.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fish/edit.c b/fish/edit.c
> index 3e6973e..1b6ce23 100644
> --- a/fish/edit.c
> +++ b/fish/edit.c
> @@ -30,7 +30,7 @@
> /* guestfish edit command, suggested by Ján Ondrej, implemented by RWMJ */
>
> static char *
> -load_file (const char *filename, int *len_r)
> +load_file (const char *filename, size_t *len_r)
> {
> int fd, r, start;
> char *content = NULL, *p;
> @@ -80,7 +80,7 @@ do_edit (const char *cmd, int argc, char *argv[])
> char buf[256];
> const char *editor;
> char *content, *content_new;
> - int r, fd, size;
> + int r, fd;
>
> if (argc != 1) {
> fprintf (stderr, _("use '%s filename' to edit a file\n"), cmd);
> @@ -138,6 +138,7 @@ do_edit (const char *cmd, int argc, char *argv[])
> }
>
> /* Reload it. */
> + size_t size;
> content_new = load_file (filename, &size);
> if (content_new == NULL) {
> unlink (filename);
> --
> 1.6.4.378.g88f2f
Yes, len_r / size is only used unsigned and as a size, so this makes
sense.
ACK.
Rich.
--
Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v
More information about the Libguestfs
mailing list