summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-05-06 21:23:19 +0200
committerraveit65 <[email protected]>2020-06-12 13:18:07 +0200
commit4a4c2d5ac322d61e789a7d732e2ac25951984c3f (patch)
tree0950cb43e05f5ffb4c21b066a7921045eb63a6af
parent1092c4c309e12e039c19ff815bb725f1802afb6c (diff)
downloadmate-notification-daemon-4a4c2d5ac322d61e789a7d732e2ac25951984c3f.tar.bz2
mate-notification-daemon-4a4c2d5ac322d61e789a7d732e2ac25951984c3f.tar.xz
Remove conversion warnings
-rw-r--r--src/daemon/daemon.c47
-rw-r--r--src/daemon/engines.c2
-rw-r--r--src/daemon/stack.c14
-rw-r--r--src/themes/coco/coco-theme.c8
-rw-r--r--src/themes/nodoka/nodoka-theme.c14
-rw-r--r--src/themes/slider/theme.c8
-rw-r--r--src/themes/standard/theme.c4
7 files changed, 53 insertions, 44 deletions
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index 441e75f..8711864 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -96,7 +96,7 @@ typedef struct {
typedef struct {
NotifyStack** stacks;
- int n_stacks;
+ gsize n_stacks;
Atom workarea_atom;
} NotifyScreen;
@@ -309,27 +309,27 @@ static void on_screen_monitors_changed(GdkScreen* screen, NotifyDaemon* daemon)
n_monitors = gdk_display_get_n_monitors(display);
- if (n_monitors > nscreen->n_stacks)
+ if (n_monitors > (int) nscreen->n_stacks)
{
/* grow */
- nscreen->stacks = g_renew(NotifyStack *, nscreen->stacks, n_monitors);
+ nscreen->stacks = g_renew(NotifyStack *, nscreen->stacks, (gsize) n_monitors);
/* add more stacks */
- for (i = nscreen->n_stacks; i < n_monitors; i++)
+ for (i = (int) nscreen->n_stacks; i < n_monitors; i++)
{
create_stack_for_monitor(daemon, screen, gdk_display_get_monitor (display, i));
}
- nscreen->n_stacks = n_monitors;
+ nscreen->n_stacks = (gsize) n_monitors;
}
- else if (n_monitors < nscreen->n_stacks)
+ else if (n_monitors < (int) nscreen->n_stacks)
{
NotifyStack* last_stack;
last_stack = nscreen->stacks[n_monitors - 1];
/* transfer items before removing stacks */
- for (i = n_monitors; i < nscreen->n_stacks; i++)
+ for (i = n_monitors; i < (int) nscreen->n_stacks; i++)
{
NotifyStack* stack = nscreen->stacks[i];
GList* windows = g_list_copy(notify_stack_get_windows(stack));
@@ -349,8 +349,8 @@ static void on_screen_monitors_changed(GdkScreen* screen, NotifyDaemon* daemon)
}
/* remove the extra stacks */
- nscreen->stacks = g_renew(NotifyStack*, nscreen->stacks, n_monitors);
- nscreen->n_stacks = n_monitors;
+ nscreen->stacks = g_renew(NotifyStack*, nscreen->stacks, (gsize) n_monitors);
+ nscreen->n_stacks = (gsize) n_monitors;
}
}
@@ -358,12 +358,13 @@ static void create_stacks_for_screen(NotifyDaemon* daemon, GdkScreen *screen)
{
GdkDisplay *display;
NotifyScreen* nscreen;
- int i;
+ int i, n_monitors;
nscreen = daemon->screen;
display = gdk_screen_get_display (screen);
+ n_monitors = gdk_display_get_n_monitors(display);
- nscreen->n_stacks = gdk_display_get_n_monitors(display);
+ nscreen->n_stacks = (gsize) n_monitors;
nscreen->stacks = g_renew(NotifyStack*, nscreen->stacks, nscreen->n_stacks);
@@ -924,6 +925,7 @@ static GdkPixbuf * _notify_daemon_pixbuf_from_data_hint (GVariant *icon_data)
GVariant *data_variant;
gsize expected_len;
guchar *data;
+ gsize data_size;
GdkPixbuf *pixbuf;
g_variant_get (icon_data,
@@ -936,8 +938,7 @@ static GdkPixbuf * _notify_daemon_pixbuf_from_data_hint (GVariant *icon_data)
&n_channels,
&data_variant);
- expected_len = (height - 1) * rowstride + width
- * ((n_channels * bits_per_sample + 7) / 8);
+ expected_len = (gsize) ((height - 1) * rowstride + width * ((n_channels * bits_per_sample + 7) / 8));
if (expected_len != g_variant_get_size (data_variant)) {
g_warning ("Expected image data to be of length %" G_GSIZE_FORMAT
@@ -947,8 +948,8 @@ static GdkPixbuf * _notify_daemon_pixbuf_from_data_hint (GVariant *icon_data)
return NULL;
}
- data = (guchar *) g_memdup (g_variant_get_data (data_variant),
- g_variant_get_size (data_variant));
+ data_size = g_variant_get_size (data_variant);
+ data = (guchar *) g_memdup (g_variant_get_data (data_variant), (guint) data_size);
pixbuf = gdk_pixbuf_new_from_data (data,
GDK_COLORSPACE_RGB,
@@ -1033,12 +1034,12 @@ static GdkPixbuf* _notify_daemon_scale_pixbuf(GdkPixbuf *pixbuf, gboolean no_str
int scale_x;
int scale_y;
- scale_x = (int) (pw * scale_factor);
- scale_y = (int) (ph * scale_factor);
+ scale_x = (int) (((float) pw) * scale_factor);
+ scale_y = (int) (((float) ph) * scale_factor);
return gdk_pixbuf_scale_simple (pixbuf,
- scale_x,
- scale_y,
- GDK_INTERP_BILINEAR);
+ scale_x,
+ scale_y,
+ GDK_INTERP_BILINEAR);
}
else
{
@@ -1271,8 +1272,8 @@ static void sync_notification_position(NotifyDaemon* daemon, GtkWindow* nw, Wind
return;
}
- x += width / 2;
- y += height / 2;
+ x += (int)width / 2;
+ y += (int)height / 2;
theme_set_notification_arrow (nw, TRUE, x, y);
theme_move_notification (nw, x, y);
@@ -1534,7 +1535,7 @@ static gboolean notify_daemon_notify_handler(NotifyDaemonNotifications *object,
{
/* screw it - dump it on the last one we'll get
a monitors-changed signal soon enough*/
- monitor_id = gdk_display_get_monitor (gdk_display_get_default(), daemon->screen->n_stacks - 1);
+ monitor_id = gdk_display_get_monitor (gdk_display_get_default(), (int) daemon->screen->n_stacks - 1);
}
notify_stack_add_window (daemon->screen->stacks[_gtk_get_monitor_num (monitor_id)], nw, new_notification);
diff --git a/src/daemon/engines.c b/src/daemon/engines.c
index dc71bf1..db50e8b 100644
--- a/src/daemon/engines.c
+++ b/src/daemon/engines.c
@@ -50,7 +50,7 @@ typedef struct {
} ThemeEngine;
-static guint theme_prop_notify_id = 0;
+static gulong theme_prop_notify_id = 0;
static ThemeEngine* active_engine = NULL;
static ThemeEngine* load_theme_engine(const char *name)
diff --git a/src/daemon/stack.c b/src/daemon/stack.c
index d1a02db..4faa588 100644
--- a/src/daemon/stack.c
+++ b/src/daemon/stack.c
@@ -57,7 +57,7 @@ get_work_area (NotifyStack *stack,
int format;
gulong num;
gulong leftovers;
- gulong max_len = 4 * 32;
+ long max_len = 4 * 32;
guchar *ret_workarea;
long *workareas;
int result;
@@ -103,10 +103,10 @@ get_work_area (NotifyStack *stack,
}
workareas = (long *) ret_workarea;
- rect->x = workareas[disp_screen * 4];
- rect->y = workareas[disp_screen * 4 + 1];
- rect->width = workareas[disp_screen * 4 + 2];
- rect->height = workareas[disp_screen * 4 + 3];
+ rect->x = (int) workareas[disp_screen * 4];
+ rect->y = (int) workareas[disp_screen * 4 + 1];
+ rect->width = (int) workareas[disp_screen * 4 + 2];
+ rect->height = (int) workareas[disp_screen * 4 + 3];
XFree (ret_workarea);
@@ -287,8 +287,8 @@ notify_stack_shift_notifications (NotifyStack *stack,
gint x, y;
gint shiftx = 0;
gint shifty = 0;
- int i;
- int n_wins;
+ guint i;
+ guint n_wins;
get_work_area (stack, &workarea);
gdk_monitor_get_geometry (stack->monitor, &monitor);
diff --git a/src/themes/coco/coco-theme.c b/src/themes/coco/coco-theme.c
index 856eebd..44a2077 100644
--- a/src/themes/coco/coco-theme.c
+++ b/src/themes/coco/coco-theme.c
@@ -103,7 +103,7 @@ void notification_tick(GtkWindow *nw, glong remaining);
#define DEFAULT_ARROW_HEIGHT 14
#define DEFAULT_ARROW_WIDTH 22
#define DEFAULT_ARROW_SKEW -6
-#define BACKGROUND_OPACITY 0.90
+#define BACKGROUND_OPACITY 0.9
#define GRADIENT_CENTER 0.7
/* Support Nodoka Functions */
@@ -140,7 +140,7 @@ nodoka_rounded_rectangle (cairo_t * cr,
static void
fill_background(GtkWidget *widget, WindowData *windata, cairo_t *cr)
{
- float alpha;
+ double alpha;
if (windata->composited)
alpha = BACKGROUND_OPACITY;
else
@@ -490,6 +490,7 @@ void
set_notification_text(GtkWindow *nw, const char *summary, const char *body)
{
char *str;
+ size_t str_len;
char *quoted;
WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata");
g_assert(windata != NULL);
@@ -507,7 +508,8 @@ set_notification_text(GtkWindow *nw, const char *summary, const char *body)
xmlInitParser();
str = g_strconcat ("<markup>", "<span color=\"#EAEAEA\">", body, "</span>", "</markup>", NULL);
/* parse notification body */
- doc = xmlReadMemory(str, strlen (str), "noname.xml", NULL, 0);
+ str_len = strlen (str);
+ doc = xmlReadMemory(str, (int) str_len, "noname.xml", NULL, 0);
g_free (str);
if (doc != NULL) {
xmlXPathContextPtr xpathCtx;
diff --git a/src/themes/nodoka/nodoka-theme.c b/src/themes/nodoka/nodoka-theme.c
index 65fd67f..b0ba049 100644
--- a/src/themes/nodoka/nodoka-theme.c
+++ b/src/themes/nodoka/nodoka-theme.c
@@ -322,12 +322,12 @@ nodoka_rounded_rectangle_with_arrow (cairo_t * cr,
cairo_rectangle_int_t rect;
rect.x = 0;
- rect.width = w;
+ rect.width = (int)w;
if (arrow_up)
rect.y = 0 + DEFAULT_ARROW_HEIGHT;
else
rect.y = 0;
- rect.height = h - DEFAULT_ARROW_HEIGHT;
+ rect.height = (int)(h - DEFAULT_ARROW_HEIGHT);
cairo_move_to (cr, rect.x + radius, rect.y);
@@ -369,7 +369,7 @@ nodoka_rounded_rectangle_with_arrow (cairo_t * cr,
static void
fill_background(GtkWidget *widget, WindowData *windata, cairo_t *cr)
{
- float alpha;
+ double alpha;
if (windata->composited)
alpha = BACKGROUND_OPACITY;
else
@@ -405,7 +405,7 @@ draw_stripe(GtkWidget *widget, WindowData *windata, cairo_t *cr)
GdkRGBA center_color;
GdkRGBA bottom_color;
- float alpha;
+ double alpha;
if (windata->composited)
alpha = BACKGROUND_OPACITY;
else
@@ -475,7 +475,7 @@ draw_stripe(GtkWidget *widget, WindowData *windata, cairo_t *cr)
static void
draw_border(GtkWidget *widget, WindowData *windata, cairo_t *cr)
{
- float alpha;
+ double alpha;
if (windata->composited)
alpha = BACKGROUND_OPACITY;
else
@@ -876,6 +876,7 @@ void
set_notification_text(GtkWindow *nw, const char *summary, const char *body)
{
char *str;
+ size_t str_len;
char* quoted;
WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata");
g_assert(windata != NULL);
@@ -892,7 +893,8 @@ set_notification_text(GtkWindow *nw, const char *summary, const char *body)
xmlInitParser();
str = g_strconcat ("<markup>", "<span color=\"#000000\">", body, "</span>", "</markup>", NULL);
/* parse notification body */
- doc = xmlReadMemory(str, strlen (str), "noname.xml", NULL, 0);
+ str_len = strlen (str);
+ doc = xmlReadMemory(str, (int) str_len, "noname.xml", NULL, 0);
g_free (str);
if (doc != NULL) {
xmlXPathContextPtr xpathCtx;
diff --git a/src/themes/slider/theme.c b/src/themes/slider/theme.c
index 438049b..8676520 100644
--- a/src/themes/slider/theme.c
+++ b/src/themes/slider/theme.c
@@ -495,6 +495,7 @@ void notification_tick(GtkWindow* nw, glong remaining)
void set_notification_text(GtkWindow* nw, const char* summary, const char* body)
{
char* str;
+ size_t str_len;
char* quoted;
GtkRequisition req;
WindowData* windata;
@@ -516,7 +517,8 @@ void set_notification_text(GtkWindow* nw, const char* summary, const char* body)
xmlInitParser();
str = g_strconcat ("<markup>", body, "</markup>", NULL);
/* parse notification body */
- doc = xmlReadMemory(str, strlen (str), "noname.xml", NULL, 0);
+ str_len = strlen (str);
+ doc = xmlReadMemory(str, (int) str_len, "noname.xml", NULL, 0);
g_free (str);
if (doc != NULL) {
xmlXPathContextPtr xpathCtx;
@@ -613,8 +615,8 @@ static GdkPixbuf* scale_pixbuf(GdkPixbuf* pixbuf, int max_width, int max_height,
int scale_x;
int scale_y;
- scale_x = (int) (pw * scale_factor);
- scale_y = (int) (ph * scale_factor);
+ scale_x = (int) (((float) pw) * scale_factor);
+ scale_y = (int) (((float) ph) * scale_factor);
return gdk_pixbuf_scale_simple(pixbuf, scale_x, scale_y, GDK_INTERP_BILINEAR);
}
diff --git a/src/themes/standard/theme.c b/src/themes/standard/theme.c
index 4ab72de..1b553e6 100644
--- a/src/themes/standard/theme.c
+++ b/src/themes/standard/theme.c
@@ -845,6 +845,7 @@ void notification_tick(GtkWindow* nw, glong remaining)
void set_notification_text(GtkWindow* nw, const char* summary, const char* body)
{
char* str;
+ size_t str_len;
char* quoted;
GtkRequisition req;
WindowData* windata;
@@ -864,7 +865,8 @@ void set_notification_text(GtkWindow* nw, const char* summary, const char* body)
xmlInitParser();
str = g_strconcat ("<markup>", body, "</markup>", NULL);
/* parse notification body */
- doc = xmlReadMemory(str, strlen (str), "noname.xml", NULL, 0);
+ str_len = strlen (str);
+ doc = xmlReadMemory(str, (int) str_len, "noname.xml", NULL, 0);
g_free (str);
if (doc != NULL) {
xmlXPathContextPtr xpathCtx;