mate-desktop / atril

A document viewer for MATE
http://www.mate-desktop.org
GNU General Public License v2.0
203 stars 62 forks source link

ev-pixbuf-cache: Remove -Wtype-limits warnings #477

Closed rbuj closed 4 years ago

rbuj commented 4 years ago

Test: select any text in a document

ev-pixbuf-cache.c: In function 'get_selection_colors':
/usr/include/glib-2.0/glib/gmacros.h:811:63: warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
  811 | #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
      |                                                               ^
ev-pixbuf-cache.c:644:21: note: in expansion of macro 'CLAMP'
  644 |         text->red = CLAMP ((guint) (fg.red * 65535), 0, 65535);
      |                     ^~~~~
/usr/include/glib-2.0/glib/gmacros.h:811:30: warning: conversion from 'unsigned int' to 'guint16' {aka 'short unsigned int'} may change value [-Wconversion]
  811 | #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
      |                              ^
ev-pixbuf-cache.c:644:21: note: in expansion of macro 'CLAMP'
  644 |         text->red = CLAMP ((guint) (fg.red * 65535), 0, 65535);
      |                     ^~~~~
/usr/include/glib-2.0/glib/gmacros.h:811:63: warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
  811 | #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
      |                                                               ^
ev-pixbuf-cache.c:645:23: note: in expansion of macro 'CLAMP'
  645 |         text->green = CLAMP ((guint) (fg.green * 65535), 0, 65535);
      |                       ^~~~~
/usr/include/glib-2.0/glib/gmacros.h:811:30: warning: conversion from 'unsigned int' to 'guint16' {aka 'short unsigned int'} may change value [-Wconversion]
  811 | #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
      |                              ^
ev-pixbuf-cache.c:645:23: note: in expansion of macro 'CLAMP'
  645 |         text->green = CLAMP ((guint) (fg.green * 65535), 0, 65535);
      |                       ^~~~~
/usr/include/glib-2.0/glib/gmacros.h:811:63: warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
  811 | #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
      |                                                               ^
ev-pixbuf-cache.c:646:22: note: in expansion of macro 'CLAMP'
  646 |         text->blue = CLAMP ((guint) (fg.blue * 65535), 0, 65535);
      |                      ^~~~~
/usr/include/glib-2.0/glib/gmacros.h:811:30: warning: conversion from 'unsigned int' to 'guint16' {aka 'short unsigned int'} may change value [-Wconversion]
  811 | #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
      |                              ^
ev-pixbuf-cache.c:646:22: note: in expansion of macro 'CLAMP'
  646 |         text->blue = CLAMP ((guint) (fg.blue * 65535), 0, 65535);
      |                      ^~~~~
/usr/include/glib-2.0/glib/gmacros.h:811:63: warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
  811 | #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
      |                                                               ^
ev-pixbuf-cache.c:649:21: note: in expansion of macro 'CLAMP'
  649 |         base->red = CLAMP ((guint) (bg.red * 65535), 0, 65535);
      |                     ^~~~~
/usr/include/glib-2.0/glib/gmacros.h:811:30: warning: conversion from 'unsigned int' to 'guint16' {aka 'short unsigned int'} may change value [-Wconversion]
  811 | #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
      |                              ^
ev-pixbuf-cache.c:649:21: note: in expansion of macro 'CLAMP'
  649 |         base->red = CLAMP ((guint) (bg.red * 65535), 0, 65535);
      |                     ^~~~~
/usr/include/glib-2.0/glib/gmacros.h:811:63: warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
  811 | #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
      |                                                               ^
ev-pixbuf-cache.c:650:23: note: in expansion of macro 'CLAMP'
  650 |         base->green = CLAMP ((guint) (bg.green * 65535), 0, 65535);
      |                       ^~~~~
/usr/include/glib-2.0/glib/gmacros.h:811:30: warning: conversion from 'unsigned int' to 'guint16' {aka 'short unsigned int'} may change value [-Wconversion]
  811 | #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
      |                              ^
ev-pixbuf-cache.c:650:23: note: in expansion of macro 'CLAMP'
  650 |         base->green = CLAMP ((guint) (bg.green * 65535), 0, 65535);
      |                       ^~~~~
/usr/include/glib-2.0/glib/gmacros.h:811:63: warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
  811 | #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
      |                                                               ^
ev-pixbuf-cache.c:651:22: note: in expansion of macro 'CLAMP'
  651 |         base->blue = CLAMP ((guint) (bg.blue * 65535), 0, 65535);
      |                      ^~~~~
/usr/include/glib-2.0/glib/gmacros.h:811:30: warning: conversion from 'unsigned int' to 'guint16' {aka 'short unsigned int'} may change value [-Wconversion]
  811 | #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
      |                              ^
ev-pixbuf-cache.c:651:22: note: in expansion of macro 'CLAMP'
  651 |         base->blue = CLAMP ((guint) (bg.blue * 65535), 0, 65535);
      |                      ^~~~~

cast