diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/GridText.c | 48 | ||||
-rw-r--r-- | src/LYBookmark.c | 4 | ||||
-rw-r--r-- | src/LYCharUtils.c | 12 | ||||
-rw-r--r-- | src/LYCurses.c | 24 | ||||
-rw-r--r-- | src/LYHistory.c | 6 | ||||
-rw-r--r-- | src/LYMainLoop.c | 4 | ||||
-rw-r--r-- | src/LYMap.c | 4 | ||||
-rw-r--r-- | src/LYOptions.c | 4 | ||||
-rw-r--r-- | src/LYPrettySrc.c | 4 | ||||
-rw-r--r-- | src/LYReadCFG.c | 6 | ||||
-rw-r--r-- | src/LYShowInfo.c | 4 | ||||
-rw-r--r-- | src/LYStrings.c | 42 | ||||
-rw-r--r-- | src/LYStyle.c | 8 | ||||
-rw-r--r-- | src/LYTraversal.c | 4 | ||||
-rw-r--r-- | src/LYUtils.c | 24 | ||||
-rw-r--r-- | src/LYrcFile.c | 4 | ||||
-rw-r--r-- | src/TRSTable.c | 6 | ||||
-rw-r--r-- | src/UCdomap.c | 4 | ||||
-rw-r--r-- | src/chrtrans/makeuctb.c | 12 |
19 files changed, 113 insertions, 111 deletions
diff --git a/src/GridText.c b/src/GridText.c index 357883f3..a1cf0bb0 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -1,5 +1,5 @@ /* - * $LynxId: GridText.c,v 1.190 2010/06/29 00:56:31 tom Exp $ + * $LynxId: GridText.c,v 1.191 2010/09/22 10:53:56 tom Exp $ * * Character grid hypertext object * =============================== @@ -244,9 +244,9 @@ There are 3 functions - POOL_NEW, POOL_FREE, and ALLOC_IN_POOL. *************************************************************************/ -#define POOLallocstyles(ptr, n) ptr = ALLOC_IN_POOL(&HTMainText->pool, n * sizeof(pool_data)) -#define POOLallocHTLine(ptr, size) ptr = (HTLine*) ALLOC_IN_POOL(&HTMainText->pool, LINE_SIZE(size)) -#define POOLallocstring(ptr, len) ptr = (char*) ALLOC_IN_POOL(&HTMainText->pool, len + 1) +#define POOLallocstyles(ptr, n) ptr = ALLOC_IN_POOL(&HTMainText->pool, (unsigned) ((n) * sizeof(pool_data))) +#define POOLallocHTLine(ptr, size) ptr = (HTLine*) ALLOC_IN_POOL(&HTMainText->pool, (unsigned) LINE_SIZE(size)) +#define POOLallocstring(ptr, len) ptr = (char*) ALLOC_IN_POOL(&HTMainText->pool, (unsigned) (len + 1)) #define POOLtypecalloc(T, ptr) ptr = (T*) ALLOC_IN_POOL(&HTMainText->pool, sizeof(T)) /**************************************************************************/ @@ -270,7 +270,7 @@ static pool_data *ALLOC_IN_POOL(HTPool ** ppoolptr, unsigned request) n = 1; j = (n % ALIGN_SIZE); if (j != 0) - n += (ALIGN_SIZE - j); + n += (unsigned) (ALIGN_SIZE - j); n /= sizeof(pool_data); if (POOL_SIZE >= (pool->used + n)) { @@ -336,7 +336,8 @@ typedef struct _line { char data[1]; /* Space for terminator at least! */ } HTLine; -#define LINE_SIZE(size) (sizeof(HTLine)+(size)) /* Allow for terminator */ + /* Allow for terminator */ +#define LINE_SIZE(size) (sizeof(HTLine) + (size_t)(size)) #ifndef HTLINE_NOT_IN_POOL #define HTLINE_NOT_IN_POOL 0 /* debug with this set to 1 */ @@ -805,7 +806,7 @@ static void LYAddHiText(TextAnchor *a, { HiliteInfo *have = a->lites.hl_info; unsigned need = (unsigned) (a->lites.hl_len - 1); - unsigned want = (unsigned) (a->lites.hl_len += 1) * sizeof(HiliteInfo); + unsigned want = (unsigned) (a->lites.hl_len += 1) * (unsigned) sizeof(HiliteInfo); if (have != NULL) { have = (HiliteInfo *) realloc(have, want); @@ -835,8 +836,9 @@ static int LYAdjHiTextPos(TextAnchor *a, int count) else result = a->lites.hl_base.hl_text; - return (result != 0) ? (LYSkipBlanks(result) - result) : 0; + return (result != 0) ? (int) (LYSkipBlanks(result) - result) : 0; } + #else #define LYAdjHiTextPos(a,count) 0 #endif @@ -888,7 +890,7 @@ static void LYCopyHiText(TextAnchor *a, TextAnchor *b) if ((s = LYGetHiTextStr(b, count)) == NULL) break; if (count == 0) { - LYSetHiText(a, s, strlen(s)); + LYSetHiText(a, s, (unsigned) strlen(s)); } else { LYAddHiText(a, s, LYGetHiTextPos(b, count)); } @@ -2724,7 +2726,7 @@ static HTLine *insert_blanks_in_line(HTLine *line, int line_number, if (ip) /* Fix anchor positions */ move_anchors_in_region(line, line_number, prev_anchor /*updates++ */ , &head_processed, - copied - line->data, pre - line->data, + (int) (copied - line->data), (int) (pre - line->data), shift); #if defined(USE_COLOR_STYLE) /* Move styles too */ #define NStyle mod_line->styles[istyle] @@ -2964,7 +2966,7 @@ static void split_line(HText *text, unsigned split) HeadTrim++; } - plen = strlen(p); + plen = (unsigned) strlen(p); if (plen) { /* Count funny characters */ for (i = (int) (plen - 1); i >= 0; i--) { if (p[i] == LY_UNDERLINE_START_CHAR || @@ -3130,18 +3132,20 @@ static void split_line(HText *text, unsigned split) } scan--; } - line->numstyles = line->styles + MAX_STYLES_ON_LINE - 1 - to; + line->numstyles = (unsigned short) (line->styles + + MAX_STYLES_ON_LINE + - 1 - to); if (line->numstyles > 0 && line->numstyles < MAX_STYLES_ON_LINE) { int n; for (n = 0; n < line->numstyles; n++) line->styles[n] = to[n + 1]; } else if (line->numstyles == 0) { - line->styles[0].sc_horizpos = ~0; /* ?!!! */ + line->styles[0].sc_horizpos = (unsigned) (~0); /* ?!!! */ } previous->numstyles = (unsigned short) (at_end - previous->styles + 1); if (previous->numstyles == 0) { - previous->styles[0].sc_horizpos = ~0; /* ?!!! */ + previous->styles[0].sc_horizpos = (unsigned) (~0); /* ?!!! */ } } #endif /*USE_COLOR_STYLE */ @@ -7849,7 +7853,7 @@ static int TrimmedLength(char *string) if ((*dst++ = *src++) == '\0') break; } - result = (dst - string - 1); + result = (int) (dst - string - 1); } } return result; @@ -9620,7 +9624,7 @@ static char *HText_skipOptionNumPrefix(char *opname) while (*cp && isdigit(UCH(*cp))) ++cp; if (*cp && *cp++ == ')') { - int i = (cp - opname); + int i = (int) (cp - opname); while (i < 5) { if (*cp != '_') @@ -9700,7 +9704,7 @@ char *HText_setLastOptionValue(HText *text, char *value, * prefix and actual value. -FM */ if ((cp1 = HText_skipOptionNumPrefix(cp)) > cp) { - i = 0, j = (cp1 - cp); + i = 0, j = (int) (cp1 - cp); while (isspace(UCH(cp1[i])) || IsSpecialAttrChar(UCH(cp1[i]))) { i++; @@ -12909,7 +12913,7 @@ static int finish_ExtEditForm(LinkInfo * form_link, TextAnchor *start_anchor, while ((line_cnt <= orig_cnt) || (*lp) || ((len != 0) && (*lp == '\0'))) { if (skip_at) { - len0 = skip_at - lp; + len0 = (int) (skip_at - lp); strncpy(line, lp, (size_t) len0); line[len0] = '\0'; lp = skip_at + skip_num; @@ -12923,7 +12927,7 @@ static int finish_ExtEditForm(LinkInfo * form_link, TextAnchor *start_anchor, line[len0] = '\0'; if ((cp = strchr(lp, '\n')) != 0) - len = cp - lp; + len = (int) (cp - lp); else len = (int) strlen(lp); @@ -13500,7 +13504,7 @@ int HText_InsertFile(LinkInfo * form_link) while (*lp) { if ((cp = strchr(lp, '\n')) != 0) - len = cp - lp; + len = (int) (cp - lp); else len = (int) strlen(lp); @@ -14455,7 +14459,7 @@ static int LYHandleCache(const char *arg, #ifdef USE_SOURCE_CACHE char *source_cache_file = NULL; #endif - int Size = 0; + long Size = 0; int x = -1; /* @@ -14569,7 +14573,7 @@ static int LYHandleCache(const char *arg, x, STR_LYNXCACHE, x, title, address, address); PUTS(buf); if (Size > 0) { - HTSprintf0(&buf, "Size: %d ", Size); + HTSprintf0(&buf, "Size: %ld ", Size); PUTS(buf); } if (cachedoc != NULL && cachedoc->Lines > 0) { diff --git a/src/LYBookmark.c b/src/LYBookmark.c index 4f0e93ce..fb75d458 100644 --- a/src/LYBookmark.c +++ b/src/LYBookmark.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYBookmark.c,v 1.65 2010/04/30 09:45:08 tom Exp $ + * $LynxId: LYBookmark.c,v 1.66 2010/09/22 09:36:12 tom Exp $ */ #include <HTUtils.h> #include <HTAlert.h> @@ -44,7 +44,7 @@ int LYMBM2index(int ch) if (result != 0 && (result - letters) <= MBM_V_MAXFILES) - return (result - letters); + return (int) (result - letters); } return -1; } diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c index c6be3aee..92f8fe07 100644 --- a/src/LYCharUtils.c +++ b/src/LYCharUtils.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYCharUtils.c,v 1.105 2010/04/29 20:53:31 tom Exp $ + * $LynxId: LYCharUtils.c,v 1.106 2010/09/22 08:35:31 tom Exp $ * * Functions associated with LYCharSets.c and the Lynx version of HTML.c - FM * ========================================================================== @@ -1218,12 +1218,12 @@ char **LYUCFullyTranslateString(char **str, #define CHUNK (chunk ? chunk : (chunk = HTChunkCreate2(128, len+1))) #define REPLACE_STRING(s) \ - if (q != qs) HTChunkPutb(CHUNK, qs, q-qs); \ + if (q != qs) HTChunkPutb(CHUNK, qs, (int) (q - qs)); \ HTChunkPuts(CHUNK, s); \ qs = q = *str #define REPLACE_CHAR(c) if (q > p) { \ - HTChunkPutb(CHUNK, qs, q-qs); \ + HTChunkPutb(CHUNK, qs, (int) (q - qs)); \ qs = q = *str; \ *q++ = c; \ } else \ @@ -1542,7 +1542,7 @@ char **LYUCFullyTranslateString(char **str, state = S_recover; break; } else { - code = LYcp1252ToUnicode(lcode); + code = LYcp1252ToUnicode((UCode_t) lcode); state = S_check_uni; } break; @@ -1882,7 +1882,7 @@ char **LYUCFullyTranslateString(char **str, *q = '\0'; if (chunk) { - HTChunkPutb(CHUNK, qs, q - qs + 1); /* also terminates */ + HTChunkPutb(CHUNK, qs, (int) (q - qs + 1)); /* also terminates */ if (stype == st_URL || stype == st_other) { LYTrimHead(chunk->data); LYTrimTail(chunk->data); @@ -1995,7 +1995,7 @@ void LYParseRefreshURL(char *content, cp1 = cp; while (*cp1 && isdigit(UCH(*cp1))) cp1++; - StrnAllocCopy(Seconds, cp, cp1 - cp); + StrnAllocCopy(Seconds, cp, (int) (cp1 - cp)); } *p_seconds = Seconds; *p_address = LYParseTagParam(content, "URL"); diff --git a/src/LYCurses.c b/src/LYCurses.c index c0209666..2ca21098 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -1,4 +1,4 @@ -/* $LynxId: LYCurses.c,v 1.151 2010/06/17 08:09:48 tom Exp $ */ +/* $LynxId: LYCurses.c,v 1.152 2010/09/22 10:51:44 tom Exp $ */ #include <HTUtils.h> #include <HTAlert.h> @@ -260,8 +260,8 @@ static char *attr_to_string(int code) { static char result[sizeof(Mono_Attrs) + 80]; unsigned i; - int pair = PAIR_NUMBER(code); - int bold = (pair != 0 && (code & A_BOLD) != 0); + int pair = PAIR_NUMBER((unsigned) code); + int bold = (pair != 0 && ((unsigned) code & A_BOLD) != 0); if (bold) code &= (int) ~A_BOLD; @@ -424,11 +424,11 @@ static void LYAttrset(WINDOW * win, int color, && color >= 0) { CTRACE2(TRACE_STYLE, (tfp, "CSS:LYAttrset color %#x -> (%s)\n", color, attr_to_string(color))); - (void) wattrset(win, color); + (void) wattrset(win, (unsigned) color); } else if (mono >= 0) { CTRACE2(TRACE_STYLE, (tfp, "CSS:LYAttrset mono %#x -> (%s)\n", mono, attr_to_string(mono))); - (void) wattrset(win, mono); + (void) wattrset(win, (unsigned) mono); } else { CTRACE2(TRACE_STYLE, (tfp, "CSS:LYAttrset (A_NORMAL)\n")); (void) wattrset(win, A_NORMAL); @@ -493,7 +493,7 @@ void curses_w_style(WINDOW * win, int style, "in LynxChangeStyle(curses_w_style)")); last_colorattr_ptr = MAX_LAST_STYLES - 1; } - last_styles[last_colorattr_ptr++] = LYgetattrs(win); + last_styles[last_colorattr_ptr++] = (int) LYgetattrs(win); /* don't cache style changes for active links */ #if OMIT_SCN_KEEPING /* since we don't compute the hcode to stack off in HTML.c, we @@ -653,11 +653,11 @@ static int encode_color_attr(int color_attr) int code = 0; int offs = 1; - if (color_attr & A_BOLD) + if ((unsigned) color_attr & A_BOLD) code |= 1; - if (color_attr & (A_REVERSE | A_DIM)) + if ((unsigned) color_attr & (A_REVERSE | A_DIM)) code |= 2; - if (color_attr & A_UNDERLINE) + if ((unsigned) color_attr & A_UNDERLINE) code |= 4; result = lynx_color_cfg_attr(code); @@ -706,8 +706,8 @@ char *LYgetTableString(int code) { int mask = decode_mono_code(code); int second = encode_color_attr(mask); - int pair = PAIR_NUMBER(second); - int mono = (int) (mask & A_ATTRIBUTES); + int pair = PAIR_NUMBER((unsigned) second); + int mono = (int) ((unsigned) mask & A_ATTRIBUTES); int fg = lynx_color_pairs[pair].fg; int bg = lynx_color_pairs[pair].bg; unsigned n; @@ -810,7 +810,7 @@ int lynx_chg_color(int color, void lynx_set_color(int a) { if (lynx_has_color && LYShowColor >= SHOW_COLOR_ON) { - (void) wattrset(LYwin, lynx_color_cfg_attr(a) + (void) wattrset(LYwin, (unsigned) lynx_color_cfg_attr(a) | (((a + 1) < COLOR_PAIRS) ? (chtype) get_color_pair(a + 1) : A_NORMAL)); diff --git a/src/LYHistory.c b/src/LYHistory.c index f9712534..34ec0b1a 100644 --- a/src/LYHistory.c +++ b/src/LYHistory.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYHistory.c,v 1.77 2010/04/29 08:55:40 tom Exp $ + * $LynxId: LYHistory.c,v 1.78 2010/09/22 10:49:45 tom Exp $ */ #include <HTUtils.h> #include <HTTP.h> @@ -347,7 +347,7 @@ void LYAllocHistory(int entries) int save = size_history; size_history = (entries + 2) * 2; - want = (unsigned) size_history *sizeof(*history); + want = (unsigned) size_history *(unsigned) sizeof(*history); if (history == 0) { history = (HistInfo *) malloc(want); @@ -995,7 +995,7 @@ static void to_stack(char *str) * Register string. */ if (buffstack == 0) - buffstack = typecallocn(char *, status_buf_size); + buffstack = typecallocn(char *, (size_t) status_buf_size); FREE(buffstack[topOfStack]); buffstack[topOfStack] = str; diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index df9217b2..6f5b1782 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYMainLoop.c,v 1.166 2010/06/18 10:56:54 tom Exp $ + * $LynxId: LYMainLoop.c,v 1.167 2010/09/22 09:36:30 tom Exp $ */ #include <HTUtils.h> #include <HTAccess.h> @@ -5821,7 +5821,7 @@ int mainloop(void) PARSE_PATH + PARSE_PUNCTUATION)) != NULL) { const char *name = wwwName(Home_Dir()); - len = strlen(name); + len = (unsigned) strlen(name); #ifdef VMS if (!strncasecomp(temp, name, len) && strlen(temp) > len) diff --git a/src/LYMap.c b/src/LYMap.c index edca37eb..3640029f 100644 --- a/src/LYMap.c +++ b/src/LYMap.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYMap.c,v 1.37 2009/01/01 22:30:15 tom Exp $ + * $LynxId: LYMap.c,v 1.38 2010/09/22 09:48:58 tom Exp $ * Lynx Client-side Image MAP Support LYMap.c * ================================== * @@ -617,7 +617,7 @@ static int LYLoadIMGmap(const char *arg, void LYPrintImgMaps(FILE *fp) { const char *only = HTLoadedDocumentURL(); - unsigned only_len = strlen(only); + size_t only_len = strlen(only); HTList *outer = LynxMaps; HTList *inner; LYImageMap *map; diff --git a/src/LYOptions.c b/src/LYOptions.c index e52e8750..676f9d99 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -1,4 +1,4 @@ -/* $LynxId: LYOptions.c,v 1.137 2010/05/05 09:48:38 tom Exp $ */ +/* $LynxId: LYOptions.c,v 1.138 2010/09/22 09:36:44 tom Exp $ */ #include <HTUtils.h> #include <HTFTP.h> #include <HTTP.h> /* 'reloading' flag */ @@ -2588,7 +2588,7 @@ static BOOL isLynxOptionsPage(const char *address, const char *portion) BOOL result = FALSE; if (!strncasecomp(address, STR_LYNXOPTIONS, LEN_LYNXOPTIONS)) { - unsigned len = strlen(portion); + unsigned len = (unsigned) strlen(portion); address += LEN_LYNXOPTIONS; if (!strncasecomp(address, portion, (int) len) diff --git a/src/LYPrettySrc.c b/src/LYPrettySrc.c index a89288f0..de9394e3 100644 --- a/src/LYPrettySrc.c +++ b/src/LYPrettySrc.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYPrettySrc.c,v 1.21 2010/04/30 09:26:14 tom Exp $ + * $LynxId: LYPrettySrc.c,v 1.22 2010/09/22 09:39:40 tom Exp $ * * HTML source syntax highlighting * by Vlad Harchev <hvv@hippo.ru> @@ -80,7 +80,7 @@ static int html_src_tag_index(char *tagname) { HTTag *tag = SGMLFindTag(&HTML_dtd, tagname); - return (tag && tag != &HTTag_unrecognized) ? tag - HTML_dtd.tags : -1; + return (tag && tag != &HTTag_unrecognized) ? (int) (tag - HTML_dtd.tags) : -1; } typedef enum { diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index e347b873..88c5215d 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYReadCFG.c,v 1.150 2010/06/18 00:11:35 tom Exp $ + * $LynxId: LYReadCFG.c,v 1.151 2010/09/22 09:54:46 tom Exp $ */ #ifndef NO_RULES #include <HTRules.h> @@ -717,7 +717,7 @@ static int keymap_fun(char *key) if (sselect_edi) { if (*sselect_edi) - select_edi = strtol(sselect_edi, endp, 10); + select_edi = (int) strtol(sselect_edi, endp, 10); if (**endp != '\0') { fprintf(stderr, gettext("invalid line-editor selection %s for key %s, selecting all\n"), @@ -1874,7 +1874,7 @@ void LYSetConfigValue(const char *name, #if defined(EXEC_LINKS) || defined(LYNXCGI_LINKS) case CONF_ADD_TRUSTED: - add_trusted(value, q->def_value); + add_trusted(value, (int) q->def_value); break; #endif diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c index 6e6f916d..fe2eb498 100644 --- a/src/LYShowInfo.c +++ b/src/LYShowInfo.c @@ -1,4 +1,4 @@ -/* $LynxId: LYShowInfo.c,v 1.69 2009/01/19 23:42:23 tom Exp $ */ +/* $LynxId: LYShowInfo.c,v 1.70 2010/09/22 09:35:55 tom Exp $ */ #include <HTUtils.h> #include <HTFile.h> #include <HTParse.h> @@ -210,7 +210,7 @@ int LYShowInfo(DocInfo *doc, char buf[MAX_LINE]; int buf_size; - if ((buf_size = readlink(temp, buf, sizeof(buf) - 1)) != -1) { + if ((buf_size = (int) readlink(temp, buf, sizeof(buf) - 1)) != -1) { buf[buf_size] = '\0'; } else { sprintf(buf, "%.*s", (int) sizeof(buf) - 1, diff --git a/src/LYStrings.c b/src/LYStrings.c index cd0ab51b..cf27f1dc 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -1,4 +1,4 @@ -/* $LynxId: LYStrings.c,v 1.173 2010/06/17 10:50:14 tom Exp $ */ +/* $LynxId: LYStrings.c,v 1.174 2010/09/22 10:52:38 tom Exp $ */ #include <HTUtils.h> #include <HTCJK.h> #include <UCAux.h> @@ -315,7 +315,7 @@ static char *LYFindInCloset(RecallType recall, char *base) { HTList *list = whichRecall(recall); char *data; - unsigned len = strlen(base); + size_t len = strlen(base); while (!HTList_isEmpty(list)) { data = (char *) HTList_nextObject(list); @@ -677,7 +677,7 @@ const char *LYmbcs_skip_cells(const char *data, do { result = LYmbcs_skip_glyphs(data, target--, utf_flag); - actual = LYstrExtent2(data, result - data); + actual = LYstrExtent2(data, (int) (result - data)); } while ((actual > 0) && (actual > n_cells)); return result; } @@ -987,7 +987,7 @@ static const char *expand_tiname(const char *first, size_t len, char **result, c if ((code = lookup_tiname(name, strnames)) >= 0 || (code = lookup_tiname(name, strfnames)) >= 0) { if (cur_term->type.Strings[code] != 0) { - LYstrncpy(*result, cur_term->type.Strings[code], final - *result); + LYstrncpy(*result, cur_term->type.Strings[code], (int) (final - *result)); (*result) += strlen(*result); } } @@ -1052,7 +1052,7 @@ static const char *expand_tichar(const char *first, char **result, char *final) char tmp[80]; LYstrncpy(tmp, first, limit); - value = strtol(tmp, &last, radix); + value = (int) strtol(tmp, &last, radix); if (last != 0 && last != tmp) first += (last - tmp); } @@ -1213,7 +1213,7 @@ int map_string_to_keysym(const char *str, int *keysym) long value = strtol(str, &tmp, 0); if (!isalnum(UCH(*tmp))) { - *keysym = value; + *keysym = (int) value; #ifndef USE_SLANG if (*keysym > 255) *keysym |= LKC_ISLKC; /* caller should remove this flag - kw */ @@ -1539,7 +1539,8 @@ static int LYmouse_menu(int x, int y, int atlink, int code) const char *choices[TOTAL_MENUENTRIES + 1]; int actions[TOTAL_MENUENTRIES]; - int c, c1, retlac, filter_out = (atlink ? ENT_ONLY_DOC : ENT_ONLY_LINK); + int c, c1, retlac; + unsigned filter_out = (atlink ? ENT_ONLY_DOC : ENT_ONLY_LINK); c = c1 = 0; while (c < (int) TOTAL_MENUENTRIES) { @@ -3813,12 +3814,12 @@ void LYRefreshEdit(EDREC * edit) do { const char *last = str + i; const char *next = LYmbcs_skip_glyphs(last, 1, utf_flag); - int j = (next - str); + int j = (int) (next - str); while (i < j) { edit->offset2col[i++] = cell + StartX; } - cell += LYstrExtent2(last, (next - last)); + cell += LYstrExtent2(last, (int) (next - last)); } while (i < dpy_bytes); edit->offset2col[i] = cell + StartX; } else { @@ -4005,7 +4006,7 @@ static unsigned options_width(const char **list) int count = 0; while (list[count] != 0) { - unsigned ncells = LYstrCells(list[count]); + unsigned ncells = (unsigned) LYstrCells(list[count]); if (ncells > width) { width = ncells; @@ -5179,7 +5180,8 @@ int LYgetstr(char *inputline, while (e1 < e) { if (*e1 < ' ') { /* Stop here? */ if (e1 > s) - LYEditInsert(&MyEdit, s, e1 - s, map_active, TRUE); + LYEditInsert(&MyEdit, s, (int) (e1 - s), + map_active, TRUE); s = e1; if (*e1 == '\t') { /* Replace by space */ LYEditInsert(&MyEdit, @@ -5194,7 +5196,7 @@ int LYgetstr(char *inputline, ++e1; } if (e1 > s) - LYEditInsert(&MyEdit, s, e1 - s, map_active, TRUE); + LYEditInsert(&MyEdit, s, (int) (e1 - s), map_active, TRUE); } get_clip_release(); break; @@ -5307,12 +5309,8 @@ int LYscanFloat2(const char **source, float *result) if (*src != '.') { temp = NULL; -#ifdef _WIN32_WINNT -#define WIN32_FIX (float) -#else -#define WIN32_FIX /* nothing */ -#endif - *result = WIN32_FIX strtol(src, &temp, 10); + frc_part = strtol(src, &temp, 10); + *result = (float) frc_part; src = temp; } if (src != 0 && *src == '.') { @@ -5321,11 +5319,11 @@ int LYscanFloat2(const char **source, float *result) temp = NULL; frc_part = strtol(src, &temp, 10); if (temp != 0) { - int digits = temp - src; + int digits = (int) (temp - src); while (digits-- > 0) - scale *= 10.0; - *result += (frc_part / scale); + scale *= (float) 10.0; + *result += ((float) frc_part / scale); } src = temp; } @@ -5962,7 +5960,7 @@ int UPPER8(int ch1, int ch2) if (uni_ch2 < 0) return UCH(ch1); uni_ch1 = UCTransToUni((char) ch1, current_char_set); - return (UniToLowerCase(uni_ch1) - UniToLowerCase(uni_ch2)); + return (int) (UniToLowerCase(uni_ch1) - UniToLowerCase(uni_ch2)); } } diff --git a/src/LYStyle.c b/src/LYStyle.c index 3378d5da..62b8a014 100644 --- a/src/LYStyle.c +++ b/src/LYStyle.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYStyle.c,v 1.67 2010/05/02 22:23:21 tom Exp $ + * $LynxId: LYStyle.c,v 1.68 2010/09/22 09:47:49 tom Exp $ * * character level styles for Lynx * (c) 1996 Rob Partington -- donated to the Lyncei (if they want it :-) @@ -222,8 +222,8 @@ static void parse_attributes(const char *mono, int curPair = 0; int iFg = (1 + (fA >= 0 ? fA : 0)); int iBg = (1 + (bA >= 0 ? bA : 0)); - int iBold = !!(cA & A_BOLD); - int iBlink = !!(cA & M_BLINK); + int iBold = !!((unsigned) cA & A_BOLD); + int iBlink = !!((unsigned) cA & M_BLINK); CTRACE2(TRACE_STYLE, (tfp, "parse_attributes %d/%d %d/%d %#x\n", fA, default_fg, bA, default_bg, cA)); @@ -376,7 +376,7 @@ where OBJECT is one of EM,STRONG,B,I,U,BLINK etc.\n\n"), buffer); HTTag *t = SGMLFindTag(&HTML_dtd, element); if (t && t->name) { - element_number = t - HTML_dtd.tags; + element_number = (int) (t - HTML_dtd.tags); } if (element_number >= HTML_A && element_number < HTML_ELEMENTS) { diff --git a/src/LYTraversal.c b/src/LYTraversal.c index 02d516d3..5f357654 100644 --- a/src/LYTraversal.c +++ b/src/LYTraversal.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYTraversal.c,v 1.27 2009/01/01 22:37:06 tom Exp $ + * $LynxId: LYTraversal.c,v 1.28 2010/09/22 09:42:40 tom Exp $ */ #include <HTUtils.h> #include <LYGlobalDefs.h> @@ -147,7 +147,7 @@ BOOLEAN lookup_reject(char *target) FILE *ifp; char *buffer = NULL; char *line = NULL; - unsigned len; + size_t len; int result = FALSE; if ((ifp = fopen(TRAVERSE_REJECT_FILE, TXT_R)) == NULL) { diff --git a/src/LYUtils.c b/src/LYUtils.c index d89b6963..81032d3a 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYUtils.c,v 1.195 2010/04/29 20:52:32 tom Exp $ + * $LynxId: LYUtils.c,v 1.196 2010/09/22 10:50:17 tom Exp $ */ #include <HTUtils.h> #include <HTTCP.h> @@ -1153,7 +1153,7 @@ void LYhighlight(int flag, if (avail_space > links[cur].l_form->size) avail_space = links[cur].l_form->size; - len = LYmbcs_skip_cells(text, avail_space, utf_flag) - text; + len = (int) (LYmbcs_skip_cells(text, avail_space, utf_flag) - text); LYwaddnstr(LYwin, text, (unsigned) len); while (len++ < avail_space) LYaddch('_'); @@ -3744,13 +3744,13 @@ void parse_restrictions(const char *s) p++; found = FALSE; - if (RESTRICT_NM_EQU(word, "all", p - word)) { + if (RESTRICT_NM_EQU(word, "all", (int) (p - word))) { found = TRUE; for (i = N_SPECIAL_RESTRICT_OPTIONS; i < TABLESIZE(restrictions); i++) *(restrictions[i].flag) = TRUE; - } else if (RESTRICT_NM_EQU(word, "default", p - word)) { + } else if (RESTRICT_NM_EQU(word, "default", (int) (p - word))) { found = TRUE; for (i = N_SPECIAL_RESTRICT_OPTIONS; i < TABLESIZE(restrictions); @@ -3758,7 +3758,7 @@ void parse_restrictions(const char *s) *(restrictions[i].flag) = (BOOLEAN) !restrictions[i].can; } else { for (i = 0; i < TABLESIZE(restrictions); i++) { - if (RESTRICT_NM_EQU(word, restrictions[i].name, p - word)) { + if (RESTRICT_NM_EQU(word, restrictions[i].name, (int) (p - word))) { *(restrictions[i].flag) = TRUE; found = TRUE; break; @@ -4765,7 +4765,7 @@ BOOLEAN LYExpandHostForURL(char **AllocatedString, while (*EndS && !WHITE(*EndS) && *EndS != ',') { EndS++; /* Find separator */ } - LYstrncpy(DomainSuffix, StartS, (EndS - StartS)); + LYstrncpy(DomainSuffix, StartS, (int) (EndS - StartS)); } } while ((GotHost == FALSE) && (*DomainSuffix != '\0')); @@ -4781,7 +4781,7 @@ BOOLEAN LYExpandHostForURL(char **AllocatedString, while (*EndP && !WHITE(*EndP) && *EndP != ',') { EndP++; /* Find separator */ } - LYstrncpy(DomainPrefix, StartP, (EndP - StartP)); + LYstrncpy(DomainPrefix, StartP, (int) (EndP - StartP)); } } while ((GotHost == FALSE) && (*DomainPrefix != '\0')); @@ -5715,7 +5715,7 @@ static BOOL IsOurSymlink(const char *name) char *buffer = typeMallocn(char, (unsigned) size); if (buffer != 0) { - while ((used = readlink(name, buffer, (unsigned) (size - 1))) == size + while ((used = (int) readlink(name, buffer, (unsigned) (size - 1))) == size - 1) { buffer = typeRealloc(char, buffer, (unsigned) (size *= 2)); @@ -6995,15 +6995,15 @@ int LYCopyFile(char *src, } else { FILE *fin, *fout; unsigned char buff[BUFSIZ]; - unsigned len; + size_t len; code = EOF; if ((fin = fopen(src, BIN_R)) != 0) { if ((fout = fopen(dst, BIN_W)) != 0) { code = 0; while ((len = fread(buff, 1, sizeof(buff), fin)) != 0) { - fwrite(buff, 1, len, fout); - if (ferror(fout)) { + if (fwrite(buff, 1, len, fout) < len + || ferror(fout)) { code = EOF; break; } @@ -7549,7 +7549,7 @@ int put_clip(const char *s) { char *cmd = LYGetEnv("RL_CLCOPY_CMD"); FILE *fh; - unsigned l = strlen(s), res; + size_t l = strlen(s), res; if (!cmd) return -1; diff --git a/src/LYrcFile.c b/src/LYrcFile.c index e93e9fd7..88915e0a 100644 --- a/src/LYrcFile.c +++ b/src/LYrcFile.c @@ -1,4 +1,4 @@ -/* $LynxId: LYrcFile.c,v 1.84 2010/06/20 16:42:27 tom Exp $ */ +/* $LynxId: LYrcFile.c,v 1.85 2010/09/22 09:48:18 tom Exp $ */ #include <HTUtils.h> #include <HTFTP.h> #include <LYUtils.h> @@ -182,7 +182,7 @@ BOOL LYgetEnum(Config_Enum * table, const char *name, int *result) { Config_Enum *found = 0; - unsigned len = strlen(name); + unsigned len = (unsigned) strlen(name); int match = 0; if (len != 0) { diff --git a/src/TRSTable.c b/src/TRSTable.c index f0b45dfe..460d00fc 100644 --- a/src/TRSTable.c +++ b/src/TRSTable.c @@ -1,5 +1,5 @@ /* - * $LynxId: TRSTable.c,v 1.25 2010/04/29 20:51:14 tom Exp $ + * $LynxId: TRSTable.c,v 1.26 2010/09/22 09:42:06 tom Exp $ * Simple table object * =================== * Authors @@ -1302,7 +1302,7 @@ static int Stbl_fakeFinishCellInTable(STable_info *me, int need_reserved = 0; int prev_reserved_last = -1; STable_rowinfo *prev_row; - int prev_row_n2 = lastrow - me->rows; + int prev_row_n2 = (int) (lastrow - me->rows); CTRACE2(TRACE_TRST, (tfp, @@ -1350,7 +1350,7 @@ static int Stbl_fakeFinishCellInTable(STable_info *me, Remember that STable_rowinfo is about logical (TR) table lines, not displayed lines. We need to duplicate the reservation structure when we fake new logical lines. */ - int prev_row_n = prev_row - me->rows; + int prev_row_n = (int) (prev_row - me->rows); STable_rowinfo *rows = typeRealloc(STable_rowinfo, me->rows, (unsigned) (me->allocated_rows + 1)); diff --git a/src/UCdomap.c b/src/UCdomap.c index f41093c2..4fffd8a3 100644 --- a/src/UCdomap.c +++ b/src/UCdomap.c @@ -1,5 +1,5 @@ /* - * $LynxId: UCdomap.c,v 1.79 2010/06/17 09:44:47 tom Exp $ + * $LynxId: UCdomap.c,v 1.80 2010/09/22 09:41:36 tom Exp $ * * UCdomap.c * ========= @@ -1197,7 +1197,7 @@ long int UCTransToUni(char ch_in, buffer[inx++] = (char) ch_iu; buffer[inx] = '\0'; - need = utf8_length(TRUE, buffer); + need = (unsigned) utf8_length(TRUE, buffer); if (need && (need + 1) == inx) { inx = 0; ptr = buffer; diff --git a/src/chrtrans/makeuctb.c b/src/chrtrans/makeuctb.c index 916e32fa..1858474c 100644 --- a/src/chrtrans/makeuctb.c +++ b/src/chrtrans/makeuctb.c @@ -1,5 +1,5 @@ /* - * $LynxId: makeuctb.c,v 1.44 2010/06/17 08:06:46 tom Exp $ + * $LynxId: makeuctb.c,v 1.45 2010/09/22 08:31:45 tom Exp $ * * makeuctb.c, derived from conmakehash.c - kw * @@ -135,7 +135,7 @@ static int getunicode(char **p0) return -1; } *p0 = p + 6; - return strtol((p + 2), 0, 16); + return (int) strtol((p + 2), 0, 16); } /* @@ -415,7 +415,7 @@ int main(int argc, char **argv) while (*p == ' ' || *p == '\t') { p++; } - RawOrEnc = strtol(p, 0, 10); + RawOrEnc = (int) strtol(p, 0, 10); Raw_found = 1; continue; @@ -501,7 +501,7 @@ int main(int argc, char **argv) while (*p == ' ' || *p == '\t') { p++; } - CodePage = strtol(p, 0, 10); + CodePage = (int) strtol(p, 0, 10); continue; } @@ -606,7 +606,7 @@ int main(int argc, char **argv) * of the specially recognized characters, so try to interpret * it as starting with a fontpos. */ - fp0 = strtol(p, &p1, 0); + fp0 = (int) strtol(p, &p1, 0); if (p1 == p) { fprintf(stderr, "Bad input line: %s\n", buffer); done(EX_DATAERR); @@ -618,7 +618,7 @@ int main(int argc, char **argv) } if (*p == '-') { p++; - fp1 = strtol(p, &p1, 0); + fp1 = (int) strtol(p, &p1, 0); if (p1 == p) { fprintf(stderr, "Bad input line: %s\n", buffer); done(EX_DATAERR); |