[libglnx/wip/smcv/warnings: 4/7] fdio: Match signedness of length parameter




commit f65b05f2d540e8560fde374c206f872e24436e32
Author: Simon McVittie <smcv collabora com>
Date:   Sun Apr 24 11:04:58 2022 +0100

    fdio: Match signedness of length parameter
    
    This is documented as taking a length of -1, but the parameter is
    unsigned, so it's more correctly ((gsize) -1). This silences a warning
    from gcc -Wsign-compare.
    
    Signed-off-by: Simon McVittie <smcv collabora com>

 glnx-fdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glnx-fdio.c b/glnx-fdio.c
index c601f08..ee69aa1 100644
--- a/glnx-fdio.c
+++ b/glnx-fdio.c
@@ -1130,7 +1130,7 @@ glnx_file_replace_contents_with_perms_at (int                   dfd,
                                       &tmpf, error))
     return FALSE;
 
-  if (len == -1)
+  if (len == (gsize) -1)
     len = strlen ((char*)buf);
 
   if (!glnx_try_fallocate (tmpf.fd, 0, len, error))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]