[glib: 5/8] Fix signedness warning in gio/gbufferedinputstream.c:g_buffered_input_stream_seek()




commit 18097c8acb4452d201dfe7ef27395a48c5810c0a
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date:   Wed Nov 18 19:19:38 2020 +0100

    Fix signedness warning in gio/gbufferedinputstream.c:g_buffered_input_stream_seek()
    
    gio/gbufferedinputstream.c: In function ‘g_buffered_input_stream_seek’:
    gio/gbufferedinputstream.c:899:18: error: comparison of integer expressions of different signedness: 
‘goffset’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
      899 |       if (offset <= priv->end - priv->pos && offset >= -priv->pos)
          |                  ^~
    gio/gbufferedinputstream.c:899:53: error: comparison of integer expressions of different signedness: 
‘goffset’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
      899 |       if (offset <= priv->end - priv->pos && offset >= -priv->pos)
          |                                                     ^~

 gio/gbufferedinputstream.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gio/gbufferedinputstream.c b/gio/gbufferedinputstream.c
index b0e609c0d..14495c4a0 100644
--- a/gio/gbufferedinputstream.c
+++ b/gio/gbufferedinputstream.c
@@ -896,7 +896,8 @@ g_buffered_input_stream_seek (GSeekable     *seekable,
   
   if (type == G_SEEK_CUR)
     {
-      if (offset <= priv->end - priv->pos && offset >= -priv->pos)
+      if (offset <= (goffset) (priv->end - priv->pos) &&
+          offset >= (goffset) -priv->pos)
        {
          priv->pos += offset;
          return TRUE;


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