After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 786261 - gif: change ptr, size, and amount_needed from guint to size_t
gif: change ptr, size, and amount_needed from guint to size_t
Status: RESOLVED FIXED
Product: gdk-pixbuf
Classification: Platform
Component: loaders
unspecified
Other All
: Normal normal
: ---
Assigned To: gdk-pixbuf-maint
gdk-pixbuf-maint
Depends on:
Blocks:
 
 
Reported: 2017-08-13 23:40 UTC by Tobias Mueller
Modified: 2017-08-24 07:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gif: change ptr, size, and amount_needed from guint to size_t (1.42 KB, patch)
2017-08-13 23:40 UTC, Tobias Mueller
needs-work Details | Review
gif: Fix compiler warning reg. type conversion (1.40 KB, patch)
2017-08-17 18:51 UTC, Tobias Mueller
committed Details | Review

Description Tobias Mueller 2017-08-13 23:40:35 UTC
This fixes some compiler warnings reg. dealing with pointers.
Comment 1 Tobias Mueller 2017-08-13 23:40:39 UTC
Created attachment 357533 [details] [review]
gif: change ptr, size, and amount_needed from guint to size_t

With -Wconversion gcc complains with the following warning:

io-gif.c: In function ‘gif_read’:
io-gif.c:246:20: warning: conversion to ‘guint {aka unsigned int}’ from
‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
    context->ptr += len;
                    ^
io-gif.c:258:28: warning: conversion to ‘guint {aka unsigned int}’ from
‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
   context->amount_needed = len - (context->size - context->ptr);

This change simply changes their types to match the rhs.
Comment 2 Bastien Nocera 2017-08-14 22:38:48 UTC
Review of attachment 357533 [details] [review]:

> gif: change ptr, size, and amount_needed from guint to size_t

Please state the effect of the patch, not what code you changed.

::: gdk-pixbuf/io-gif.c
@@ +146,3 @@
 	gpointer user_data;
         guchar *buf;
+	size_t ptr;

a gsize would look nicer to me :)
Comment 3 Tobias Mueller 2017-08-17 18:51:27 UTC
Created attachment 357829 [details] [review]
gif:  Fix compiler warning reg. type conversion

With -Wconversion gcc complains with the following warning:

io-gif.c: In function ‘gif_read’:
io-gif.c:246:20: warning: conversion to ‘guint {aka unsigned int}’ from
‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
    context->ptr += len;
                    ^
io-gif.c:258:28: warning: conversion to ‘guint {aka unsigned int}’ from
‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
   context->amount_needed = len - (context->size - context->ptr);

This change simply changes their types to match the rhs.
Comment 4 Bastien Nocera 2017-08-23 16:20:29 UTC
Review of attachment 357829 [details] [review]:

Sure.
Comment 5 Tobias Mueller 2017-08-24 07:18:06 UTC
Comment on attachment 357829 [details] [review]
gif:  Fix compiler warning reg. type conversion

Committed as 853c60427f7ebb6b9cdfd142923167af70f13536