[glib: 1/10] Fix signedness warnings in gio/ginputstream.c
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/10] Fix signedness warnings in gio/ginputstream.c
- Date: Fri, 23 Apr 2021 09:37:30 +0000 (UTC)
commit f2be8c74e547984b6dae3b3794e17ad37afbe056
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date: Thu Apr 15 10:51:33 2021 +0200
Fix signedness warnings in gio/ginputstream.c
gio/ginputstream.c: In function ‘g_input_stream_real_skip’:
gio/ginputstream.c:431:21: warning: comparison of integer expressions of
different signedness: ‘goffset’ {aka ‘long int’} and ‘long unsigned int’
431 | if (start > G_MAXSIZE - count || start + count > end)
| ^
gio/ginputstream.c:431:58: warning: comparison of integer expressions of
different signedness: ‘long unsigned int’ and ‘goffset’ {aka ‘long int’}
431 | if (start > G_MAXSIZE - count || start + count > end)
| ^
gio/ginputstream.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gio/ginputstream.c b/gio/ginputstream.c
index 9330169dc..a40c7d9c4 100644
--- a/gio/ginputstream.c
+++ b/gio/ginputstream.c
@@ -427,8 +427,10 @@ g_input_stream_real_skip (GInputStream *stream,
NULL))
{
end = g_seekable_tell (seekable);
+ g_assert (start >= 0);
g_assert (end >= start);
- if (start > G_MAXSIZE - count || start + count > end)
+ if ((guint64) start > (G_MAXSIZE - count) ||
+ (start + count) > (guint64) end)
{
stream->priv->pending = TRUE;
return end - start;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]