From cdb80705105e4a788baeaef0511363a88bda1db5 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 7 Nov 2006 18:31:11 +0100 Subject: [PATCH] Fix compilations warnings in pager.c Fix several shadowed declarations and a signed size_t error Signed-off-by: Julien Danjou Signed-off-by: Pierre Habouzit --- curs_main.c | 2 +- mutt_menu.h | 2 +- pager.c | 86 ++++++++++++++++++++++++++--------------------------- 3 files changed, 45 insertions(+), 45 deletions(-) diff --git a/curs_main.c b/curs_main.c index 4341a71..ae62c47 100644 --- a/curs_main.c +++ b/curs_main.c @@ -111,7 +111,7 @@ static const char *No_visible = N_("No visible messages."); extern size_t UngetCount; -void index_make_entry (char *s, size_t l, MUTTMENU * menu, int num) +void index_make_entry (char *s, ssize_t l, struct menu_t * menu, int num) { format_flag flag = M_FORMAT_MAKEPRINT | M_FORMAT_ARROWCURSOR | M_FORMAT_INDEX; diff --git a/mutt_menu.h b/mutt_menu.h index 41204a6..b6d00fe 100644 --- a/mutt_menu.h +++ b/mutt_menu.h @@ -99,7 +99,7 @@ void mutt_menuDestroy (MUTTMENU **); int mutt_menuLoop (MUTTMENU *); /* used in both the index and pager index to make an entry. */ -void index_make_entry (char *, size_t, struct menu_t *, int); +void index_make_entry (char *, ssize_t, struct menu_t *, int); int index_color (int); #endif /* !_MUTT_MENU_H */ diff --git a/pager.c b/pager.c index 9f3dc2a..e18bd14 100644 --- a/pager.c +++ b/pager.c @@ -311,7 +311,7 @@ static void new_class_color (struct q_class_t *class, int *q_level) static void shift_class_colors (struct q_class_t *QuoteList, struct q_class_t *new_class, - int index, int *q_level) + int lindex, int *q_level) { struct q_class_t *q_list; @@ -319,7 +319,7 @@ shift_class_colors (struct q_class_t *QuoteList, struct q_class_t *new_class, new_class->index = -1; while (q_list) { - if (q_list->index >= index) { + if (q_list->index >= lindex) { q_list->index++; q_list->color = ColorQuote[q_list->index % ColorQuoteUsed]; } @@ -338,8 +338,8 @@ shift_class_colors (struct q_class_t *QuoteList, struct q_class_t *new_class, } } - new_class->index = index; - new_class->color = ColorQuote[index % ColorQuoteUsed]; + new_class->index = lindex; + new_class->color = ColorQuote[lindex % ColorQuoteUsed]; (*q_level)++; } @@ -368,7 +368,7 @@ static struct q_class_t *classify_quote (struct q_class_t **QuoteList, struct q_class_t *class = NULL, *tmp = NULL, *ptr, *save; char *tail_qptr; int offset, tail_lng; - int index = -1; + int lindex = -1; if (ColorQuoteUsed <= 1) { /* not much point in classifying quotes... */ @@ -421,7 +421,7 @@ static struct q_class_t *classify_quote (struct q_class_t **QuoteList, if (q_list == *QuoteList) *QuoteList = tmp; - index = q_list->index; + lindex = q_list->index; /* tmp should be the return class too */ class = tmp; @@ -454,7 +454,7 @@ static struct q_class_t *classify_quote (struct q_class_t **QuoteList, q_list->prev = ptr; q_list->up = tmp; - index = q_list->index; + lindex = q_list->index; /* next class to test; as above, we shouldn't go down */ q_list = save; @@ -521,7 +521,7 @@ static struct q_class_t *classify_quote (struct q_class_t **QuoteList, q_list->next = NULL; q_list->prev = NULL; - index = q_list->index; + lindex = q_list->index; /* tmp should be the return class too */ class = tmp; @@ -550,7 +550,7 @@ static struct q_class_t *classify_quote (struct q_class_t **QuoteList, q_list->prev = ptr; q_list->up = tmp; - index = q_list->index; + lindex = q_list->index; /* next class to test */ q_list = save; @@ -606,8 +606,8 @@ static struct q_class_t *classify_quote (struct q_class_t **QuoteList, return tmp; } else { - if (index != -1) - shift_class_colors (*QuoteList, tmp, index, q_level); + if (lindex != -1) + shift_class_colors (*QuoteList, tmp, lindex, q_level); return class; } @@ -634,8 +634,8 @@ static struct q_class_t *classify_quote (struct q_class_t **QuoteList, *QuoteList = class; } - if (index != -1) - shift_class_colors (*QuoteList, tmp, index, q_level); + if (lindex != -1) + shift_class_colors (*QuoteList, tmp, lindex, q_level); return class; } @@ -646,7 +646,7 @@ static int brailleCol = -1; static int check_attachment_marker (char *); static void -resolve_types (char *buf, char *raw, struct line_t *lineInfo, int n, int last, +resolve_types (char *buf, char *rawbuf, struct line_t *lineInfo, int n, int last, struct q_class_t **QuoteList, int *q_level, int *force_redraw, int q_classify) { @@ -676,13 +676,13 @@ resolve_types (char *buf, char *raw, struct line_t *lineInfo, int n, int last, } } } - else if (m_strncmp("\033[0m", raw, 4) == 0) /* a little hack... */ + else if (m_strncmp("\033[0m", rawbuf, 4) == 0) /* a little hack... */ lineInfo[n].type = MT_COLOR_NORMAL; #if 0 else if (m_strncmp("[-- ", buf, 4) == 0) lineInfo[n].type = MT_COLOR_ATTACHMENT; #else - else if (check_attachment_marker ((char *) raw) == 0) + else if (check_attachment_marker ((char *) rawbuf) == 0) lineInfo[n].type = MT_COLOR_ATTACHMENT; #endif else if (m_strcmp("-- \n", buf) == 0 @@ -883,7 +883,7 @@ static int grok_ansi (unsigned char *buf, int pos, ansi_attr * a) /* trim tail of buf so that it contains complete multibyte characters */ static int trim_incomplete_mbyte(unsigned char *buf, size_t len) { mbstate_t mbstate; - size_t k; + ssize_t k; p_clear(&mbstate, 1); for (; len > 0; buf += k, len -= k) { @@ -900,7 +900,7 @@ static int trim_incomplete_mbyte(unsigned char *buf, size_t len) { static int fill_buffer (FILE * f, off_t *last_pos, off_t offset, unsigned char *buf, - unsigned char *fmt, size_t blen, int *buf_ready) + unsigned char *fmt, ssize_t blen, int *buf_ready) { unsigned char *p; static int b_read = 0; @@ -1425,7 +1425,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) int helpoffset = LINES - 2; /* offset for the help bar. */ int bodylen = LINES - 2 - bodyoffset; /* length of displayable area */ - MUTTMENU *index = NULL; /* the Pager Index (PI) */ + MUTTMENU *pager_index = NULL; /* the Pager Index (PI) */ int indexoffset = 0; /* offset for the PI */ int indexlen = PagerIndexLines; /* indexlen not always == PIL */ int indicator = indexlen / 3; /* the indicator line of the PI */ @@ -1543,31 +1543,31 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) #endif if (IsHeader (extra) && PagerIndexLines) { - if (index == NULL) { + if (pager_index == NULL) { /* only allocate the space if/when we need the index. Initialise the menu as per the main index */ - index = mutt_new_menu (); - index->menu = MENU_MAIN; - index->make_entry = index_make_entry; - index->color = index_color; - index->max = Context->vcount; - index->current = extra->hdr->virtual; + pager_index = mutt_new_menu (); + pager_index->menu = MENU_MAIN; + pager_index->make_entry = index_make_entry; + pager_index->color = index_color; + pager_index->max = Context->vcount; + pager_index->current = extra->hdr->virtual; } SETCOLOR (MT_COLOR_NORMAL); - index->offset = indexoffset + (option (OPTSTATUSONTOP) ? 1 : 0); + pager_index->offset = indexoffset + (option (OPTSTATUSONTOP) ? 1 : 0); - index->pagelen = indexlen - 1; + pager_index->pagelen = indexlen - 1; /* some fudge to work out where abouts the indicator should go */ - if (index->current - indicator < 0) - index->top = 0; - else if (index->max - index->current < index->pagelen - indicator) - index->top = index->max - index->pagelen; + if (pager_index->current - indicator < 0) + pager_index->top = 0; + else if (pager_index->max - pager_index->current < pager_index->pagelen - indicator) + pager_index->top = pager_index->max - pager_index->pagelen; else - index->top = index->current - indicator; + pager_index->top = pager_index->current - indicator; - menu_redraw_index (index); + menu_redraw_index (pager_index); } redraw |= REDRAW_BODY | REDRAW_INDEX | REDRAW_STATUS; @@ -1661,13 +1661,13 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) if (redraw & REDRAW_SIDEBAR) sidebar_draw (MENU_PAGER); - if ((redraw & REDRAW_INDEX) && index) { + if ((redraw & REDRAW_INDEX) && pager_index) { /* redraw the pager_index indicator, because the * flags for this message might have changed. */ - menu_redraw_current (index); + menu_redraw_current (pager_index); sidebar_draw (MENU_PAGER); - /* print out the index status bar */ - menu_status_line (buffer, sizeof (buffer), index, NONULL (Status)); + /* print out the pager_index status bar */ + menu_status_line (buffer, sizeof (buffer), pager_index, NONULL (Status)); move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), SW); SETCOLOR (MT_COLOR_STATUS); BKGDSET (MT_COLOR_STATUS); @@ -2190,9 +2190,9 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) } if (old_PagerIndexLines != PagerIndexLines) { - if (index) - mutt_menuDestroy (&index); - index = NULL; + if (pager_index) + mutt_menuDestroy (&pager_index); + pager_index = NULL; } if (option (OPTWRAP) != old_smart_wrap || @@ -2602,7 +2602,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra) SearchCompiled = 0; } p_delete(&lineInfo); - if (index) - mutt_menuDestroy (&index); + if (pager_index) + mutt_menuDestroy (&pager_index); return (rc != -1 ? rc : 0); } -- 2.20.1