Permalink
Browse files

Fix sign comparison warnings

GTK uses a signed page_nr parameter to callback draw_page despite
describing it as 0 based, cast it to unsigned for comparisons to
array len which is also unsigned.
  • Loading branch information...
1 parent eeddd6f commit 42b3629aafb223e66695a8079397c16ec39760b0 @elextr elextr committed Oct 9, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/printing.c
View
@@ -399,7 +399,7 @@ static void draw_page(GtkPrintOperation *operation, GtkPrintContext *context,
gdouble width, height;
g_return_if_fail(dinfo != NULL);
- g_return_if_fail(page_nr < dinfo->pages->len);
+ g_return_if_fail((guint)page_nr < dinfo->pages->len);
if (dinfo->pages->len > 0)
{
@@ -418,7 +418,7 @@ static void draw_page(GtkPrintOperation *operation, GtkPrintContext *context,
add_page_header(dinfo, cr, width, page_nr);
dinfo->fr.chrg.cpMin = g_array_index(dinfo->pages, gint, page_nr);
- if (page_nr + 1 < dinfo->pages->len)
+ if ((guint)page_nr + 1 < dinfo->pages->len)
dinfo->fr.chrg.cpMax = g_array_index(dinfo->pages, gint, page_nr + 1) - 1;
else /* it's the last page, print 'til the end */
dinfo->fr.chrg.cpMax = sci_get_length(dinfo->sci);

0 comments on commit 42b3629

Please sign in to comment.