diff options
Diffstat (limited to 'src')
39 files changed, 537 insertions, 488 deletions
diff --git a/src/GridText.c b/src/GridText.c index c5dddab8..13d11148 100644 --- a/src/GridText.c +++ b/src/GridText.c @@ -1,5 +1,5 @@ /* - * $LynxId: GridText.c,v 1.162 2008/12/30 00:53:29 tom Exp $ + * $LynxId: GridText.c,v 1.163 2009/01/02 00:18:17 tom Exp $ * * Character grid hypertext object * =============================== @@ -1110,10 +1110,10 @@ HText *HText_new(HTParentAnchor *anchor) else self->hiddenlinkflag = LYHiddenLinks; self->hidden_links = NULL; - self->no_cache = ((anchor->no_cache || - anchor->post_data) - ? YES - : NO); + self->no_cache = (BOOLEAN) ((anchor->no_cache || + anchor->post_data) + ? YES + : NO); self->LastChar = '\0'; #ifndef USE_PRETTYSRC @@ -1727,7 +1727,7 @@ static void display_title(HText *text) } else { for (i = 0, j = 0; title[i]; i++) { if (title[i] != CH_ESC) { /* S/390 -- gil -- 1487 */ - tmp[j++] = title[i]; + tmp[j++] = UCH(title[i]); } } tmp[j] = '\0'; @@ -1747,7 +1747,7 @@ static void display_title(HText *text) } #ifdef USE_COLOR_STYLE if (s_forw_backw != NOSTYLE && (nhist || nhist_extra > 1)) { - int c = nhist ? ACS_LARROW : ' '; + chtype c = nhist ? ACS_LARROW : ' '; /* turn the FORWBACKW.ARROW style on */ LynxChangeStyle(s_forw_backw, STACK_ON); @@ -2951,7 +2951,8 @@ static void split_line(HText *text, unsigned split) } else if (IS_UTF_EXTRA(p[i])) { utfxtra_on_this_line++; } - if (p[i] == LY_SOFT_HYPHEN && (int) text->permissible_split < i) + if (p[i] == LY_SOFT_HYPHEN && + (int) text->permissible_split < i) text->permissible_split = i + 1; } ctrl_chars_on_this_line += utfxtra_on_this_line; @@ -3434,7 +3435,7 @@ static void split_line(HText *text, unsigned split) char *p2 = previous->data; for (; p2 < previous->data + justify_start_position; ++p2) - *p2 = (*p2 == HT_NON_BREAK_SPACE ? ' ' : *p2); + *p2 = (char) (*p2 == HT_NON_BREAK_SPACE ? ' ' : *p2); } } else { if (REALLY_CAN_JUSTIFY(text)) { @@ -3499,7 +3500,7 @@ static void blank_lines(HText *text, int newlines) { if (HText_LastLineEmpty(text, FALSE)) { /* No text on current line */ HTLine *line = text->last_line->prev; - BOOL first = (line == text->last_line); + BOOL first = (BOOL) (line == text->last_line); if (no_title && first) return; @@ -4398,14 +4399,14 @@ void HText_appendCharacter(HText *text, int ch) case EUC: if (text->kcode == SJIS) { SJIS_TO_EUC1(hi, lo, tmp); - line->data[line->size++] = tmp[0]; - line->data[line->size++] = tmp[1]; + line->data[line->size++] = (char) tmp[0]; + line->data[line->size++] = (char) tmp[1]; } else if (IS_EUC(hi, lo)) { #ifdef CONV_JISX0201KANA_JISX0208KANA JISx0201TO0208_EUC(hi, lo, &hi, &lo); #endif - line->data[line->size++] = hi; - line->data[line->size++] = lo; + line->data[line->size++] = (char) hi; + line->data[line->size++] = (char) lo; } else { CTRACE((tfp, "This character (%X:%X) doesn't seem Japanese\n", @@ -4424,12 +4425,12 @@ void HText_appendCharacter(HText *text, int ch) #endif { EUC_TO_SJIS1(hi, lo, tmp); - line->data[line->size++] = tmp[0]; - line->data[line->size++] = tmp[1]; + line->data[line->size++] = (char) tmp[0]; + line->data[line->size++] = (char) tmp[1]; } } else if (IS_SJIS_2BYTE(hi, lo)) { - line->data[line->size++] = hi; - line->data[line->size++] = lo; + line->data[line->size++] = (char) hi; + line->data[line->size++] = (char) lo; } else { line->data[line->size++] = '='; line->data[line->size++] = '='; @@ -4443,8 +4444,8 @@ void HText_appendCharacter(HText *text, int ch) break; } } else { - line->data[line->size++] = hi; - line->data[line->size++] = lo; + line->data[line->size++] = (char) hi; + line->data[line->size++] = (char) lo; } text->kanji_buf = 0; } @@ -4883,7 +4884,7 @@ static void free_enclosed_stbl(HText *me) /* Finish simple table handling * Return TRUE if the table is nested inside another table. */ -int HText_endStblTABLE(HText *me) +BOOLEAN HText_endStblTABLE(HText *me) { int ncols, lines_changed = 0; STable_info *enclosing = NULL; @@ -4934,7 +4935,7 @@ int HText_endStblTABLE(HText *me) CTRACE((tfp, "endStblTABLE: have%s enclosing table (%p)\n", enclosing == 0 ? " NO" : "", (void *) enclosing)); - return enclosing != 0; + return (BOOLEAN) (enclosing != 0); } /* Start simple table row @@ -8420,15 +8421,18 @@ void HTuncache_current_document(void) #ifdef USE_SOURCE_CACHE +/* dummy - kw */ static HTProtocol scm = -{"source-cache-mem", 0, 0}; /* dummy - kw */ +{ + "source-cache-mem", 0, 0 +}; static BOOLEAN useSourceCache(void) { BOOLEAN result = FALSE; if (LYCacheSource == SOURCE_CACHE_FILE) { - result = (HTMainAnchor->source_cache_file != 0); + result = (BOOLEAN) (HTMainAnchor->source_cache_file != 0); CTRACE((tfp, "SourceCache: file-cache%s found\n", result ? "" : " not")); } @@ -8440,7 +8444,7 @@ static BOOLEAN useMemoryCache(void) BOOLEAN result = FALSE; if (LYCacheSource == SOURCE_CACHE_MEMORY) { - result = (HTMainAnchor->source_cache_chunk != 0); + result = (BOOLEAN) (HTMainAnchor->source_cache_chunk != 0); CTRACE((tfp, "SourceCache: memory-cache%s found\n", result ? "" : " not")); } @@ -8636,17 +8640,17 @@ BOOLEAN HTdocument_settings_changed(void) LYlines)); } - return (HTMainText->clickable_images != clickable_images || - HTMainText->pseudo_inline_alts != pseudo_inline_alts || - HTMainText->verbose_img != verbose_img || - HTMainText->raw_mode != LYUseDefaultRawMode || - HTMainText->historical_comments != historical_comments || - (HTMainText->minimal_comments != minimal_comments && - !historical_comments) || - HTMainText->soft_dquotes != soft_dquotes || - HTMainText->old_dtd != Old_DTD || - HTMainText->keypad_mode != keypad_mode || - HTMainText->disp_cols != DISPLAY_COLS); + return (BOOLEAN) (HTMainText->clickable_images != clickable_images || + HTMainText->pseudo_inline_alts != pseudo_inline_alts || + HTMainText->verbose_img != verbose_img || + HTMainText->raw_mode != LYUseDefaultRawMode || + HTMainText->historical_comments != historical_comments || + (HTMainText->minimal_comments != minimal_comments && + !historical_comments) || + HTMainText->soft_dquotes != soft_dquotes || + HTMainText->old_dtd != Old_DTD || + HTMainText->keypad_mode != keypad_mode || + HTMainText->disp_cols != DISPLAY_COLS); } #endif @@ -9501,7 +9505,7 @@ char *HText_setLastOptionValue(HText *text, char *value, } else { for (i = 0, j = 0; cp[i]; i++) { if (cp[i] != CH_ESC) { /* S/390 -- gil -- 1604 */ - tmp[j++] = cp[i]; + tmp[j++] = UCH(cp[i]); } } } @@ -9536,10 +9540,10 @@ char *HText_setLastOptionValue(HText *text, char *value, last_input->orig_submit_value = last_input->select_list->cp_submit_value; last_input->value_cs = new_ptr->value_cs; } else { - int newlen = strlen(new_ptr->name); - int curlen = (HTCurSelectedOptionValue - ? strlen(HTCurSelectedOptionValue) - : 0); + int newlen = (int) strlen(new_ptr->name); + int curlen = (int) (HTCurSelectedOptionValue + ? strlen(HTCurSelectedOptionValue) + : 0); /* * Make the selected Option Value as long as @@ -9721,7 +9725,7 @@ int HText_beginInput(HText *text, BOOL underline, } else { for (i = 0, j = 0; IValue[i]; i++) { if (IValue[i] != CH_ESC) { /* S/390 -- gil -- 1621 */ - tmp[j++] = IValue[i]; + tmp[j++] = UCH(IValue[i]); } } } @@ -9983,7 +9987,7 @@ int HText_beginInput(HText *text, BOOL underline, sprintf(marker, "[%d]", a->number); adjust_marker = strlen(marker); if (number_fields_on_left) { - BOOL had_bracket = (f->type == F_OPTION_LIST_TYPE); + BOOL had_bracket = (BOOL) (f->type == F_OPTION_LIST_TYPE); HText_appendText(text, had_bracket ? (marker + 1) : marker); if (had_bracket) @@ -10311,7 +10315,7 @@ static void UpdateBoundary(char **Boundary, && !memcmp(want, text + j, have)) { char temp[2]; - temp[0] = isdigit(UCH(text[have + j])) ? 'a' : '0'; + temp[0] = (char) (isdigit(UCH(text[have + j])) ? 'a' : '0'); temp[1] = '\0'; StrAllocCat(want, temp); ++have; @@ -10367,12 +10371,12 @@ static char *convert_to_base64(const char *src, *r++ = *c++; chunk = 0; } - c1 = *str++; - c2 = *str++; + c1 = UCH(*str++); + c2 = UCH(*str++); *r++ = basis_64[c1 >> 2]; *r++ = basis_64[((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4)]; if (len > 2) { - c3 = *str++; + c3 = UCH(*str++); *r++ = basis_64[((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6)]; *r++ = basis_64[c3 & 0x3F]; } else if (len == 2) { @@ -11708,7 +11712,7 @@ void HText_setKcode(HText *text, const char *charset, if (!charset && !p_in) { return; } - charset_explicit = charset ? TRUE : FALSE; + charset_explicit = (BOOLEAN) (charset ? TRUE : FALSE); /* * If no explicit charset string, use the implied one. - kw */ @@ -12470,10 +12474,10 @@ static void update_subsequent_anchors(int newlines, */ static BOOLEAN IsFormsTextarea(FormInfo * form, TextAnchor *anchor_ptr) { - return ((anchor_ptr->link_type == INPUT_ANCHOR) && - (anchor_ptr->input_field->type == F_TEXTAREA_TYPE) && - (anchor_ptr->input_field->number == form->number) && - !strcmp(anchor_ptr->input_field->name, form->name)); + return (BOOLEAN) ((anchor_ptr->link_type == INPUT_ANCHOR) && + (anchor_ptr->input_field->type == F_TEXTAREA_TYPE) && + (anchor_ptr->input_field->number == form->number) && + !strcmp(anchor_ptr->input_field->name, form->name)); } static int finish_ExtEditForm(LinkInfo * form_link, TextAnchor *start_anchor, @@ -12969,7 +12973,7 @@ int HText_InsertFile(LinkInfo * form_link) * Read it into our buffer (abort on 0-length file). */ if ((stat(fn, &stat_info) < 0) || - ((size = stat_info.st_size) == 0)) { + ((size = (size_t) stat_info.st_size) == 0)) { HTInfoMsg(FILE_INSERT_0_LENGTH); CTRACE((tfp, "GridText: file insert aborted - file=|%s|- was 0-length\n", @@ -14019,7 +14023,7 @@ void redraw_lines_of_link(int cur) ++count) { col = LYGetHilitePos(cur, count); LYmove(row++, col); - redraw_part_of_line(todr1, text, strlen(text), HTMainText); + redraw_part_of_line(todr1, text, (int) strlen(text), HTMainText); todr1 = todr1->next; } #undef pvtTITLE_HEIGHT @@ -14114,7 +14118,7 @@ static int LYHandleCache(const char *arg, if (sscanf(arg, STR_LYNXCACHE "/%d", &x) == 1 && x > 0) { CTRACE((tfp, "LYNXCACHE number is %d\n", x)); _statusline(CACHE_D_OR_CANCEL); - c = LYgetch_single(); + c = (char) LYgetch_single(); if (c == 'D') { HText *t = (HText *) HTList_objectAt(loaded_texts, x - 1); @@ -14144,7 +14148,7 @@ static int LYHandleCache(const char *arg, * Load HTML strings into buf and pass buf to the target for parsing and * rendering. */ -#define PUTS(buf) (*target->isa->put_block)(target, buf, strlen(buf)) +#define PUTS(buf) (*target->isa->put_block)(target, buf, (int) strlen(buf)) HTSprintf0(&buf, "<html>\n<head>\n<title>%s</title>\n</head>\n<body>\n", diff --git a/src/GridText.h b/src/GridText.h index 1d39ea70..a3ed2b6e 100644 --- a/src/GridText.h +++ b/src/GridText.h @@ -1,5 +1,5 @@ /* - * $LynxId: GridText.h,v 1.60 2008/12/29 21:36:00 tom Exp $ + * $LynxId: GridText.h,v 1.61 2009/01/01 23:02:02 tom Exp $ * * Specialities of GridText as subclass of HText */ @@ -181,7 +181,7 @@ US-ASCII control characters <32 which are not defined in Unicode standard extern void *HText_pool_calloc(HText *text, unsigned size); /* "simple table" stuff */ - extern int HText_endStblTABLE(HText *); + extern BOOLEAN HText_endStblTABLE(HText *); extern int HText_trimCellLines(HText *text); extern void HText_cancelStbl(HText *); extern void HText_endStblCOLGROUP(HText *); diff --git a/src/HTFWriter.c b/src/HTFWriter.c index c3273e90..5f882cd1 100644 --- a/src/HTFWriter.c +++ b/src/HTFWriter.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTFWriter.c,v 1.90 2007/08/02 19:40:50 tom Exp $ + * $LynxId: HTFWriter.c,v 1.91 2009/01/01 22:58:59 tom Exp $ * * FILE WRITER HTFWrite.h * =========== @@ -134,7 +134,7 @@ static void HTFWriter_write(HTStream *me, const char *s, int l) size_t result; if (me->fp) { - result = fwrite(s, 1, l, me->fp); + result = fwrite(s, 1, (unsigned) l, me->fp); if (result != (size_t) l) { HTFWriter_error(me, "HTFWriter_write"); } @@ -199,7 +199,7 @@ static void HTFWriter_free(HTStream *me) * and remove any previous uncompressed copy. - FM */ StrAllocCopy(path, me->anchor->FileCache); - if ((len = strlen(path)) > 3 && + if ((len = (int) strlen(path)) > 3 && (!strcasecomp(&path[len - 2], "gz") || !strcasecomp(&path[len - 2], "zz"))) { #ifdef USE_ZLIB diff --git a/src/HTInit.c b/src/HTInit.c index 12caeb65..015d5c39 100644 --- a/src/HTInit.c +++ b/src/HTInit.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTInit.c,v 1.69 2008/09/10 23:17:45 tom Exp $ + * $LynxId: HTInit.c,v 1.70 2009/01/01 22:58:06 tom Exp $ * * Configuration-specific Initialization HTInit.c * ---------------------------------------- @@ -327,7 +327,7 @@ static void TrimCommand(char *command) continue; } } - *d++ = ch; + *d++ = (char) ch; c0 = ch; } *d = '\0'; @@ -608,7 +608,7 @@ static char *LYGetContentType(const char *name, */ BOOL LYMailcapUsesPctS(const char *controlstring) { - int result = FALSE; + BOOL result = FALSE; const char *from; const char *next; int prefixed = 0; diff --git a/src/HTML.c b/src/HTML.c index 9ac89ab6..f1de8177 100644 --- a/src/HTML.c +++ b/src/HTML.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTML.c,v 1.117 2008/12/29 21:22:28 tom Exp $ + * $LynxId: HTML.c,v 1.118 2009/01/01 23:08:07 tom Exp $ * * Structured stream to Rich hypertext converter * ============================================ @@ -672,7 +672,8 @@ void HTML_write(HTStructured * me, const char *s, int l) string (resolution of relative URLs etc.). This variable only used locally here, don't confuse with LYinternal_flag which is for overriding non-caching similar to LYoverride_no_cache. - kw */ -#define CHECK_FOR_INTERN(flag,s) flag = (s && (*s=='#' || *s=='\0')) ? TRUE : FALSE +#define CHECK_FOR_INTERN(flag,s) \ + flag = (BOOLEAN) ((s && (*s=='#' || *s=='\0')) ? TRUE : FALSE) /* Last argument to pass to HTAnchor_findChildAndLink() calls, just an abbreviation. - kw */ @@ -693,10 +694,10 @@ static void free_Style_className(void) static void addClassName(const char *prefix, const char *actual, - int length) + unsigned length) { - int offset = strlen(prefix); - unsigned have = (Style_className_end - Style_className); + unsigned offset = strlen(prefix); + unsigned have = (unsigned) (Style_className_end - Style_className); unsigned need = (offset + length + 1); if ((have + need) >= Style_className_len) { @@ -1064,9 +1065,9 @@ static int HTML_start_element(HTStructured * me, int element_number, force_classname = FALSE; if (force_current_tag_style == FALSE) { - current_tag_style = class_name[0] - ? -1 - : cached_tag_styles[element_number]; + current_tag_style = (class_name[0] + ? -1 + : cached_tag_styles[element_number]); } else { force_current_tag_style = FALSE; } @@ -5279,7 +5280,7 @@ static int HTML_start_element(HTStructured * me, int element_number, if (opnum > 0 && opnum < 100000) { sprintf(marker, "(%d)", opnum); HTML_put_string(me, marker); - for (i = strlen(marker); i < 5; ++i) { + for (i = (int) strlen(marker); i < 5; ++i) { HTML_put_character(me, '_'); } } @@ -7223,7 +7224,7 @@ static int HTML_end_element(HTStructured * me, int element_number, */ int HTML_put_entity(HTStructured * me, int entity_number) { - int nent = HTML_dtd.number_of_entities; + int nent = (int) HTML_dtd.number_of_entities; if (entity_number < nent) { HTML_put_string(me, p_entity_values[entity_number]); @@ -7944,7 +7945,7 @@ static void CacheThru_write(HTStream *me, const char *str, int l) { if (me->status == HT_OK && l != 0) { if (me->fp) { - fwrite(str, 1, l, me->fp); + fwrite(str, 1, (unsigned) l, me->fp); if (ferror(me->fp)) me->status = HT_ERROR; } else if (me->chunk) { diff --git a/src/LYBookmark.c b/src/LYBookmark.c index 8c744f08..6d3a9caf 100644 --- a/src/LYBookmark.c +++ b/src/LYBookmark.c @@ -1,3 +1,6 @@ +/* + * $LynxId: LYBookmark.c,v 1.62 2009/01/02 00:01:00 tom Exp $ + */ #include <HTUtils.h> #include <HTAlert.h> #include <HTFile.h> @@ -492,7 +495,7 @@ void remove_bookmark_link(int cur, * Explicitly preserve bookmark file mode on Unix. - DSL */ if (stat(filename_buffer, &stat_buf) == 0) { - regular = (S_ISREG(stat_buf.st_mode) && stat_buf.st_nlink == 1); + regular = (BOOLEAN) (S_ISREG(stat_buf.st_mode) && stat_buf.st_nlink == 1); mode = ((stat_buf.st_mode & 0777) | 0600); /* make it writable */ (void) chmod(newfile, mode); if ((nfp = LYReopenTemp(newfile)) == NULL) { @@ -845,7 +848,7 @@ int select_menu_multi_bookmarks(void) MBM_tmp_count = 0; for (c = MBM_from; c <= MBM_to; c++) { LYmove(3 + MBM_tmp_count, 5); - LYaddch(LYindex2MBM(c)); + LYaddch((chtype) LYindex2MBM(c)); LYaddstr(" : "); if (MBM_A_subdescript[c]) LYaddstr(MBM_A_subdescript[c]); diff --git a/src/LYCgi.c b/src/LYCgi.c index 45ec8ee6..2274234c 100644 --- a/src/LYCgi.c +++ b/src/LYCgi.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYCgi.c,v 1.53 2008/12/07 22:13:52 tom Exp $ + * $LynxId: LYCgi.c,v 1.54 2009/01/01 22:39:06 tom Exp $ * Lynx CGI support LYCgi.c * ================ * @@ -54,8 +54,8 @@ struct _HTStream { }; static char **env = NULL; /* Environment variables */ -static int envc_size = 0; /* Slots in environment array */ -static int envc = 0; /* Slots used so far */ +static unsigned envc_size = 0; /* Slots in environment array */ +static unsigned envc = 0; /* Slots used so far */ static HTList *alloced = NULL; #ifdef LYNXCGI_LINKS @@ -449,7 +449,7 @@ static int LYLoadCGI(const char *arg, remaining = BStrLen(anAnchor->post_data); while ((written = write(fd1[1], BStrData(anAnchor->post_data) + total_written, - remaining)) != 0) { + (unsigned) remaining)) != 0) { if (written < 0) { #ifdef EINTR if (errno == EINTR) @@ -585,7 +585,7 @@ static int LYLoadCGI(const char *arg, } } - argv = (char **) malloc(argv_cnt * sizeof(char *)); + argv = (char **) malloc((unsigned) argv_cnt * sizeof(char *)); if (argv == NULL) { outofmem(__FILE__, "LYCgi"); diff --git a/src/LYCharUtils.c b/src/LYCharUtils.c index 78cfe0d2..c201d69d 100644 --- a/src/LYCharUtils.c +++ b/src/LYCharUtils.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYCharUtils.c,v 1.93 2008/12/29 21:22:28 tom Exp $ + * $LynxId: LYCharUtils.c,v 1.94 2009/01/01 22:32:39 tom Exp $ * * Functions associated with LYCharSets.c and the Lynx version of HTML.c - FM * ========================================================================== @@ -113,7 +113,10 @@ void LYEntify(char **str, * Allocate space and convert. - FM */ q = typecallocn(char, - (strlen(*str) + (4 * amps) + (3 * lts) + (3 * gts) + 1)); + (strlen(*str) + + (unsigned)(4 * amps) + + (unsigned)(3 * lts) + + (unsigned)(3 * gts) + 1)); if ((cp = q) == NULL) outofmem(__FILE__, "LYEntify"); for (p = *str; *p; p++) { @@ -261,7 +264,7 @@ void LYTrimTail(char *str) if (isEmpty(str)) return; - i = strlen(str) - 1; + i = (int) strlen(str) - 1; while (i >= 0) { if (WHITE(str[i])) str[i] = '\0'; @@ -1532,7 +1535,7 @@ char **LYUCFullyTranslateString(char **str, state = S_recover; break; } else { - code = lcode; + code = (UCode_t) lcode; if ((code == 1) || (code > 127 && code < 156)) { /* @@ -2074,7 +2077,7 @@ char *LYParseTagParam(char *from, } if (strlen(string) < len) return NULL; - } while (strncasecomp(string, name, len) != 0); + } while (strncasecomp(string, name, (int) len) != 0); string += len; while (*string != '\0' && (isspace(UCH(*string)) || *string == '=')) { string++; diff --git a/src/LYCookie.c b/src/LYCookie.c index 7527de37..e3ce7976 100644 --- a/src/LYCookie.c +++ b/src/LYCookie.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYCookie.c,v 1.94 2008/12/14 19:38:59 tom Exp $ + * $LynxId: LYCookie.c,v 1.95 2009/01/01 22:28:57 tom Exp $ * * Lynx Cookie Support LYCookie.c * =================== @@ -131,7 +131,7 @@ static void MemAllocCopy(char **dest, return; } - temp = typecallocn(char, (end - start) + 1); + temp = typecallocn(char, (unsigned)(end - start) + 1); if (temp == NULL) outofmem(__FILE__, "MemAllocCopy"); LYstrncpy(temp, start, (end - start)); @@ -220,7 +220,7 @@ static BOOLEAN host_matches(const char *A, * in Section 2 of draft-ietf-http-state-man-mec-10.txt. */ if (*B == '.' && B[1] != '\0' && B[1] != '.' && *A != '.') { - int diff = (strlen(A) - strlen(B)); + int diff = (int) (strlen(A) - strlen(B)); if (diff > 0) { if (!strcasecomp((A + diff), B)) @@ -263,7 +263,7 @@ static BOOLEAN port_matches(int port, */ static int ignore_trailing_slash(const char *a) { - int len = strlen(a); + int len = (int) strlen(a); while (len > 1 && a[len - 1] == '/') --len; @@ -282,7 +282,7 @@ static BOOL is_prefix(const char *a, const char *b) if (len_a > len_b) { return FALSE; } else { - if (strncmp(a, b, len_a) != 0) { + if (strncmp(a, b, (unsigned) len_a) != 0) { return FALSE; } if (len_a < len_b && (len_a > 1 || a[0] != '/')) { @@ -741,7 +741,7 @@ static char *scan_cookie_sublist(char *hostname, * goes before the first cookie. */ HTSprintf0(&header, "$Version=\"%d\"; ", co->version); - len += strlen(header); + len += (int) strlen(header); } } else { /* @@ -787,7 +787,7 @@ static char *scan_cookie_sublist(char *hostname, StrAllocCat(header, "\""); len++; } - len += (strlen(co->name) + strlen(co->value) + 1); + len += (int) (strlen(co->name) + strlen(co->value) + 1); /* * For Version 1 (or greater) cookies, add $PATH, $PORT and/or * $DOMAIN attributes for the cookie if they were specified via a @@ -801,7 +801,7 @@ static char *scan_cookie_sublist(char *hostname, StrAllocCat(header, "; $Path=\""); StrAllocCat(header, co->path); StrAllocCat(header, "\""); - len += (strlen(co->path) + 10); + len += (int) (strlen(co->path) + 10); } if (co->PortList && isdigit(UCH(*co->PortList))) { /* @@ -810,7 +810,7 @@ static char *scan_cookie_sublist(char *hostname, StrAllocCat(header, "; $Port=\""); StrAllocCat(header, co->PortList); StrAllocCat(header, "\""); - len += (strlen(co->PortList) + 10); + len += (int) (strlen(co->PortList) + 10); } if (co->domain && (co->flags & COOKIE_FLAG_DOMAIN_SET)) { /* @@ -819,7 +819,7 @@ static char *scan_cookie_sublist(char *hostname, StrAllocCat(header, "; $Domain=\""); StrAllocCat(header, co->domain); StrAllocCat(header, "\""); - len += (strlen(co->domain) + 12); + len += (int) (strlen(co->domain) + 12); } } } @@ -844,7 +844,7 @@ static char *alloc_attr_value(const char *value_start, if (value_len > max_cookies_buffer) { value_len = max_cookies_buffer; } - value = typecallocn(char, value_len + 1); + value = typecallocn(char, (unsigned) value_len + 1); if (value == NULL) outofmem(__FILE__, "LYProcessSetCookies"); @@ -907,7 +907,7 @@ static unsigned parse_attribute(unsigned flags, */ cur_cookie->comment == NULL) { StrAllocCopy(cur_cookie->comment, value); - *cookie_len += strlen(cur_cookie->comment); + *cookie_len += (int) strlen(cur_cookie->comment); } } else if (is_attr("commentURL", 10)) { known_attr = YES; @@ -929,7 +929,7 @@ static unsigned parse_attribute(unsigned flags, if ((url_type = is_url(cur_cookie->commentURL)) && (url_type == HTTP_URL_TYPE || url_type == HTTPS_URL_TYPE)) { - *cookie_len += strlen(cur_cookie->commentURL); + *cookie_len += (int) strlen(cur_cookie->commentURL); } else { CTrace((tfp, "LYProcessSetCookies: Rejecting commentURL value '%s'\n", @@ -944,7 +944,7 @@ static unsigned parse_attribute(unsigned flags, * Don't process a repeat domain. - FM */ !(cur_cookie->flags & COOKIE_FLAG_DOMAIN_SET)) { - *cookie_len -= strlen(cur_cookie->domain); + *cookie_len -= (int) strlen(cur_cookie->domain); /* * If the value does not have a lead dot, but does have an embedded * dot, and is not an exact match to the hostname, nor is a numeric @@ -975,7 +975,7 @@ static unsigned parse_attribute(unsigned flags, } else { StrAllocCopy(cur_cookie->domain, value); } - *cookie_len += strlen(cur_cookie->domain); + *cookie_len += (int) strlen(cur_cookie->domain); cur_cookie->flags |= COOKIE_FLAG_DOMAIN_SET; } } else if (is_attr("path", 4)) { @@ -985,9 +985,9 @@ static unsigned parse_attribute(unsigned flags, * Don't process a repeat path. - FM */ !(cur_cookie->flags & COOKIE_FLAG_PATH_SET)) { - *cookie_len -= strlen(cur_cookie->path); + *cookie_len -= (int) strlen(cur_cookie->path); StrAllocCopy(cur_cookie->path, value); - *cookie_len += (cur_cookie->pathlen = strlen(cur_cookie->path)); + *cookie_len += (cur_cookie->pathlen = (int) strlen(cur_cookie->path)); cur_cookie->flags |= COOKIE_FLAG_PATH_SET; } } else if (is_attr("port", 4)) { @@ -1008,7 +1008,7 @@ static unsigned parse_attribute(unsigned flags, flags |= FLAGS_INVALID_PORT; } else { StrAllocCopy(cur_cookie->PortList, value); - *cookie_len += strlen(cur_cookie->PortList); + *cookie_len += (int) strlen(cur_cookie->PortList); } known_attr = YES; } else { @@ -1020,7 +1020,7 @@ static unsigned parse_attribute(unsigned flags, */ if (cur_cookie->PortList == NULL) { HTSprintf0(&(cur_cookie->PortList), "%d", port); - *cookie_len += strlen(cur_cookie->PortList); + *cookie_len += (int) strlen(cur_cookie->PortList); } known_attr = YES; } @@ -1368,13 +1368,13 @@ static void LYProcessSetCookies(const char *SetCookie, cookie_len = 0; NumCookies++; MemAllocCopy(&(cur_cookie->name), attr_start, attr_end); - cookie_len += strlen(cur_cookie->name); + cookie_len += (int) strlen(cur_cookie->name); MemAllocCopy(&(cur_cookie->value), value_start, value_end); - cookie_len += strlen(cur_cookie->value); + cookie_len += (int) strlen(cur_cookie->value); StrAllocCopy(cur_cookie->domain, hostname); - cookie_len += strlen(cur_cookie->domain); + cookie_len += (int) strlen(cur_cookie->domain); StrAllocCopy(cur_cookie->path, path); - cookie_len += (cur_cookie->pathlen = strlen(cur_cookie->path)); + cookie_len += (cur_cookie->pathlen = (int) strlen(cur_cookie->path)); cur_cookie->port = port; parse_flags = 0; cur_cookie->quoted = TRUE; @@ -1660,13 +1660,13 @@ static void LYProcessSetCookies(const char *SetCookie, NumCookies++; cookie_len = 0; MemAllocCopy(&(cur_cookie->name), attr_start, attr_end); - cookie_len += strlen(cur_cookie->name); + cookie_len += (int) strlen(cur_cookie->name); MemAllocCopy(&(cur_cookie->value), value_start, value_end); - cookie_len += strlen(cur_cookie->value); + cookie_len += (int) strlen(cur_cookie->value); StrAllocCopy(cur_cookie->domain, hostname); - cookie_len += strlen(cur_cookie->domain); + cookie_len += (int) strlen(cur_cookie->domain); StrAllocCopy(cur_cookie->path, path); - cookie_len += (cur_cookie->pathlen = strlen(cur_cookie->path)); + cookie_len += (cur_cookie->pathlen = (int) strlen(cur_cookie->path)); cur_cookie->port = port; parse_flags = 0; cur_cookie->quoted = Quoted; @@ -1935,7 +1935,7 @@ void LYLoadCookies(char *cookie_file) tok_loop, (int) (tok_out - buf), tok_out)); LYstrncpy(tok_values[tok_loop].s, tok_out, - tok_values[tok_loop].n); + (int) tok_values[tok_loop].n); /* * It looks like strtok ignores a leading delimiter, * which makes things a bit more interesting. Something @@ -1967,7 +1967,7 @@ void LYLoadCookies(char *cookie_file) } else { StrAllocCopy(moo->value, value); } - moo->pathlen = strlen(moo->path); + moo->pathlen = (int) strlen(moo->path); /* * Justification for following flags: * COOKIE_FLAG_FROM_FILE So we know were it comes from. @@ -2393,7 +2393,7 @@ static int LYHandleCookies(const char *arg, * Load HTML strings into buf and pass buf to the target for parsing and * rendering. - FM */ -#define PUTS(buf) (*target->isa->put_block)(target, buf, strlen(buf)) +#define PUTS(buf) (*target->isa->put_block)(target, buf, (int) strlen(buf)) HTSprintf0(&buf, "<html>\n<head>\n<title>%s</title>\n</head>\n<body>\n", diff --git a/src/LYExtern.c b/src/LYExtern.c index d3453a0d..0e5783c8 100644 --- a/src/LYExtern.c +++ b/src/LYExtern.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYExtern.c,v 1.41 2008/12/29 01:34:31 tom Exp $ + * $LynxId: LYExtern.c,v 1.42 2009/01/01 22:07:00 tom Exp $ * External application support. This feature allows lynx to pass a given URL to an external program. @@ -269,7 +269,7 @@ static char *lookup_external(char *param, } if (length > 1) { if (pass == 0) { - choices = typecallocn(char *, length + 1); + choices = typecallocn(char *, (unsigned) length + 1); } else { choices[num_choices] = 0; } diff --git a/src/LYForms.c b/src/LYForms.c index 30db75fb..1e3b5af8 100644 --- a/src/LYForms.c +++ b/src/LYForms.c @@ -1,4 +1,4 @@ -/* $LynxId: LYForms.c,v 1.79 2008/09/06 14:40:45 tom Exp $ */ +/* $LynxId: LYForms.c,v 1.80 2009/01/01 23:21:07 tom Exp $ */ #include <HTUtils.h> #include <HTCJK.h> #include <HTTP.h> @@ -372,7 +372,7 @@ static int form_getstr(int cur, char *value = form->value; int ch; int far_col; - int max_length; + unsigned max_length; int startcol, startline; BOOL HaveMaxlength = FALSE; int action, repeat; @@ -398,10 +398,10 @@ static int form_getstr(int cur, * Make sure the form field value does not exceed our buffer. - FM */ max_length = ((form->maxlength > 0 && - form->maxlength < sizeof(MyEdit.buffer)) ? - form->maxlength : - (sizeof(MyEdit.buffer) - 1)); - if (strlen(form->value) > (size_t) max_length) { + form->maxlength < sizeof(MyEdit.buffer)) + ? form->maxlength + : (sizeof(MyEdit.buffer) - 1)); + if (strlen(form->value) > max_length) { /* * We can't fit the entire value into the editing buffer, so enter as * much of the tail as fits. - FM @@ -421,7 +421,7 @@ static int form_getstr(int cur, /* * Print panned line */ - LYSetupEdit(&MyEdit, value, max_length, (far_col - startcol)); + LYSetupEdit(&MyEdit, value, (int) max_length, (far_col - startcol)); MyEdit.pad = '_'; MyEdit.hidden = (BOOL) (form->type == F_PASSWORD_TYPE); if (use_last_tfpos && LastTFPos >= 0 && LastTFPos < MyEdit.strlen) { @@ -603,7 +603,7 @@ static int form_getstr(int cur, if (!s) break; - len = strlen((const char *) s); + len = (int) strlen((const char *) s); e = s + len; if (len > 0) { @@ -630,10 +630,10 @@ static int form_getstr(int cur, if (e1 + 1 < e && *e1 == '\n') StrAllocCopy(buf, (char *) e1 + 1); /* Survive _release() */ get_clip_release(); - if (MyEdit.strlen >= max_length) { + if (MyEdit.strlen >= (int) max_length) { HaveMaxlength = TRUE; } else if (HaveMaxlength && - MyEdit.strlen < max_length) { + MyEdit.strlen < (int) max_length) { HaveMaxlength = FALSE; _statusline(ENTER_TEXT_ARROWS_OR_TAB); } @@ -781,10 +781,10 @@ static int form_getstr(int cur, } #endif /* SUPPORT_MULTIBYTE_EDIT */ } - if (MyEdit.strlen >= max_length) { + if (MyEdit.strlen >= (int) max_length) { HaveMaxlength = TRUE; } else if (HaveMaxlength && - MyEdit.strlen < max_length) { + MyEdit.strlen < (int) max_length) { HaveMaxlength = FALSE; _statusline(ENTER_TEXT_ARROWS_OR_TAB); } @@ -811,8 +811,8 @@ static int form_getstr(int cur, */ StrAllocCopy(form->value, MyEdit.buffer); } else { - int old_len = strlen(form->value); - int new_len = strlen(value); + int old_len = (int) strlen(form->value); + int new_len = (int) strlen(value); /* * Combine the modified tail with the unmodified head. - FM diff --git a/src/LYHistory.c b/src/LYHistory.c index 46ec5637..8c88b753 100644 --- a/src/LYHistory.c +++ b/src/LYHistory.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYHistory.c,v 1.72 2008/09/10 23:09:21 tom Exp $ + * $LynxId: LYHistory.c,v 1.73 2009/01/01 23:22:12 tom Exp $ */ #include <HTUtils.h> #include <HTTP.h> @@ -344,7 +344,7 @@ void LYAllocHistory(int entries) int save = size_history; size_history = (entries + 2) * 2; - want = size_history * sizeof(*history); + want = (unsigned) size_history * sizeof(*history); if (history == 0) { history = (HistInfo *) malloc(want); } else { @@ -1092,7 +1092,7 @@ static int LYLoadMESSAGES(const char *arg GCC_UNUSED, } anAnchor->no_cache = TRUE; -#define PUTS(buf) (*target->isa->put_block)(target, buf, strlen(buf)) +#define PUTS(buf) (*target->isa->put_block)(target, buf, (int) strlen(buf)) HTSprintf0(&buf, "<html>\n<head>\n"); PUTS(buf); diff --git a/src/LYJump.c b/src/LYJump.c index 79aacd4f..22ceccbf 100644 --- a/src/LYJump.c +++ b/src/LYJump.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYJump.c,v 1.33 2008/12/07 22:13:37 tom Exp $ + * $LynxId: LYJump.c,v 1.34 2009/01/01 22:41:04 tom Exp $ */ #include <HTUtils.h> #include <HTAlert.h> @@ -383,7 +383,7 @@ static unsigned LYRead_Jumpfile(struct JumpTable *jtp) } /* allocate storage to read entire file */ - if ((mp = typecallocn(char, st.st_size + 1)) == NULL) { + if ((mp = typecallocn(char, (size_t) st.st_size + 1)) == NULL) { HTAlert(OUTOF_MEM_FOR_JUMP_FILE); return 0; } @@ -409,7 +409,7 @@ static unsigned LYRead_Jumpfile(struct JumpTable *jtp) if (IsStream_LF) { /** Handle as a stream. **/ #endif /* VMS */ - if (read(fd, mp, st.st_size) < st.st_size) { + if (read(fd, mp, (size_t) st.st_size) < st.st_size) { HTAlert(ERROR_READING_JUMP_FILE); FREE(mp); return 0; diff --git a/src/LYJump.h b/src/LYJump.h index 24b5222e..159bdd68 100644 --- a/src/LYJump.h +++ b/src/LYJump.h @@ -1,3 +1,4 @@ +/* $LynxId: LYJump.h,v 1.8 2009/01/01 22:41:42 tom Exp $ */ #ifndef LYJUMP_H #define LYJUMP_H @@ -13,7 +14,7 @@ extern "C" { struct JumpTable { int key; - int nel; + unsigned nel; char *msg; char *file; char *shortcut; diff --git a/src/LYKeymap.c b/src/LYKeymap.c index 1b7f7256..8e7baecb 100644 --- a/src/LYKeymap.c +++ b/src/LYKeymap.c @@ -1,4 +1,4 @@ -/* $LynxId: LYKeymap.c,v 1.65 2008/01/08 00:19:25 tom Exp $ */ +/* $LynxId: LYKeymap.c,v 1.66 2009/01/01 23:09:11 tom Exp $ */ #include <HTUtils.h> #include <LYUtils.h> #include <LYGlobalDefs.h> @@ -17,7 +17,7 @@ #include <rot13_kb.h> #endif -#define PUTS(buf) (*target->isa->put_block)(target, buf, strlen(buf)) +#define PUTS(buf) (*target->isa->put_block)(target, buf, (int) strlen(buf)) #ifdef EXP_KEYBOARD_LAYOUT int current_layout = 0; /* Index into LYKbLayouts[] */ @@ -1139,7 +1139,7 @@ Kcmd *LYStringToKcmd(const char *name) result = revmap + j; break; } else if (!exact - && !strncasecomp(revmap[j].name, name, need)) { + && !strncasecomp(revmap[j].name, name, (int) need)) { if (maybe == 0) { maybe = revmap + j; } else { @@ -1193,7 +1193,7 @@ int LYStringToKeycode(char *src) { unsigned n; int key = -1; - int len = strlen(src); + int len = (int) strlen(src); if (len == 1) { key = *src; @@ -1254,8 +1254,8 @@ static char *pretty_html(int c) if (c == table[n].code) { found = TRUE; strcpy(dst, table[n].name); - adj += strlen(dst) - 1; - dst += strlen(dst); + adj += (int) strlen(dst) - 1; + dst += (int) strlen(dst); break; } } diff --git a/src/LYLocal.c b/src/LYLocal.c index 3aa2a1ee..4860a69b 100644 --- a/src/LYLocal.c +++ b/src/LYLocal.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYLocal.c,v 1.84 2008/12/07 22:13:37 tom Exp $ + * $LynxId: LYLocal.c,v 1.86 2009/01/01 21:52:45 tom Exp $ * * Routines to manipulate the local filesystem. * Written by: Rick Mallett, Carleton University @@ -731,7 +731,7 @@ static int modify_tagged(char *testpath) */ dev = dir_info.st_dev; inode = dir_info.st_ino; - owner = dir_info.st_uid; + owner = (int) dir_info.st_uid; /* * Replace ~/ references to the home directory. @@ -938,7 +938,7 @@ static int modify_location(char *testpath) */ dev = dir_info.st_dev; inode = dir_info.st_ino; - owner = dir_info.st_uid; + owner = (int) dir_info.st_uid; if (!ok_stat(newpath, &dir_info)) { code = 0; } @@ -1227,7 +1227,7 @@ int local_remove(DocInfo *doc) strcpy(testpath, tp); FREE(tp); - if ((i = strlen(testpath)) && testpath[i - 1] == '/') + if ((i = (int) strlen(testpath)) && testpath[i - 1] == '/') testpath[(i - 1)] = '\0'; if (remove_single(testpath)) { @@ -1315,7 +1315,7 @@ static int permit_location(char *destpath, LYLocalFileToURL(newpath, tempfile); LYRegisterUIPage(*newpath, UIP_PERMIT_OPTIONS); - group_name = HTAA_GidToName(dir_info.st_gid); + group_name = HTAA_GidToName((int) dir_info.st_gid); LYstrncpy(LYValidPermitFile, srcpath, (sizeof(LYValidPermitFile) - 1)); @@ -1624,7 +1624,7 @@ static char *LYonedot(char *line) static char *match_op(const char *prefix, char *data) { - int len = strlen(prefix); + int len = (int) strlen(prefix); if (!strncmp("LYNXDIRED://", data, 12) && !strncmp(prefix, data + 12, (unsigned) len)) { @@ -1644,7 +1644,7 @@ static char *match_op(const char *prefix, * references to avoid spoofing the shell. */ static char *build_command(char *line, - char *dirname, + char *dirName, char *arg) { char *buffer = NULL; @@ -1680,8 +1680,8 @@ static char *build_command(char *line, if ((arg = match_op("UNTAR_GZ", line)) != 0) { #define FMT_UNTAR_GZ "cd %s; %s -qdc %s | %s %s %s" if ((program = HTGetProgramPath(ppGZIP)) != NULL) { - dirname = DirectoryOf(arg); - HTAddParam(&buffer, FMT_UNTAR_GZ, 1, dirname); + dirName = DirectoryOf(arg); + HTAddParam(&buffer, FMT_UNTAR_GZ, 1, dirName); HTAddParam(&buffer, FMT_UNTAR_GZ, 2, program); HTAddParam(&buffer, FMT_UNTAR_GZ, 3, arg); HTAddParam(&buffer, FMT_UNTAR_GZ, 4, tar_path); @@ -1695,8 +1695,8 @@ static char *build_command(char *line, if ((arg = match_op("UNTAR_Z", line)) != 0) { #define FMT_UNTAR_Z "cd %s; %s %s | %s %s %s" if ((program = HTGetProgramPath(ppZCAT)) != NULL) { - dirname = DirectoryOf(arg); - HTAddParam(&buffer, FMT_UNTAR_Z, 1, dirname); + dirName = DirectoryOf(arg); + HTAddParam(&buffer, FMT_UNTAR_Z, 1, dirName); HTAddParam(&buffer, FMT_UNTAR_Z, 2, program); HTAddParam(&buffer, FMT_UNTAR_Z, 3, arg); HTAddParam(&buffer, FMT_UNTAR_Z, 4, tar_path); @@ -1708,8 +1708,8 @@ static char *build_command(char *line, } if ((arg = match_op("UNTAR", line)) != 0) { #define FMT_UNTAR "cd %s; %s %s %s" - dirname = DirectoryOf(arg); - HTAddParam(&buffer, FMT_UNTAR, 1, dirname); + dirName = DirectoryOf(arg); + HTAddParam(&buffer, FMT_UNTAR, 1, dirName); HTAddParam(&buffer, FMT_UNTAR, 2, tar_path); HTAddToCmd(&buffer, FMT_UNTAR, 3, TAR_DOWN_OPTIONS); HTAddParam(&buffer, FMT_UNTAR, 4, arg); @@ -1722,8 +1722,8 @@ static char *build_command(char *line, if ((arg = match_op("TAR_GZ", line)) != 0) { #define FMT_TAR_GZ "cd %s; %s %s %s %s | %s -qc >%s%s" if ((program = HTGetProgramPath(ppGZIP)) != NULL) { - dirname = DirectoryOf(arg); - HTAddParam(&buffer, FMT_TAR_GZ, 1, dirname); + dirName = DirectoryOf(arg); + HTAddParam(&buffer, FMT_TAR_GZ, 1, dirName); HTAddParam(&buffer, FMT_TAR_GZ, 2, tar_path); HTAddToCmd(&buffer, FMT_TAR_GZ, 3, TAR_UP_OPTIONS); HTAddToCmd(&buffer, FMT_TAR_GZ, 4, TAR_PIPE_OPTIONS); @@ -1740,8 +1740,8 @@ static char *build_command(char *line, if ((arg = match_op("TAR_Z", line)) != 0) { #define FMT_TAR_Z "cd %s; %s %s %s %s | %s >%s%s" if ((program = HTGetProgramPath(ppCOMPRESS)) != NULL) { - dirname = DirectoryOf(arg); - HTAddParam(&buffer, FMT_TAR_Z, 1, dirname); + dirName = DirectoryOf(arg); + HTAddParam(&buffer, FMT_TAR_Z, 1, dirName); HTAddParam(&buffer, FMT_TAR_Z, 2, tar_path); HTAddToCmd(&buffer, FMT_TAR_Z, 3, TAR_UP_OPTIONS); HTAddToCmd(&buffer, FMT_TAR_Z, 4, TAR_PIPE_OPTIONS); @@ -1756,8 +1756,8 @@ static char *build_command(char *line, if ((arg = match_op("TAR", line)) != 0) { #define FMT_TAR "cd %s; %s %s %s %s.tar %s" - dirname = DirectoryOf(arg); - HTAddParam(&buffer, FMT_TAR, 1, dirname); + dirName = DirectoryOf(arg); + HTAddParam(&buffer, FMT_TAR, 1, dirName); HTAddParam(&buffer, FMT_TAR, 2, tar_path); HTAddToCmd(&buffer, FMT_TAR, 3, TAR_UP_OPTIONS); HTAddToCmd(&buffer, FMT_TAR, 4, TAR_FILE_OPTIONS); @@ -1796,8 +1796,8 @@ static char *build_command(char *line, if ((arg = match_op("ZIP", line)) != 0) { #define FMT_ZIP "cd %s; %s -rq %s.zip %s" if ((program = HTGetProgramPath(ppZIP)) != NULL) { - dirname = DirectoryOf(arg); - HTAddParam(&buffer, FMT_ZIP, 1, dirname); + dirName = DirectoryOf(arg); + HTAddParam(&buffer, FMT_ZIP, 1, dirName); HTAddParam(&buffer, FMT_ZIP, 2, program); HTAddParam(&buffer, FMT_ZIP, 3, LYonedot(LYPathLeaf(arg))); HTAddParam(&buffer, FMT_ZIP, 4, LYPathLeaf(arg)); @@ -1809,8 +1809,8 @@ static char *build_command(char *line, if ((arg = match_op("UNZIP", line)) != 0) { #define FMT_UNZIP "cd %s; %s -q %s" if ((program = HTGetProgramPath(ppUNZIP)) != NULL) { - dirname = DirectoryOf(arg); - HTAddParam(&buffer, FMT_UNZIP, 1, dirname); + dirName = DirectoryOf(arg); + HTAddParam(&buffer, FMT_UNZIP, 1, dirName); HTAddParam(&buffer, FMT_UNZIP, 2, program); HTAddParam(&buffer, FMT_UNZIP, 3, arg); HTEndParam(&buffer, FMT_UNZIP, 3); @@ -1850,7 +1850,7 @@ int local_dired(DocInfo *doc) char *tp = NULL; char *tmpbuf = NULL; char *buffer = NULL; - char *dirname = NULL; + char *dirName = NULL; BOOL do_pop_doc = TRUE; line_url = doc->address; @@ -1935,7 +1935,7 @@ int local_dired(DocInfo *doc) return 0; } - buffer = build_command(line, dirname, arg); + buffer = build_command(line, dirName, arg); if (buffer != 0) { if ((int) strlen(buffer) < LYcolLimit - 14) { @@ -1956,7 +1956,7 @@ int local_dired(DocInfo *doc) } } - FREE(dirname); + FREE(dirName); FREE(tmpbuf); FREE(buffer); FREE(line); diff --git a/src/LYMain.c b/src/LYMain.c index e0d617c3..e1f772ba 100644 --- a/src/LYMain.c +++ b/src/LYMain.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYMain.c,v 1.194 2008/12/30 01:01:34 Paul.Gilmartin Exp $ + * $LynxId: LYMain.c,v 1.195 2009/01/01 17:12:48 tom Exp $ */ #include <HTUtils.h> #include <HTTP.h> @@ -1837,14 +1837,14 @@ int main(int argc, * Check the -popup command line toggle. - FM */ if (LYUseDefSelPop == FALSE) { - LYSelectPopups = !LYSelectPopups; + LYSelectPopups = (BOOLEAN) !LYSelectPopups; } /* * Check the -show_cursor command line toggle. - FM */ if (LYUseDefShoCur == FALSE) { - LYShowCursor = !LYShowCursor; + LYShowCursor = (BOOLEAN) !LYShowCursor; } /* diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c index c2e21255..542b127d 100644 --- a/src/LYMainLoop.c +++ b/src/LYMainLoop.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYMainLoop.c,v 1.158 2008/12/26 17:41:19 tom Exp $ + * $LynxId: LYMainLoop.c,v 1.159 2009/01/01 17:49:53 tom Exp $ */ #include <HTUtils.h> #include <HTAccess.h> @@ -364,7 +364,7 @@ void LYCloseTracelog(void) void handle_LYK_TRACE_TOGGLE(void) { #ifndef NO_LYNX_TRACE - WWW_TraceFlag = !WWW_TraceFlag; + WWW_TraceFlag = (BOOLEAN) !WWW_TraceFlag; if (LYOpenTraceLog()) HTUserMsg(WWW_TraceFlag ? TRACE_ON : TRACE_OFF); #else @@ -882,7 +882,7 @@ static int find_link_near_col(int col, const char *text = LYGetHiliteStr(i, 0); if (text != NULL) - cx += strlen(text) / 2; + cx += (int) strlen(text) / 2; cx -= col; if (cx < 0) cx = -cx; @@ -1698,7 +1698,7 @@ static void handle_LYK_CLEAR_AUTH(int *old_c, static int handle_LYK_COMMAND(char *user_input_buffer) { - int ch; + LYKeymapCode ch; Kcmd *mp; char *src, *tmp; @@ -2288,7 +2288,7 @@ static void handle_LYK_DOWN_LINK(int *follow_col, *follow_col = links[curdoc.link].lx; if (text != NULL) - *follow_col += strlen(text) / 2; + *follow_col += (int) strlen(text) / 2; } newlink = find_link_near_col(*follow_col, 1); @@ -2695,7 +2695,7 @@ static BOOLEAN handle_LYK_FASTBACKW_LINK(int *cmd, { int samepage = 0, nextlink = curdoc.link; int res; - int code = FALSE; + BOOLEAN code = FALSE; if (nlinks > 1) { @@ -3112,7 +3112,7 @@ static void handle_LYK_HISTORICAL(void) #ifdef USE_SOURCE_CACHE } /* end if no bypass */ #endif - historical_comments = !historical_comments; + historical_comments = (BOOLEAN) !historical_comments; if (minimal_comments) { HTAlert(historical_comments ? HISTORICAL_ON_MINIMAL_OFF : HISTORICAL_OFF_MINIMAL_ON); @@ -3172,7 +3172,7 @@ static BOOLEAN handle_LYK_HISTORY(BOOLEAN ForcePush) static BOOLEAN handle_LYK_IMAGE_TOGGLE(int *cmd) { - clickable_images = !clickable_images; + clickable_images = (BOOLEAN) !clickable_images; HTUserMsg(clickable_images ? CLICKABLE_IMAGES_ON : CLICKABLE_IMAGES_OFF); @@ -3320,7 +3320,7 @@ static BOOLEAN handle_LYK_INFO(int *cmd) static BOOLEAN handle_LYK_INLINE_TOGGLE(int *cmd) { - pseudo_inline_alts = !pseudo_inline_alts; + pseudo_inline_alts = (BOOLEAN) !pseudo_inline_alts; HTUserMsg(pseudo_inline_alts ? PSEUDO_INLINE_ALTS_ON : PSEUDO_INLINE_ALTS_OFF); @@ -3604,7 +3604,7 @@ static void handle_LYK_MINIMAL(void) } /* end if no bypass */ #endif } - minimal_comments = !minimal_comments; + minimal_comments = (BOOLEAN) !minimal_comments; if (!historical_comments) { HTAlert(minimal_comments ? MINIMAL_ON_IN_EFFECT : MINIMAL_OFF_VALID_ON); @@ -3646,7 +3646,7 @@ static void handle_LYK_MODIFY(BOOLEAN *refresh_screen) #ifdef EXP_NESTED_TABLES static BOOLEAN handle_LYK_NESTED_TABLES(int *cmd) { - nested_tables = !nested_tables; + nested_tables = (BOOLEAN) !nested_tables; HTUserMsg(nested_tables ? NESTED_TABLES_ON : NESTED_TABLES_OFF); return reparse_or_reload(cmd); } @@ -4249,7 +4249,7 @@ static void handle_LYK_SOFT_DQUOTES(void) #ifdef USE_SOURCE_CACHE } /* end if no bypass */ #endif - soft_dquotes = !soft_dquotes; + soft_dquotes = (BOOLEAN) !soft_dquotes; HTUserMsg(soft_dquotes ? SOFT_DOUBLE_QUOTE_ON : SOFT_DOUBLE_QUOTE_OFF); #ifdef USE_SOURCE_CACHE @@ -4647,7 +4647,7 @@ static void handle_LYK_UP_LINK(int *follow_col, *follow_col = links[curdoc.link].lx; if (text != NULL) - *follow_col += strlen(text) / 2; + *follow_col += (int) strlen(text) / 2; } newlink = find_link_near_col(*follow_col, -1); @@ -6376,14 +6376,15 @@ int mainloop(void) } - curlink_is_editable = + curlink_is_editable = (BOOLEAN) (nlinks > 0 && - links[curdoc.link].type == WWW_FORM_LINK_TYPE && + (links[curdoc.link].type == WWW_FORM_LINK_TYPE) && F_TEXTLIKE(links[curdoc.link].l_form->type)); - use_last_tfpos = (curlink_is_editable && - (real_cmd == LYK_LPOS_PREV_LINK || - real_cmd == LYK_LPOS_NEXT_LINK)); + use_last_tfpos = (BOOLEAN) + (curlink_is_editable && + (real_cmd == LYK_LPOS_PREV_LINK || + real_cmd == LYK_LPOS_NEXT_LINK)); #ifdef TEXTFIELDS_MAY_NEED_ACTIVATION if (!textfields_need_activation) @@ -6954,7 +6955,7 @@ int mainloop(void) if (!s) break; - len2 = strlen((const char *) s); + len2 = (int) strlen((const char *) s); e = s + len2; while (s < e && strchr(" \t\n\r", *s)) s++; @@ -6970,11 +6971,11 @@ int mainloop(void) HTInfoMsg(gettext("No URL in the clipboard.")); break; } - len = e - s + 1; + len = (unsigned) (e - s + 1); if (len < MAX_LINE) len = MAX_LINE; /* Required for do_check_goto_URL() */ buf = (char *) malloc(len); - strncpy(buf, (const char *) s, e - s); + strncpy(buf, (const char *) s, (unsigned) (e - s)); buf[e - s] = '\0'; t = (unsigned char *) buf; @@ -7640,7 +7641,7 @@ static void show_main_statusline(const LinkInfo curlink, if (is_www_index) { const char *indx = gettext("-index-"); - LYmove(LYlines - 1, LYcolLimit - strlen(indx)); + LYmove(LYlines - 1, LYcolLimit - (int) strlen(indx)); lynx_start_reverse(); LYaddstr(indx); lynx_stop_reverse(); @@ -7803,15 +7804,15 @@ static void status_link(char *curlink_name, sprintf(format, "%.*s ", (int) (sizeof(format) - 2), gettext("-more-")); - prefix = strlen(format); + prefix = (int) strlen(format); } if (show_indx) { sprintf(format + prefix, "%.*s ", - (int) (sizeof(format) - prefix - 2), + ((int) sizeof(format) - prefix - 2), gettext("-index-")); } - prefix = strlen(format); - length = strlen(curlink_name); + prefix = (int) strlen(format); + length = (int) strlen(curlink_name); if (prefix > MAX_STATUS || prefix >= MAX_LINE - 1) { _user_message("%s", format); /* no room for url */ diff --git a/src/LYMap.c b/src/LYMap.c index e9eef794..edca37eb 100644 --- a/src/LYMap.c +++ b/src/LYMap.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYMap.c,v 1.36 2008/12/27 15:15:28 tom Exp $ + * $LynxId: LYMap.c,v 1.37 2009/01/01 22:30:15 tom Exp $ * Lynx Client-side Image MAP Support LYMap.c * ================================== * @@ -555,7 +555,7 @@ static int LYLoadIMGmap(const char *arg, LYEntify(&MapTitle, TRUE); } -#define PUTS(buf) (*target->isa->put_block)(target, buf, strlen(buf)) +#define PUTS(buf) (*target->isa->put_block)(target, buf, (int) strlen(buf)) HTSprintf0(&buf, "<html>\n<head>\n"); PUTS(buf); @@ -617,7 +617,7 @@ static int LYLoadIMGmap(const char *arg, void LYPrintImgMaps(FILE *fp) { const char *only = HTLoadedDocumentURL(); - int only_len = strlen(only); + unsigned only_len = strlen(only); HTList *outer = LynxMaps; HTList *inner; LYImageMap *map; diff --git a/src/LYNews.c b/src/LYNews.c index e4b435df..afebe0ee 100644 --- a/src/LYNews.c +++ b/src/LYNews.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYNews.c,v 1.53 2008/12/07 22:13:37 tom Exp $ + * $LynxId: LYNews.c,v 1.54 2009/01/01 23:09:57 tom Exp $ */ #include <HTUtils.h> #ifndef DISABLE_NEWS @@ -237,8 +237,8 @@ char *LYNewsPost(char *newsgroups, if (strncasecomp(kp, "Re:", 3)) { strcat(user_input, "Re: "); } - len = strlen(user_input); - LYstrncpy(user_input + len, kp, sizeof(user_input) - len - 1); + len = (int) strlen(user_input); + LYstrncpy(user_input + len, kp, (int) sizeof(user_input) - len - 1); } cp = NULL; if (LYgetstr(user_input, VISIBLE, diff --git a/src/LYOptions.c b/src/LYOptions.c index 3629bd0d..ba45925a 100644 --- a/src/LYOptions.c +++ b/src/LYOptions.c @@ -1,4 +1,4 @@ -/* $LynxId: LYOptions.c,v 1.125 2008/12/29 19:37:13 tom Exp $ */ +/* $LynxId: LYOptions.c,v 1.126 2009/01/01 22:02:02 tom Exp $ */ #include <HTUtils.h> #include <HTFTP.h> #include <HTTP.h> /* 'reloading' flag */ @@ -131,6 +131,9 @@ static int boolean_choice(int status, const char **choices); #define LYChooseBoolean(status, line, column, choices) \ + (BOOLEAN) boolean_choice(status, line, column, (const char **)choices) + +#define LYChooseEnum(status, line, column, choices) \ boolean_choice(status, line, column, (const char **)choices) #define MAXCHOICES 10 @@ -739,9 +742,9 @@ void LYoptions(void) break; } if (!LYSelectPopups) { - LYMultiBookmarks = LYChooseBoolean(LYMultiBookmarks, - L_HOME, C_MULTI, - mbm_choices); + LYMultiBookmarks = LYChooseEnum(LYMultiBookmarks, + L_HOME, C_MULTI, + mbm_choices); } else { LYMultiBookmarks = LYChoosePopup(LYMultiBookmarks, L_HOME, (C_MULTI - 1), @@ -834,9 +837,9 @@ void LYoptions(void) case 'F': /* Change ftp directory sorting. */ if (!LYSelectPopups) { - HTfileSortMethod = LYChooseBoolean(HTfileSortMethod, - L_FTPSTYPE, -1, - fileSort_choices); + HTfileSortMethod = LYChooseEnum(HTfileSortMethod, + L_FTPSTYPE, -1, + fileSort_choices); } else { HTfileSortMethod = LYChoosePopup(HTfileSortMethod, L_FTPSTYPE, -1, @@ -903,7 +906,8 @@ void LYoptions(void) if (use_assume_charset) { int i, curval; const char **assume_list; - assume_list = typecallocn(const char *, (LYNumCharsets + 1)); + assume_list = typecallocn(const char *, (unsigned) + (LYNumCharsets + 1)); if (!assume_list) { outofmem(__FILE__, "options"); @@ -920,16 +924,16 @@ void LYoptions(void) if (!LYSelectPopups) { #ifndef ALL_CHARSETS_IN_O_MENU_SCREEN UCLYhndl_for_unspec = - assumed_doc_charset_map[(LYChooseBoolean(charset_subsets[curval].assumed_idx, - L_ASSUME_CHARSET, -1, - assumed_charset_choices) + assumed_doc_charset_map[(LYChooseEnum(charset_subsets[curval].assumed_idx, + L_ASSUME_CHARSET, -1, + assumed_charset_choices) ? 1 : 0)]; #else UCLYhndl_for_unspec = - LYChooseBoolean(curval, - L_ASSUME_CHARSET, -1, - assume_list); + LYChooseEnum(curval, + L_ASSUME_CHARSET, -1, + assume_list); #endif } else { #ifndef ALL_CHARSETS_IN_O_MENU_SCREEN @@ -996,14 +1000,14 @@ void LYoptions(void) case 'C': /* Change display charset setting. */ if (!LYSelectPopups) { #ifndef ALL_CHARSETS_IN_O_MENU_SCREEN - displayed_display_charset_idx = LYChooseBoolean(displayed_display_charset_idx, - L_Charset, -1, - display_charset_choices); + displayed_display_charset_idx = LYChooseEnum(displayed_display_charset_idx, + L_Charset, -1, + display_charset_choices); current_char_set = display_charset_map[displayed_display_charset_idx]; #else - current_char_set = LYChooseBoolean(current_char_set, - L_Charset, -1, - LYchar_set_names); + current_char_set = LYChooseEnum(current_char_set, + L_Charset, -1, + LYchar_set_names); #endif } else { #ifndef ALL_CHARSETS_IN_O_MENU_SCREEN @@ -1200,10 +1204,10 @@ void LYoptions(void) break; } #endif - LYShowColor = LYChooseBoolean((LYShowColor - 1), - L_Color, - C_COLOR, - bool_choices); + LYShowColor = LYChooseEnum((LYShowColor - 1), + L_Color, + C_COLOR, + bool_choices); if (LYShowColor == 0) { LYShowColor = SHOW_COLOR_OFF; } else { @@ -1232,10 +1236,10 @@ void LYoptions(void) choices[4] = NULL; do { if (!LYSelectPopups) { - chosen = LYChooseBoolean(LYChosenShowColor, - L_Color, - C_COLOR, - choices); + chosen = LYChooseEnum(LYChosenShowColor, + L_Color, + C_COLOR, + choices); } else { chosen = LYChoosePopup(LYChosenShowColor, L_Color, @@ -1296,9 +1300,9 @@ void LYoptions(void) case 'K': /* Change keypad mode. */ if (!LYSelectPopups) { - keypad_mode = LYChooseBoolean(keypad_mode, - L_Keypad, -1, - keypad_choices); + keypad_mode = LYChooseEnum(keypad_mode, + L_Keypad, -1, + keypad_choices); } else { keypad_mode = LYChoosePopup(keypad_mode, L_Keypad, -1, @@ -1323,9 +1327,9 @@ void LYoptions(void) case 'N': /* Change line editor key bindings. */ if (!LYSelectPopups) { - current_lineedit = LYChooseBoolean(current_lineedit, - L_Lineed, -1, - LYLineeditNames); + current_lineedit = LYChooseEnum(current_lineedit, + L_Lineed, -1, + LYLineeditNames); } else { current_lineedit = LYChoosePopup(current_lineedit, L_Lineed, -1, @@ -1346,9 +1350,9 @@ void LYoptions(void) #ifdef EXP_KEYBOARD_LAYOUT case 'Y': /* Change keyboard layout */ if (!LYSelectPopups) { - current_layout = LYChooseBoolean(current_layout, - L_Layout, -1, - LYKbLayoutNames); + current_layout = LYChooseEnum(current_layout, + L_Layout, -1, + LYKbLayoutNames); } else { current_layout = LYChoosePopup(current_layout, L_Layout, -1, @@ -1370,9 +1374,9 @@ void LYoptions(void) #ifdef DIRED_SUPPORT case 'I': /* Change local directory sorting. */ if (!LYSelectPopups) { - dir_list_style = LYChooseBoolean(dir_list_style, - L_Dired, -1, - dirList_choices); + dir_list_style = LYChooseEnum(dir_list_style, + L_Dired, -1, + dirList_choices); } else { dir_list_style = LYChoosePopup(dir_list_style, L_Dired, -1, @@ -1393,9 +1397,9 @@ void LYoptions(void) case 'U': /* Change user mode. */ if (!LYSelectPopups) { - user_mode = LYChooseBoolean(user_mode, - L_User_Mode, -1, - userMode_choices); + user_mode = LYChooseEnum(user_mode, + L_User_Mode, -1, + userMode_choices); use_assume_charset = (BOOL) (user_mode >= 2); } else { user_mode = LYChoosePopup(user_mode, @@ -1425,11 +1429,11 @@ void LYoptions(void) C_VERBOSE_IMAGES, bool_choices); } else { - verbose_img = LYChoosePopup(verbose_img, - L_VERBOSE_IMAGES, - C_VERBOSE_IMAGES, - bool_choices, - 2, FALSE, FALSE); + verbose_img = (BOOLEAN) LYChoosePopup(verbose_img, + L_VERBOSE_IMAGES, + C_VERBOSE_IMAGES, + bool_choices, + 2, FALSE, FALSE); } response = ' '; if (LYSelectPopups) { @@ -1503,9 +1507,9 @@ void LYoptions(void) } } if (!LYSelectPopups) { - itmp = LYChooseBoolean(itmp, - L_Exec, -1, - exec_choices); + itmp = LYChooseEnum(itmp, + L_Exec, -1, + exec_choices); } else { itmp = LYChoosePopup(itmp, L_Exec, -1, @@ -1583,7 +1587,7 @@ static int widest_choice(const char **choices) int n, width = 0; for (n = 0; choices[n] != NULL; ++n) { - int len = strlen(choices[n]); + int len = (int) strlen(choices[n]); if (width < len) width = len; @@ -1594,7 +1598,7 @@ static int widest_choice(const char **choices) static void show_choice(const char *choice, int width) { - int len = strlen(choice); + int len = (int) strlen(choice); LYaddstr(choice); while (len++ < width) @@ -2543,7 +2547,7 @@ static PostPair *break_data(bstring *data) * Like I said, screw efficiency. Sides, realloc is fast on * Linux ;-> */ - q = typeRealloc(PostPair, q, count + 1); + q = typeRealloc(PostPair, q, (unsigned) (count + 1)); if (q == NULL) outofmem(__FILE__, "break_data(realloc)"); q[count].tag = NULL; @@ -2559,7 +2563,7 @@ static BOOL isLynxOptionsPage(const char *address, const char *portion) unsigned len = strlen(portion); address += LEN_LYNXOPTIONS; - if (!strncasecomp(address, portion, len) + if (!strncasecomp(address, portion, (int) len) && (address[len] == '\0' || LYIsHtmlSep(address[len]))) { result = TRUE; } @@ -2757,9 +2761,9 @@ int postoptions(DocInfo *newdoc) if (!strcmp(data[i].tag, exec_links_string) && GetOptValues(exec_links_values, data[i].value, &code)) { #ifndef NEVER_ALLOW_REMOTE_EXEC - local_exec = (code == EXEC_ALWAYS); + local_exec = (BOOLEAN) (code == EXEC_ALWAYS); #endif /* !NEVER_ALLOW_REMOTE_EXEC */ - local_exec_on_local_files = (code == EXEC_LOCAL); + local_exec_on_local_files = (BOOLEAN) (code == EXEC_LOCAL); } #endif /* ENABLE_OPTS_CHANGE_EXEC */ @@ -3302,7 +3306,7 @@ static char *NewSecureValue(void) static void PutLabel(FILE *fp, const char *name, const char *value) { - int have = strlen(name); + int have = (int) strlen(name); int want = LABEL_LEN; int need = LYstrExtent(name, have, want); @@ -3407,9 +3411,9 @@ static int gen_options(char **newfile) BOOLEAN disable_all = FALSE; FILE *fp0; size_t cset_len = 0; - size_t text_len = ((LYcolLimit > 45) - ? LYcolLimit - (LABEL_LEN + 2 + MARGIN_LEN) - : 7); /* cf: PutLabel */ + size_t text_len = (size_t) ((LYcolLimit > 45) + ? LYcolLimit - (LABEL_LEN + 2 + MARGIN_LEN) + : 7); /* cf: PutLabel */ if ((fp0 = InternalPageFP(tempfile, TRUE)) == 0) return (NOT_FOUND); diff --git a/src/LYPrettySrc.c b/src/LYPrettySrc.c index 09918dab..c2228745 100644 --- a/src/LYPrettySrc.c +++ b/src/LYPrettySrc.c @@ -1,7 +1,10 @@ -/* HTML source syntax highlighting - by Vlad Harchev <hvv@hippo.ru> - March 1999 -*/ +/* + * $LynxId: LYPrettySrc.c,v 1.19 2009/01/01 22:20:25 tom Exp $ + * + * HTML source syntax highlighting + * by Vlad Harchev <hvv@hippo.ru> + * March 1999 + */ #include <HTUtils.h> #include <LYHash.h> #include <LYPrettySrc.h> @@ -107,8 +110,8 @@ static void append_close_tag(char *tagname, subj = typecalloc(HT_tagspec); subj->element = (HTMLElement) idx; - subj->present = typecallocn(BOOL, nattr); - subj->value = typecallocn(char *, nattr); + subj->present = typecallocn(BOOL, (unsigned) nattr); + subj->value = typecallocn(char *, (unsigned) nattr); subj->start = FALSE; #ifdef USE_COLOR_STYLE diff --git a/src/LYReadCFG.c b/src/LYReadCFG.c index 2b998a70..7deeb875 100644 --- a/src/LYReadCFG.c +++ b/src/LYReadCFG.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYReadCFG.c,v 1.133 2008/12/26 18:26:52 tom Exp $ + * $LynxId: LYReadCFG.c,v 1.135 2009/01/01 23:29:54 tom Exp $ */ #ifndef NO_RULES #include <HTRules.h> @@ -191,7 +191,7 @@ static void add_item_to_list(char *buffer, /* * Process name field */ - cur_item->name = typecallocn(char, colon - buffer + 1); + cur_item->name = typecallocn(char, (unsigned) (colon - buffer + 1)); if (cur_item->name == NULL) outofmem(__FILE__, "read_cfg"); @@ -208,7 +208,7 @@ static void add_item_to_list(char *buffer, next_colon = colon + strlen(colon); } if (next_colon - (colon + 1) > 0) { - cur_item->command = typecallocn(char, next_colon - colon); + cur_item->command = typecallocn(char, (unsigned) (next_colon - colon)); if (cur_item->command == NULL) outofmem(__FILE__, "read_cfg"); @@ -249,7 +249,7 @@ int match_item_by_name(lynx_list_item_type *ptr, char *name, { return (ptr->command != 0 - && !strncasecomp(ptr->name, name, strlen(ptr->name)) + && !strncasecomp(ptr->name, name, (int) strlen(ptr->name)) && (only_overriders ? ptr->override_primary_action : 1)); } @@ -1060,7 +1060,7 @@ static int parse_charset_choice(char *p, LYTrimTail(p); CTRACE((tfp, "parsing charset choice for %s:\"%s\"", (display_charset ? "display charset" : "assumed doc charset"), p)); - len = strlen(p); + len = (int) strlen(p); if (!len) { CTRACE((tfp, " - EMPTY STRING\n")); return 1; @@ -1640,11 +1640,11 @@ void free_lynx_cfg(void) #ifdef VMS Define_VMSLogical(name, NULL); #else -# ifdef HAVE_UNSETENV - unsetenv(name); -# else +# ifdef HAVE_UNPUTENV if (putenv(name)) break; +# else + unsetenv(name); # endif #endif } @@ -1748,7 +1748,7 @@ typedef BOOL (optidx_set_t)[NOPTS_]; {\ unsigned i1;\ for (i1 = 0; i1 < NOPTS_; ++i1) \ - (r)[i1]= (a)[i1] || (b)[i1]; \ + (r)[i1]= (BOOLEAN) ((a)[i1] || (b)[i1]); \ } /* diff --git a/src/LYSearch.c b/src/LYSearch.c index 01fdc8ac..421a40f0 100644 --- a/src/LYSearch.c +++ b/src/LYSearch.c @@ -1,3 +1,6 @@ +/* + * $LynxId: LYSearch.c,v 1.23 2009/01/01 23:28:39 tom Exp $ + */ #include <HTUtils.h> #include <HTAlert.h> #include <LYUtils.h> @@ -191,7 +194,8 @@ BOOL textsearch(DocInfo *cur_doc, char *prev_target, */ _statusline(ENTER_WHEREIS_QUERY); - if ((ch = LYgetstr(prev_target, VISIBLE, target_size, recall)) < 0) { + ch = LYgetstr(prev_target, VISIBLE, (unsigned) target_size, recall); + if (ch < 0) { /* * User cancelled the search via ^G. Restore prev_target and * return. - FM @@ -255,7 +259,8 @@ BOOL textsearch(DocInfo *cur_doc, char *prev_target, } else { _statusline(EDIT_A_PREV_QUERY); } - if ((ch = LYgetstr(prev_target, VISIBLE, target_size, recall)) < 0) { + ch = LYgetstr(prev_target, VISIBLE, (unsigned) target_size, recall); + if (ch < 0) { /* * User canceled the search via ^G. Restore prev_target and * return. - FM @@ -306,7 +311,8 @@ BOOL textsearch(DocInfo *cur_doc, char *prev_target, } else { _statusline(EDIT_A_PREV_QUERY); } - if ((ch = LYgetstr(prev_target, VISIBLE, target_size, recall)) < 0) { + ch = LYgetstr(prev_target, VISIBLE, (unsigned) target_size, recall); + if (ch < 0) { /* * User cancelled the search via ^G. Restore prev_target and * return. - FM diff --git a/src/LYStrings.c b/src/LYStrings.c index 3d45773f..303ce922 100644 --- a/src/LYStrings.c +++ b/src/LYStrings.c @@ -1,4 +1,4 @@ -/* $LynxId: LYStrings.c,v 1.159 2008/12/26 16:46:43 tom Exp $ */ +/* $LynxId: LYStrings.c,v 1.160 2009/01/01 21:50:59 tom Exp $ */ #include <HTUtils.h> #include <HTCJK.h> #include <UCAux.h> @@ -479,7 +479,7 @@ static int set_clicked_link(int x, if (is_text) len = links[i].l_form->size; else - len = strlen(text); + len = (int) strlen(text); cur_err = XYdist(x, y, links[i].lx, links[i].ly, len); /* Check the second line */ while (cur_err > 0 @@ -488,7 +488,7 @@ static int set_clicked_link(int x, int cur_err_2 = XYdist(x, y, LYGetHilitePos(i, count), links[i].ly + count, - strlen(text)); + (int) strlen(text)); cur_err = HTMIN(cur_err, cur_err_2); } @@ -578,12 +578,12 @@ char *LYstrncpy(char *dst, if (src == 0) src = ""; - len = strlen(src); + len = (int) strlen(src); if (n < 0) n = 0; - val = strncpy(dst, src, n); + val = strncpy(dst, src, (unsigned) n); if (len < n) *(dst + len) = '\0'; else @@ -1060,14 +1060,17 @@ static const char *expand_tichar(const char *first, char **result, char *final) if (name != 0) { (void) expand_tiname(name, strlen(name), result, final); } else { - **result = value; + **result = (char) value; (*result) += 1; } return first; } -static int expand_substring(char *dst, const char *first, const char *last, char *final) +static BOOLEAN expand_substring(char *dst, + const char *first, + const char *last, + char *final) { int ch; @@ -1084,15 +1087,15 @@ static int expand_substring(char *dst, const char *first, const char *last, char if (s == 0) s = first + strlen(first); - first = expand_tiname(first, s - first, &dst, final); + first = expand_tiname(first, (unsigned) (s - first), &dst, final); if (dst == was) - return 0; + return FALSE; if (*first) first++; } else if (ch == '?') { /* ASCII delete? */ *dst++ = 127; } else if ((ch & 0x3f) < 0x20) { /* ASCII control char? */ - *dst++ = (ch & 0x1f); + *dst++ = (char) (ch & 0x1f); } else { *dst++ = '^'; first--; /* not legal... */ @@ -1102,12 +1105,12 @@ static int expand_substring(char *dst, const char *first, const char *last, char ch = 0200; /* FALLTHRU */ default: - *dst++ = ch; + *dst++ = (char) ch; break; } } *dst = '\0'; - return 1; + return TRUE; } #endif @@ -1132,7 +1135,7 @@ static BOOLEAN unescape_string(char *src, char *dst, char *final) unescaped_char(src, &keysym); if (keysym >= 0) { - dst[0] = keysym; + dst[0] = (char) keysym; dst[1] = '\0'; ok = TRUE; } @@ -1157,7 +1160,7 @@ int map_string_to_keysym(const char *str, int *keysym) char buf[BUFSIZ]; if (othersym >= 0 && other - str - 4 < BUFSIZ) { - strncpy(buf, str + 4, other - str - 4); + strncpy(buf, str + 4, (unsigned) (other - str - 4)); buf[other - str - 4] = '\0'; *keysym = lacname_to_lac(buf); if (*keysym >= 0) { @@ -2766,7 +2769,7 @@ char *LYElideString(char *str, int len; LYstrncpy(buff, str, sizeof(buff) - 1); - len = strlen(buff); + len = (int) strlen(buff); if (len > (LYcolLimit - 9)) { buff[cut_pos] = '.'; buff[cut_pos + 1] = '.'; @@ -2873,7 +2876,7 @@ void LYSetupEdit(EDREC * edit, char *old, MaxLen = maxstr; DspWdth = maxdsp; Margin = 0; - Pos = strlen(old); + Pos = (int) strlen(old); #ifdef ENHANCED_LINEEDIT Mark = -1; /* pos=0, but do not show it yet */ #endif @@ -2894,7 +2897,7 @@ void LYSetupEdit(EDREC * edit, char *old, } LYstrncpy(Buf, old, maxstr); - StrLen = strlen(Buf); + StrLen = (int) strlen(Buf); } #ifdef SUPPORT_MULTIBYTE_EDIT @@ -2968,7 +2971,7 @@ static int mbcs_skip(char *s, int pos) static int cell2char(char *s, int cells) { int result = 0; - int len = strlen(s); + int len = (int) strlen(s); int pos; int have; @@ -3002,7 +3005,7 @@ int LYEditInsert(EDREC * edit, unsigned const char *s, int map GCC_UNUSED, BOOL maxMessage) { - int length = strlen(Buf); + int length = (int) strlen(Buf); int remains = MaxLen - (length + len); int edited = 0, overflow = 0; @@ -3032,13 +3035,13 @@ int LYEditInsert(EDREC * edit, unsigned const char *s, char utfbuf[8]; int l = 1; - utfbuf[0] = *s; + utfbuf[0] = (char) *s; if (*s < 128 && LYKbLayouts[current_layout][*s]) { UCode_t ucode = LYKbLayouts[current_layout][*s]; if (ucode > 127) { if (UCConvertUniToUtf8(ucode, utfbuf)) { - l = strlen(utfbuf); + l = (int) strlen(utfbuf); remains -= l - 1; if (remains < 0) { if (tail) @@ -3053,9 +3056,9 @@ int LYEditInsert(EDREC * edit, unsigned const char *s, } else utfbuf[0] = '?'; } else - utfbuf[0] = UCH(ucode); + utfbuf[0] = (char) ucode; } - strncpy(Buf + off, utfbuf, l); + strncpy(Buf + off, utfbuf, (unsigned) l); edited = 1; off += l; s++; @@ -3085,7 +3088,7 @@ int LYEditInsert(EDREC * edit, unsigned const char *s, } else #endif /* defined EXP_KEYBOARD_LAYOUT */ { - strncpy(Buf + Pos, (const char *) s, len); + strncpy(Buf + Pos, (const char *) s, (unsigned) len); edited = 1; } @@ -3123,7 +3126,7 @@ int LYEdit1(EDREC * edit, int ch, if (MaxLen <= 0) return (0); /* Be defensive */ - length = strlen(&Buf[0]); + length = (int) strlen(&Buf[0]); StrLen = length; switch (action) { @@ -3177,7 +3180,7 @@ int LYEdit1(EDREC * edit, int ch, for (i = length; i >= Pos; i--) /* Make room */ Buf[i + 1] = Buf[i]; Buf[length + 1] = '\0'; - Buf[Pos] = UCH(ch); + Buf[Pos] = (char) ch; Pos++; } else { if (maxMessage) { @@ -3473,7 +3476,7 @@ int LYEdit1(EDREC * edit, int ch, Mark = -1 - Pos; return (0); } { - int yanklen = strlen(killbuffer); + int yanklen = (int) strlen(killbuffer); if (Pos + yanklen <= (MaxLen) && StrLen + yanklen <= (MaxLen)) { Mark = -1 - Pos; @@ -3481,7 +3484,7 @@ int LYEdit1(EDREC * edit, int ch, for (i = length; i >= Pos; i--) /* Make room */ Buf[i + yanklen] = Buf[i]; for (i = 0; i < yanklen; i++) - Buf[Pos++] = UCH(killbuffer[i]); + Buf[Pos++] = killbuffer[i]; } else if (maxMessage) { _statusline(MAXLEN_REACHED_DEL_OR_MOV); @@ -3503,7 +3506,7 @@ int LYEdit1(EDREC * edit, int ch, return (ch); } IsDirty = TRUE; - StrLen = strlen(&Buf[0]); + StrLen = (int) strlen(&Buf[0]); return (0); } @@ -3656,7 +3659,7 @@ void LYRefreshEdit(EDREC * edit) IsDirty = FALSE; - all_bytes = strlen(&Buf[0]); + all_bytes = (int) strlen(&Buf[0]); StrLen = all_bytes; all_cells = LYstrCells(Buf); @@ -3914,7 +3917,7 @@ static int normalCmpList(const void *a, static char **sortedList(HTList *list, BOOL ignorecase) { - unsigned count = HTList_count(list); + unsigned count = (unsigned) HTList_count(list); unsigned j = 0; unsigned k, jk; char **result = typecallocn(char *, count + 1); @@ -3965,7 +3968,7 @@ int LYarrayWidth(const char **list) int check; while (*list != 0) { - check = strlen(*list++); + check = (int) strlen(*list++); if (check > result) result = check; } @@ -4064,7 +4067,7 @@ int LYhandlePopupList(int cur_choice, int disabled, BOOLEAN for_mouse) { - BOOLEAN numbered = (keypad_mode != NUMBERS_AS_ARROWS); + BOOLEAN numbered = (BOOLEAN) (keypad_mode != NUMBERS_AS_ARROWS); int c = 0, cmd = 0, i = 0, j = 0, rel = 0; int orig_choice; WINDOW *form_window; @@ -4121,10 +4124,10 @@ int LYhandlePopupList(int cur_choice, */ num_choices = LYarrayLength(choices) - 1; if (width <= 0) - width = options_width(choices); + width = (int) options_width(choices); if (numbered) { sprintf(Cnum, "%d: ", num_choices); - Lnum = strlen(Cnum); + Lnum = (int) strlen(Cnum); max_choices = num_choices; } else { Lnum = 0; @@ -5004,8 +5007,9 @@ int LYgetstr(char *inputline, #endif /* SUPPORT_MULTIBYTE_EDIT */ LYGetYX(y, x); /* Use screen from cursor position to eol */ - MaxStringSize = (bufsize < sizeof(MyEdit.buffer)) ? - (bufsize - 1) : (sizeof(MyEdit.buffer) - 1); + MaxStringSize = (int) ((bufsize < sizeof(MyEdit.buffer)) + ? (bufsize - 1) + : (sizeof(MyEdit.buffer) - 1)); LYSetupEdit(&MyEdit, inputline, MaxStringSize, LYcolLimit - x); MyEdit.hidden = (BOOL) hidden; @@ -5156,7 +5160,7 @@ int LYgetstr(char *inputline, if (!s) break; - len = strlen((const char *) s); + len = (int) strlen((const char *) s); e = s + len; if (len > 0) { @@ -5267,9 +5271,9 @@ const char *LYLineeditHelpURL(void) if (LYLineeditHelpURLs[current_lineedit] && strlen(LYLineeditHelpURLs[current_lineedit]) && (strlen(LYLineeditHelpURLs[current_lineedit]) <= - sizeof(helpbuf) - (phelp - helpbuf))) { + sizeof(helpbuf) - (unsigned) (phelp - helpbuf))) { LYstrncpy(phelp, LYLineeditHelpURLs[current_lineedit], - sizeof(helpbuf) - (phelp - helpbuf) - 1); + (int) (sizeof(helpbuf) - (unsigned) (phelp - helpbuf) - 1)); lasthelp_lineedit = current_lineedit; return (&helpbuf[0]); } @@ -5306,7 +5310,7 @@ char *LYstrsep(char **stringp, char *LYstrstr(char *chptr, const char *tarptr) { - int len = strlen(tarptr); + int len = (int) strlen(tarptr); for (; *chptr != '\0'; chptr++) { if (0 == UPPER8(*chptr, *tarptr)) { @@ -5752,13 +5756,13 @@ char *SNACopy(char **dest, { FREE(*dest); if (src) { - *dest = typeMallocn(char, n + 1); + *dest = typeMallocn(char, (unsigned) n + 1); if (*dest == NULL) { CTRACE((tfp, "Tried to malloc %d bytes\n", n)); outofmem(__FILE__, "SNACopy"); } - strncpy(*dest, src, n); + strncpy(*dest, src, (unsigned) n); *(*dest + n) = '\0'; /* terminate */ } return *dest; @@ -5773,19 +5777,19 @@ char *SNACat(char **dest, { if (non_empty(src)) { if (*dest) { - int length = strlen(*dest); + int length = (int) strlen(*dest); - *dest = (char *) realloc(*dest, length + n + 1); + *dest = (char *) realloc(*dest, (unsigned) (length + n + 1)); if (*dest == NULL) outofmem(__FILE__, "SNACat"); - strncpy(*dest + length, src, n); + strncpy(*dest + length, src, (unsigned) n); *(*dest + length + n) = '\0'; /* terminate */ } else { - *dest = typeMallocn(char, n + 1); + *dest = typeMallocn(char, (unsigned) n + 1); if (*dest == NULL) outofmem(__FILE__, "SNACat"); - memcpy(*dest, src, n); + memcpy(*dest, src, (unsigned) n); (*dest)[n] = '\0'; /* terminate */ } } @@ -5963,7 +5967,7 @@ int LYReadCmdKey(int mode) LYTrimTrailing(buffer); src = LYSkipBlanks(buffer); tmp = LYSkipNonBlanks(src); - switch (len = (tmp - src)) { + switch (len = (unsigned) (tmp - src)) { case 4: if (!strncasecomp(src, "exit", 4)) exit_immediately(0); diff --git a/src/LYStrings.h b/src/LYStrings.h index a9992a49..9b9804c7 100644 --- a/src/LYStrings.h +++ b/src/LYStrings.h @@ -1,5 +1,5 @@ /* - * $LynxId: LYStrings.h,v 1.69 2008/09/07 22:59:14 tom Exp $ + * $LynxId: LYStrings.h,v 1.70 2009/01/01 21:36:55 tom Exp $ */ #ifndef LYSTRINGS_H #define LYSTRINGS_H @@ -16,10 +16,10 @@ extern "C" { ,RECALL_MAIL } RecallType; -#define IS_UTF8_TTY (LYCharSet_UC[current_char_set].enc == UCT_ENC_UTF8) -#define IS_CJK_TTY (HTCJK != NOCJK) +#define IS_UTF8_TTY (BOOLEAN) (LYCharSet_UC[current_char_set].enc == UCT_ENC_UTF8) +#define IS_CJK_TTY (BOOLEAN) (HTCJK != NOCJK) -#define is8bits(ch) (UCH(ch) >= 128) /* isascii(ch) is not POSIX */ +#define is8bits(ch) (BOOLEAN) (UCH(ch) >= 128) /* isascii(ch) is not POSIX */ /* UPPER8(ch1,ch2) is an extension of (TOUPPER(ch1) - TOUPPER(ch2)) */ extern int UPPER8(int ch1, diff --git a/src/LYStructs.h b/src/LYStructs.h index bfc446a7..889dd35b 100644 --- a/src/LYStructs.h +++ b/src/LYStructs.h @@ -1,3 +1,6 @@ +/* + * $LynxId: LYStructs.h,v 1.28 2009/01/01 21:34:17 tom Exp $ + */ #ifndef LYSTRUCTS_H #define LYSTRUCTS_H @@ -148,9 +151,11 @@ extern "C" { } ParseUnion; #ifdef PARSE_DEBUG -#define ParseUnionPtr Config_Type * -#define ParseUnionOf(tbl) tbl -#define ParseData ParseUnionMembers + +#define ParseUnionPtr Config_Type * +#define ParseUnionOf(tbl) tbl +#define ParseData ParseUnionMembers + #define UNION_ADD(v) &v, 0, 0, 0, 0, 0, 0 #define UNION_SET(v) 0, &v, 0, 0, 0, 0, 0 #define UNION_INT(v) 0, 0, &v, 0, 0, 0, 0 @@ -159,18 +164,24 @@ extern "C" { #define UNION_FUN(v) 0, 0, 0, 0, v, 0, 0 #define UNION_DEF(v) 0, 0, 0, 0, 0, v, 0 #define UNION_LST(v) 0, 0, 0, 0, 0, 0, &v + #else -#define ParseUnionPtr ParseUnion * + + typedef void *ParseType; + +#define ParseUnionPtr ParseUnion * #define ParseUnionOf(tbl) (ParseUnionPtr)(&(tbl->value)) -#define ParseData long value -#define UNION_ADD(v) (long)&(v) -#define UNION_SET(v) (long)&(v) -#define UNION_INT(v) (long)&(v) -#define UNION_STR(v) (long)&(v) -#define UNION_ENV(v) (long) (v) -#define UNION_FUN(v) (long) (v) -#define UNION_DEF(v) (long) (v) -#define UNION_LST(v) (long)&(v) +#define ParseData ParseType value + +#define UNION_ADD(v) (ParseType)&(v) +#define UNION_SET(v) (ParseType)&(v) +#define UNION_INT(v) (ParseType)&(v) +#define UNION_STR(v) (ParseType)&(v) +#define UNION_ENV(v) (ParseType) (v) +#define UNION_FUN(v) (ParseType) (v) +#define UNION_DEF(v) (ParseType) (v) +#define UNION_LST(v) (ParseType)&(v) + #endif #ifdef __cplusplus diff --git a/src/LYStyle.c b/src/LYStyle.c index 749655f4..137f40c4 100644 --- a/src/LYStyle.c +++ b/src/LYStyle.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYStyle.c,v 1.62 2008/08/31 16:00:10 tom Exp $ + * $LynxId: LYStyle.c,v 1.64 2009/01/01 23:06:42 tom Exp $ * * character level styles for Lynx * (c) 1996 Rob Partington -- donated to the Lyncei (if they want it :-) @@ -138,7 +138,7 @@ static void parse_either(char *attrs, while (*attrs != '\0') { char *next = strchr(attrs, '+'); - char save = (next != NULL) ? *next : '\0'; + char save = (char) ((next != NULL) ? *next : '\0'); if (next == NULL) next = attrs + strlen(attrs); @@ -232,7 +232,7 @@ static void parse_attributes(char *mono, } else { curPair = ++colorPairs; init_pair((short) curPair, (short) fA, (short) bA); - our_pairs[iBold][iBlink][iFg][iBg] = curPair; + our_pairs[iBold][iBlink][iFg][iBg] = UCH(curPair); } } CTRACE2(TRACE_STYLE, (tfp, "CSS(CURPAIR):%d\n", curPair)); @@ -637,7 +637,7 @@ static int style_readFromFileREC(char *lss_filename, LYTrimHead(buffer); if (!strncasecomp(buffer, "include:", 8)) style_readFromFileREC(LYSkipBlanks(buffer + 8), lss_filename); - else if (buffer[0] != '#' && (len = strlen(buffer)) > 0) + else if (buffer[0] != '#' && (len = (int) strlen(buffer)) > 0) HStyle_addStyle(buffer); } @@ -685,7 +685,7 @@ void TrimColorClass(const char *tagname, * It assumes that tag_name is present in stylename! -HV */ void FastTrimColorClass(const char *tag_name, - int name_len, + unsigned name_len, char *stylename, char **pstylename_end, /*will be modified */ int *phcode) /*will be modified */ @@ -698,7 +698,7 @@ void FastTrimColorClass(const char *tag_name, tag_name, stylename)); while (tag_start >= stylename) { for (; (tag_start >= stylename) && (*tag_start != ';'); --tag_start) ; - if (!strncasecomp(tag_start + 1, tag_name, name_len)) { + if (!strncasecomp(tag_start + 1, tag_name, (int) name_len)) { found = TRUE; break; } @@ -727,7 +727,7 @@ void cache_tag_styles(void) } } -#define SIZEOF_CACHED_STYLES (cached_styles_rows * cached_styles_cols) +#define SIZEOF_CACHED_STYLES (unsigned) (cached_styles_rows * cached_styles_cols) static unsigned *RefCachedStyle(int y, int x) { @@ -749,7 +749,7 @@ static unsigned *RefCachedStyle(int y, int x) BOOL ValidCachedStyle(int y, int x) { - return (RefCachedStyle(y, x) != 0); + return (BOOL) (RefCachedStyle(y, x) != 0); } unsigned GetCachedStyle(int y, int x) diff --git a/src/LYStyle.h b/src/LYStyle.h index d1cf9db1..93ff1193 100644 --- a/src/LYStyle.h +++ b/src/LYStyle.h @@ -1,4 +1,4 @@ -/* $LynxId: LYStyle.h,v 1.15 2007/07/23 19:21:54 tom Exp $ */ +/* $LynxId: LYStyle.h,v 1.16 2009/01/01 23:06:08 tom Exp $ */ #ifndef LYSTYLE_H #define LYSTYLE_H @@ -59,7 +59,7 @@ extern "C" { * during last invokation of TrimColorClass. */ extern void FastTrimColorClass(const char *tag_name, - int name_len, + unsigned name_len, char *stylename, char **pstylename_end, int *hcode); diff --git a/src/LYTraversal.c b/src/LYTraversal.c index b6690a01..02d516d3 100644 --- a/src/LYTraversal.c +++ b/src/LYTraversal.c @@ -1,3 +1,6 @@ +/* + * $LynxId: LYTraversal.c,v 1.27 2009/01/01 22:37:06 tom Exp $ + */ #include <HTUtils.h> #include <LYGlobalDefs.h> #include <LYUtils.h> @@ -144,7 +147,7 @@ BOOLEAN lookup_reject(char *target) FILE *ifp; char *buffer = NULL; char *line = NULL; - int len; + unsigned len; int result = FALSE; if ((ifp = fopen(TRAVERSE_REJECT_FILE, TXT_R)) == NULL) { @@ -156,7 +159,7 @@ BOOLEAN lookup_reject(char *target) while (LYSafeGets(&buffer, ifp) != NULL && !result) { LYTrimTrailing(buffer); len = strlen(buffer); - if (len > 0) { /* if not an empty line */ + if (len != 0) { /* if not an empty line */ if (buffer[len - 1] == '*') { /* if last char is * and the rest of the chars match */ if ((len == 1) || (strncmp(line, buffer, len - 1) == 0)) { diff --git a/src/LYUtils.c b/src/LYUtils.c index ceaf77a2..e5253db9 100644 --- a/src/LYUtils.c +++ b/src/LYUtils.c @@ -1,5 +1,5 @@ /* - * $LynxId: LYUtils.c,v 1.180 2008/12/31 16:35:14 tom Exp $ + * $LynxId: LYUtils.c,v 1.182 2009/01/01 23:59:34 tom Exp $ */ #include <HTUtils.h> #include <HTTCP.h> @@ -314,7 +314,7 @@ void LYSetHilite(int cur, const char *text) { links[cur].list.hl_base.hl_text = (char *) text; - links[cur].list.hl_len = (text != NULL) ? 1 : 0; + links[cur].list.hl_len = (short) ((text != NULL) ? 1 : 0); FREE(links[cur].list.hl_info); } @@ -327,8 +327,8 @@ void LYAddHilite(int cur, { HiliteList *list = &(links[cur].list); HiliteInfo *have = list->hl_info; - unsigned need = (list->hl_len - 1); - unsigned want = (list->hl_len += 1); + unsigned need = (unsigned) (list->hl_len - 1); + unsigned want = (unsigned) (list->hl_len += 1); if (have != NULL) { have = typeRealloc(HiliteInfo, have, want); @@ -337,7 +337,7 @@ void LYAddHilite(int cur, } list->hl_info = have; have[need].hl_text = text; - have[need].hl_x = x; + have[need].hl_x = (short) x; } /* @@ -425,7 +425,7 @@ static BOOL show_whereis_targets(int flag, target)) { int itmp, written, len, y, offset; const char *data; - int tlen = strlen(target); + int tlen = (int) strlen(target); int hlen, hLen; int hLine = LYP + count; int hoffset = LYGetHilitePos(cur, count); @@ -440,7 +440,7 @@ static BOOL show_whereis_targets(int flag, (sizeof(buffer) - 1), (LYcolLimit - LYGetHilitePos(cur, count)), utf_flag); - hlen = strlen(buffer); + hlen = (int) strlen(buffer); hLen = ((IS_CJK_TTY || utf_flag) ? LYmbcsstrlen(buffer, utf_flag, YES) : hlen); @@ -492,8 +492,8 @@ static BOOL show_whereis_targets(int flag, tmp[0] = data[itmp]; utf_extra = utf8_length(utf_flag, data + itmp); if (utf_extra) { - LYstrncpy(&tmp[1], &data[itmp + 1], utf_extra); - itmp += utf_extra; + LYstrncpy(&tmp[1], &data[itmp + 1], (int) utf_extra); + itmp += (int) utf_extra; /* * Start emphasis immediately if we are making the link * non-current. -FM @@ -506,7 +506,7 @@ static BOOL show_whereis_targets(int flag, LYmove(hLine, (offset + 1)); } tmp[1] = '\0'; - written += (utf_extra + 1); + written += (int) (utf_extra + 1); utf_extra = 0; } else if (IS_CJK_TTY && is8bits(tmp[0])) { /* @@ -564,8 +564,8 @@ static BOOL show_whereis_targets(int flag, */ utf_extra = utf8_length(utf_flag, data + itmp); if (utf_extra) { - LYstrncpy(&tmp[1], &data[itmp + 1], utf_extra); - itmp += utf_extra; + LYstrncpy(&tmp[1], &data[itmp + 1], (int) utf_extra); + itmp += (int) utf_extra; /* * Make sure we don't restore emphasis to the last * character of hightext if we are making the link @@ -580,7 +580,7 @@ static BOOL show_whereis_targets(int flag, LYaddstr(tmp); } tmp[1] = '\0'; - written += (utf_extra + 1); + written += (int) (utf_extra + 1); utf_extra = 0; } else if (IS_CJK_TTY && is8bits(tmp[0])) { /* @@ -691,8 +691,8 @@ static BOOL show_whereis_targets(int flag, tmp[0] = data[itmp]; utf_extra = utf8_length(utf_flag, data + itmp); if (utf_extra) { - LYstrncpy(&tmp[1], &data[itmp + 1], utf_extra); - itmp += utf_extra; + LYstrncpy(&tmp[1], &data[itmp + 1], (int) utf_extra); + itmp += (int) utf_extra; /* * Start emphasis immediately if we are making the link * non-current, or we are making it current but this is not @@ -707,7 +707,7 @@ static BOOL show_whereis_targets(int flag, LYmove(hLine, (offset + 1)); } tmp[1] = '\0'; - written += (utf_extra + 1); + written += (int) (utf_extra + 1); utf_extra = 0; } else if (IS_CJK_TTY && is8bits(tmp[0])) { /* @@ -766,8 +766,8 @@ static BOOL show_whereis_targets(int flag, */ utf_extra = utf8_length(utf_flag, data + itmp); if (utf_extra) { - LYstrncpy(&tmp[1], &data[itmp + 1], utf_extra); - itmp += utf_extra; + LYstrncpy(&tmp[1], &data[itmp + 1], (int) utf_extra); + itmp += (int) utf_extra; /* * Make sure we don't restore emphasis to the last * character of hightext if we are making the link @@ -782,7 +782,7 @@ static BOOL show_whereis_targets(int flag, LYaddstr(tmp); } tmp[1] = '\0'; - written += (utf_extra + 1); + written += (int) (utf_extra + 1); utf_extra = 0; } else if (IS_CJK_TTY && is8bits(tmp[0])) { /* @@ -869,7 +869,7 @@ static BOOL show_whereis_targets(int flag, LYmove(hLine, offset); itmp = 0; written = 0; - len = strlen(data); + len = (int) strlen(data); /* * Turn the emphasis back on. -FM @@ -887,8 +887,8 @@ static BOOL show_whereis_targets(int flag, */ utf_extra = utf8_length(utf_flag, data + itmp); if (utf_extra) { - LYstrncpy(&tmp[1], &data[itmp + 1], utf_extra); - itmp += utf_extra; + LYstrncpy(&tmp[1], &data[itmp + 1], (int) utf_extra); + itmp += (int) utf_extra; /* * Make sure we don't restore emphasis to the * last character of hightext if we are making @@ -903,7 +903,7 @@ static BOOL show_whereis_targets(int flag, LYaddstr(tmp); } tmp[1] = '\0'; - written += (utf_extra + 1); + written += (int) (utf_extra + 1); utf_extra = 0; } else if (IS_CJK_TTY && is8bits(tmp[0])) { /* @@ -989,12 +989,12 @@ static int find_cached_style(int cur, CTRACE2(TRACE_STYLE, (tfp, "STYLE.highlight.off: cached style @(%d,%d): ", LYP, LXP)); - s = GetCachedStyle(LYP, LXP); + s = (int) GetCachedStyle(LYP, LXP); if (s == 0) { for (x = LXP - 1; x >= 0; x--) { - s = GetCachedStyle(LYP, x); + s = (int) GetCachedStyle(LYP, x); if (s != 0) { - SetCachedStyle(LYP, LXP, s); + SetCachedStyle(LYP, LXP, (unsigned) s); CTRACE2(TRACE_STYLE, (tfp, "found %d, x_offset=%d.\n", s, x - LXP)); break; @@ -1108,7 +1108,7 @@ void LYhighlight(int flag, gllen = LYmbcsstrlen(text, utf_flag, YES); len = LYmbcs_skip_cells(text, avail_space, utf_flag) - text; - LYwaddnstr(LYwin, text, len); + LYwaddnstr(LYwin, text, (unsigned) len); while (gllen++ < avail_space) LYaddch('_'); @@ -1276,7 +1276,7 @@ char *strip_trailing_slash(char *dirname) { int i; - i = strlen(dirname) - 1; + i = (int) strlen(dirname) - 1; while (i >= 0 && dirname[i] == '/') dirname[i--] = '\0'; return (dirname); @@ -1287,8 +1287,8 @@ char *strip_trailing_slash(char *dirname) */ static void remove_most_blanks(char *buffer) { - int length = strlen(buffer); - BOOL trailing = (length != 0) && (buffer[length - 1] == ' '); + int length = (int) strlen(buffer); + BOOL trailing = (BOOL) ((length != 0) && (buffer[length - 1] == ' ')); LYReduceBlanks(buffer); if (trailing) @@ -1365,7 +1365,7 @@ void statusline(const char *text) } else { for (i = 0, j = 0; text_buff[i]; i++) { if (text_buff[i] != CH_ESC) { /* S/390 -- gil -- 2119 */ - temp[j++] = text_buff[i]; + temp[j++] = UCH(text_buff[i]); } } temp[j] = '\0'; @@ -1383,14 +1383,14 @@ void statusline(const char *text) for (i = 0, j = 0, len = 0, k = '\0'; temp[i] != '\0' && len < max_length; i++) { if (k != '\0') { - buffer[j++] = k; - buffer[j++] = temp[i]; + buffer[j++] = (char) k; + buffer[j++] = (char) temp[i]; k = '\0'; len += 2; } else if ((temp[i] & 0200) != 0) { k = temp[i]; } else { - buffer[j++] = temp[i]; + buffer[j++] = (char) temp[i]; len++; } } @@ -1490,9 +1490,9 @@ void statusline(const char *text) if (!(lynx_has_color && LYShowColor >= SHOW_COLOR_ON)) wbkgdset(LYwin, A_NORMAL | ' '); else if (s_normal != NOSTYLE) - wbkgdset(LYwin, hashStyles[s_normal].color | ' '); + wbkgdset(LYwin, (chtype) (hashStyles[s_normal].color | ' ')); else - wbkgdset(LYwin, displayStyles[DSTYLE_NORMAL].color | ' '); + wbkgdset(LYwin, (chtype) (displayStyles[DSTYLE_NORMAL].color | ' ')); LynxChangeStyle(a, STACK_OFF); } #endif @@ -1940,11 +1940,11 @@ BOOLEAN LYisAbsPath(const char *path) result = TRUE; #else #if defined(USE_DOS_DRIVES) - result = (BOOL) (LYIsPathSep(path[0]) - || (LYIsDosDrive(path) - && LYIsPathSep(path[2]))); + result = (BOOLEAN) (LYIsPathSep(path[0]) + || (LYIsDosDrive(path) + && LYIsPathSep(path[2]))); #else - result = (LYIsPathSep(path[0])); + result = (BOOLEAN) (LYIsPathSep(path[0])); #endif /* USE_DOS_DRIVES */ #endif } @@ -2187,7 +2187,7 @@ static BOOLEAN compare_type(char *tst, const char *cmp, size_t len) { - if (!strncasecomp(tst, cmp, len)) { + if (!strncasecomp(tst, cmp, (int) len)) { if (strncmp(tst, cmp, len)) { size_t i; @@ -2222,7 +2222,6 @@ UrlTypes is_url(char *filename) char *cp = filename; char *cp1; UrlTypes result = NOT_A_URL_TYPE; - int len; int limit; /* @@ -2252,7 +2251,7 @@ UrlTypes is_url(char *filename) result = NOT_A_URL_TYPE; } else { - limit = strlen(cp); + limit = (int) strlen(cp); switch (*cp) { case 'L': case 'l': @@ -2416,10 +2415,10 @@ UrlTypes is_url(char *filename) case 'F': case 'f': - if (compare_type(cp, STR_FILE_URL, len = LEN_FILE_URL)) { + if (compare_type(cp, STR_FILE_URL, LEN_FILE_URL)) { if (LYisLocalFile(cp)) { result = FILE_URL_TYPE; - } else if (DoubleHtmlSep(cp + len)) { + } else if (DoubleHtmlSep(cp + LEN_FILE_URL)) { result = FTP_URL_TYPE; } } @@ -2788,7 +2787,7 @@ void remove_backslashes(char *buf) */ BOOLEAN inlocaldomain(void) { - int result = TRUE; + BOOLEAN result = TRUE; #ifdef HAVE_UTMP int n; @@ -2803,7 +2802,7 @@ BOOLEAN inlocaldomain(void) if (mytty && (fp = fopen(UTMP_FILE, "r")) != NULL) { mytty++; do { - n = fread((char *) &me, sizeof(struct utmp), 1, fp); + n = (int) fread((char *) &me, sizeof(struct utmp), 1, fp); } while (n > 0 && !STREQ(me.ut_line, mytty)); (void) LYCloseInput(fp); @@ -3411,10 +3410,10 @@ static int fmt_tempname(char *result, do { counter %= MAX_TEMPNAME; offset = counter / BITS_PER_CHAR; - mask = 1 << (counter % BITS_PER_CHAR); + mask = (unsigned) (1 << (counter % BITS_PER_CHAR)); if ((used_tempname[offset] & mask) == 0) { names_used++; - used_tempname[offset] |= mask; + used_tempname[offset] |= UCH(mask); break; } } while ((used_tempname[offset] & mask) == 0); @@ -3655,9 +3654,9 @@ BOOL strn_dash_equ(const char *p1, * Returns the inx'th name from the restrictions table, or null if inx is * out of range. */ -const char *index_to_restriction(int inx) +const char *index_to_restriction(unsigned inx) { - if (inx >= 0 && inx < (int) TABLESIZE(restrictions)) + if (inx < TABLESIZE(restrictions)) return restrictions[inx].name; return NULL; } @@ -3672,7 +3671,7 @@ int find_restriction(const char *name, unsigned i; if (len < 0) - len = strlen(name); + len = (int) strlen(name); for (i = 0; i < TABLESIZE(restrictions); i++) { if (RESTRICT_NM_EQU(name, restrictions[i].name, len)) { return (*restrictions[i].flag); @@ -3709,7 +3708,7 @@ void parse_restrictions(const char *s) for (i = N_SPECIAL_RESTRICT_OPTIONS; i < TABLESIZE(restrictions); i++) - *(restrictions[i].flag) = !restrictions[i].can; + *(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)) { @@ -3895,7 +3894,7 @@ void LYCheckMail(void) else if (lastsize == 0) HTUserMsg(HAVE_MAIL_MSG); } - lastsize = st.st_size; + lastsize = (long) st.st_size; lasttime = st.st_mtime; return; } @@ -5472,14 +5471,14 @@ void LYAddPathToHome(char *fbuffer, */ StrAllocCopy(home, NO_HOMEPATH); - len = fbuffer_size - (strlen(home) + 1); + len = (int) fbuffer_size - ((int) strlen(home) + 1); if (len <= 0) { /* * Buffer is smaller than or only big enough for the home path. Load * what fits of the home path and return. This will fail, but we need * something in the buffer. - FM */ - LYstrncpy(fbuffer, home, (fbuffer_size - 1)); + LYstrncpy(fbuffer, home, (int) (fbuffer_size - 1)); FREE(home); return; } @@ -5654,11 +5653,12 @@ static BOOL IsOurSymlink(const char *name) BOOL result = FALSE; int size = LY_MAXPATH; int used; - char *buffer = typeMallocn(char, size); + char *buffer = typeMallocn(char, (unsigned) size); if (buffer != 0) { - while ((used = readlink(name, buffer, size - 1)) == size - 1) { - buffer = typeRealloc(char, buffer, size *= 2); + while ((used = readlink(name, buffer, (unsigned) (size - 1))) == size + - 1) { + buffer = typeRealloc(char, buffer, (unsigned) (size *= 2)); if (buffer == 0) break; @@ -5757,7 +5757,7 @@ BOOL IsOurFile(const char *name) } while (leaf != path); FREE(path); #endif - result = !linked; + result = (BOOLEAN) !linked; } CTRACE2(TRACE_CFG, (tfp, "IsOurFile(%s) %d\n", name, result)); return result; @@ -5770,7 +5770,7 @@ static FILE *OpenHiddenFile(const char *name, const char *mode) { FILE *fp = 0; struct stat data; - BOOLEAN binary = strchr(mode, 'b') != 0; + BOOLEAN binary = (BOOLEAN) (strchr(mode, 'b') != 0); #if defined(O_CREAT) && defined(O_EXCL) /* we have fcntl.h or kindred? */ /* @@ -5979,7 +5979,7 @@ FILE *LYOpenTemp(char *result, CTRACE((tfp, "lynx_temp_space is not a directory %s\n", lynx_temp_space)); } if (make_it) { - int old_mask = umask(HIDE_UMASK); + mode_t old_mask = umask(HIDE_UMASK); StrAllocCat(lynx_temp_space, "lynxXXXXXXXXXX"); if (mkdtemp(lynx_temp_space) == 0) { @@ -6029,7 +6029,7 @@ FILE *LYOpenTemp(char *result, p->next = ly_temp; StrAllocCopy((p->name), result); p->file = fp; - p->outs = (wrt != 'r'); + p->outs = (BOOLEAN) (wrt != 'r'); ly_temp = p; } else { outofmem(__FILE__, "LYOpenTemp"); @@ -6368,7 +6368,7 @@ void LYCheckBibHost(void) bibhostIcon.safe = FALSE; saveFlag = traversal; traversal = TRUE; /* Hack to force error response. */ - BibP_bibhost_available = HTLoadAbsolute(&bibhostIcon) == YES; + BibP_bibhost_available = (BOOLEAN) (HTLoadAbsolute(&bibhostIcon) == YES); traversal = saveFlag; BibP_bibhost_checked = TRUE; } @@ -6925,13 +6925,13 @@ int LYCopyFile(char *src, } else { FILE *fin, *fout; unsigned char buff[BUFSIZ]; - int len; + unsigned 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) { + while ((len = fread(buff, 1, sizeof(buff), fin)) != 0) { fwrite(buff, 1, len, fout); if (ferror(fout)) { code = EOF; @@ -7448,7 +7448,7 @@ static int clip_grab(void) char *get_clip_grab(void) { int len; - int size = PASTE_BUFFER; + unsigned size = PASTE_BUFFER; int off = 0; if (!clip_grab()) @@ -7459,7 +7459,7 @@ char *get_clip_grab(void) FREE(paste_buf); paste_buf = (char *) malloc(PASTE_BUFFER); while (1) { - len = fread(paste_buf + off, 1, PASTE_BUFFER - 1, paste_handle); + len = (int) fread(paste_buf + off, 1, PASTE_BUFFER - 1, paste_handle); paste_buf[off + len] = '\0'; if (len < PASTE_BUFFER - 1) break; @@ -7477,7 +7477,7 @@ int put_clip(const char *s) { char *cmd = LYGetEnv("RL_CLCOPY_CMD"); FILE *fh; - int l = strlen(s), res; + unsigned l = strlen(s), res; if (!cmd) return -1; @@ -7504,7 +7504,7 @@ void LYmsec_delay(unsigned msec) Sleep(msec); #elif defined(HAVE_NAPMS) - napms(msec); + napms((int) msec); #elif defined(DJGPP) || defined(HAVE_USLEEP) usleep(1000 * msec); diff --git a/src/LYUtils.h b/src/LYUtils.h index 2cdf0cc5..83ba6636 100644 --- a/src/LYUtils.h +++ b/src/LYUtils.h @@ -1,4 +1,4 @@ -/* $LynxId: LYUtils.h,v 1.78 2008/12/29 01:33:26 tom Exp $ */ +/* $LynxId: LYUtils.h,v 1.79 2009/01/01 17:10:40 tom Exp $ */ #ifndef LYUTILS_H #define LYUTILS_H @@ -141,7 +141,7 @@ extern "C" { extern const char *Home_Dir(void); extern const char *LYGetHiliteStr(int cur, int count); extern const char *LYSysShell(void); - extern const char *index_to_restriction(int inx); + extern const char *index_to_restriction(unsigned inx); extern const char *wwwName(const char *pathname); extern int HTCheckForInterrupt(void); extern int LYConsoleInputFD(BOOLEAN need_selectable); diff --git a/src/LYrcFile.c b/src/LYrcFile.c index 73c86230..789d8305 100644 --- a/src/LYrcFile.c +++ b/src/LYrcFile.c @@ -1,4 +1,4 @@ -/* $LynxId: LYrcFile.c,v 1.74 2008/08/31 23:28:15 tom Exp $ */ +/* $LynxId: LYrcFile.c,v 1.75 2009/01/01 23:10:59 tom Exp $ */ #include <HTUtils.h> #include <HTFTP.h> #include <LYUtils.h> @@ -179,7 +179,7 @@ BOOL LYgetEnum(Config_Enum * table, char *name, if (len != 0) { while (table->name != 0) { - if (!strncasecomp(table->name, name, len)) { + if (!strncasecomp(table->name, name, (int) len)) { found = table; if (!strcasecomp(table->name, name)) { match = 1; @@ -683,7 +683,7 @@ void read_rc(FILE *fp) if (tbl->name == 0) { const char *special = RC_MULTI_BOOKMARK; - if (!strncasecomp(name, special, strlen(special))) { + if (!strncasecomp(name, special, (int) strlen(special))) { tbl = lookup_config(special); } /* lynx ignores unknown keywords */ @@ -1006,7 +1006,7 @@ BOOL will_save_rc(const char *name) { Config_Type *tbl = lookup_config(name); - return tbl->name != 0; + return (BOOL) (tbl->name != 0); } int enable_lynxrc(char *value) diff --git a/src/TRSTable.c b/src/TRSTable.c index f20b17bd..37bbca86 100644 --- a/src/TRSTable.c +++ b/src/TRSTable.c @@ -1,5 +1,5 @@ /* - * $LynxId: TRSTable.c,v 1.23 2008/02/27 01:58:47 tom Exp $ + * $LynxId: TRSTable.c,v 1.24 2009/01/01 22:15:35 tom Exp $ * Simple table object * =================== * Authors @@ -451,10 +451,10 @@ static int Stbl_addCellToRow(STable_rowinfo *me, STable_cellinfo *colinfo, int n growby += CELLS_GROWBY; if (growby) { if (me->allocated == 0 && !me->cells) { - cells = typecallocn(STable_cellinfo, growby); + cells = typecallocn(STable_cellinfo, (unsigned) growby); } else { cells = typeRealloc(STable_cellinfo, me->cells, - (me->allocated + growby)); + (unsigned) (me->allocated + growby)); for (i = 0; cells && i < growby; i++) { cells[me->allocated + i].alignment = HT_ALIGN_NONE; @@ -522,7 +522,7 @@ static int Stbl_reserveCellsInRow(STable_rowinfo *me, int icell, icell, colspan)); if (growby > 0) { cells = typeRealloc(STable_cellinfo, me->cells, - (me->allocated + growby)); + (unsigned) (me->allocated + growby)); if (cells) { for (i = 0; i < growby; i++) { @@ -983,7 +983,7 @@ static int Stbl_reserveCellsInTable(STable_info *me, int icell, if (rowspan == 0) { if (!me->rowspans2eog.cells) { me->rowspans2eog.cells = typecallocn(STable_cellinfo, - HTMAX(1, icell + colspan)); + (unsigned) HTMAX(1, icell + colspan)); if (!me->rowspans2eog.cells) return 0; /* fail silently */ @@ -996,7 +996,7 @@ static int Stbl_reserveCellsInTable(STable_info *me, int icell, growby = me->nrows + rowspan - 1 - me->allocated_rows; if (growby > 0) { rows = typeRealloc(STable_rowinfo, me->rows, - (me->allocated_rows + growby)); + (unsigned) (me->allocated_rows + growby)); if (!rows) return 0; /* ignore silently, no free memory, may be recoverable */ @@ -1009,12 +1009,12 @@ static int Stbl_reserveCellsInTable(STable_info *me, int icell, row->cells = NULL; } else { row->cells = typecallocn(STable_cellinfo, - me->rowspans2eog.allocated); + (unsigned) me->rowspans2eog.allocated); if (row->cells) { row->allocated = me->rowspans2eog.allocated; memcpy(row->cells, me->rowspans2eog.cells, - row->allocated * sizeof(STable_cellinfo)); + ((unsigned) row->allocated * sizeof(STable_cellinfo))); } } row->ncells = 0; @@ -1028,7 +1028,10 @@ static int Stbl_reserveCellsInTable(STable_info *me, int icell, i < (rowspan == 0 ? me->allocated_rows : me->nrows + rowspan - 1); i++) { if (!me->rows[i].allocated) { - me->rows[i].cells = typecallocn(STable_cellinfo, HTMAX(1, icell + colspan)); + me->rows[i].cells = typecallocn(STable_cellinfo, (unsigned) + HTMAX(1, + icell + + colspan)); if (!me->rows[i].cells) return 0; /* fail silently */ @@ -1091,10 +1094,10 @@ int Stbl_addRowToTable(STable_info *me, int alignment, growby += ROWS_GROWBY; if (growby) { if (me->allocated_rows == 0 && !me->rows) { - rows = typecallocn(STable_rowinfo, growby); + rows = typecallocn(STable_rowinfo, (unsigned) growby); } else { rows = typeRealloc(STable_rowinfo, me->rows, - (me->allocated_rows + growby)); + (unsigned) (me->allocated_rows + growby)); for (i = 0; rows && i < growby; i++) { row = rows + me->allocated_rows + i; @@ -1103,12 +1106,12 @@ int Stbl_addRowToTable(STable_info *me, int alignment, row->cells = NULL; } else { row->cells = typecallocn(STable_cellinfo, - me->rowspans2eog.allocated); + (unsigned) me->rowspans2eog.allocated); if (row->cells) { row->allocated = me->rowspans2eog.allocated; memcpy(row->cells, me->rowspans2eog.cells, - row->allocated * sizeof(STable_cellinfo)); + (unsigned) row->allocated * sizeof(STable_cellinfo)); } else { FREE(rows); break; @@ -1351,7 +1354,8 @@ static int Stbl_fakeFinishCellInTable(STable_info *me, the reservation structure when we fake new logical lines. */ int prev_row_n = prev_row - me->rows; STable_rowinfo *rows = typeRealloc(STable_rowinfo, me->rows, - (me->allocated_rows + 1)); + (unsigned) (me->allocated_rows + + 1)); int need_cells = prev_reserved_last + 1; int n; @@ -1373,7 +1377,7 @@ static int Stbl_fakeFinishCellInTable(STable_info *me, lastrow->allocated = 0; lastrow->cells = 0; if (need_cells) { - lastrow->cells = typecallocn(STable_cellinfo, need_cells); + lastrow->cells = typecallocn(STable_cellinfo, (unsigned) need_cells); /* ignore silently, no free memory, may be recoverable */ if (!lastrow->cells) { @@ -1381,7 +1385,7 @@ static int Stbl_fakeFinishCellInTable(STable_info *me, } lastrow->allocated = need_cells; memcpy(lastrow->cells, prev_row->cells, - lastrow->allocated * sizeof(STable_cellinfo)); + (unsigned) lastrow->allocated * sizeof(STable_cellinfo)); i = -1; while (++i < ncells) { @@ -1495,10 +1499,10 @@ int Stbl_addCellToTable(STable_info *me, int colspan, growby += CELLS_GROWBY; if (growby) { if (me->allocated_sumcols == 0 && !me->sumcols) { - sumcols = typecallocn(STable_cellinfo, growby); + sumcols = typecallocn(STable_cellinfo, (unsigned) growby); } else { sumcols = typeRealloc(STable_cellinfo, me->sumcols, - (me->allocated_sumcols + growby)); + (unsigned) (me->allocated_sumcols + growby)); for (i = 0; sumcols && i < growby; i++) { sumcol = sumcols + me->allocated_sumcols + i; @@ -1687,10 +1691,10 @@ int Stbl_addColInfo(STable_info *me, int colspan, growby += CELLS_GROWBY; if (growby) { if (me->allocated_sumcols == 0) { - sumcols = typecallocn(STable_cellinfo, growby); + sumcols = typecallocn(STable_cellinfo, (unsigned) growby); } else { sumcols = typeRealloc(STable_cellinfo, me->sumcols, - (me->allocated_sumcols + growby)); + (unsigned) (me->allocated_sumcols + growby)); for (i = 0; sumcols && i < growby; i++) { sumcol = sumcols + me->allocated_sumcols + i; diff --git a/src/UCAuto.c b/src/UCAuto.c index 66e541db..18eb4a97 100644 --- a/src/UCAuto.c +++ b/src/UCAuto.c @@ -1,5 +1,5 @@ /* - * $LynxId: UCAuto.c,v 1.38 2008/07/05 11:42:34 tom Exp $ + * $LynxId: UCAuto.c,v 1.39 2009/01/01 22:07:18 tom Exp $ * * This file contains code for changing the Linux console mode. * Currently some names for font files are hardwired in here. @@ -104,7 +104,7 @@ static BOOL isSetFont(void) const char *slash = strrchr(program, '/'); const char *leaf = (slash ? slash + 1 : program); - return !strcmp(leaf, "setfont"); + return (BOOL) !strcmp(leaf, "setfont"); } /* diff --git a/src/UCdomap.c b/src/UCdomap.c index 1d7d1a99..33a6a6b4 100644 --- a/src/UCdomap.c +++ b/src/UCdomap.c @@ -1,5 +1,5 @@ /* - * $LynxId: UCdomap.c,v 1.72 2009/01/01 00:46:30 tom Exp $ + * $LynxId: UCdomap.c,v 1.73 2009/01/01 22:10:53 tom Exp $ * * UCdomap.c * ========= @@ -942,7 +942,7 @@ int UCTransUniCharStr(char *outbuf, } rc = conv_uni_to_str(outbuf, buflen, unicode, 0); if (rc >= 0) - return (strlen(outbuf)); + return (int) strlen(outbuf); } if (trydefault && chk_single_flag) { src = conv_uni_to_pc(unicode, 1); @@ -961,12 +961,13 @@ int UCTransUniCharStr(char *outbuf, size_t inleft, outleft; char *tocode = NULL; - str[0] = unicode >> 8; - str[1] = unicode & 0xFF; + str[0] = (char) (unicode >> 8); + str[1] = (char) (unicode & 0xFF); str[2] = 0; pin = str; inleft = 2; - pout = outbuf, outleft = buflen; + pout = outbuf; + outleft = (size_t) buflen; /* * Try TRANSLIT first, since it is an extension which can provide * translations when there is no available exact translation to @@ -990,24 +991,26 @@ int UCTransUniCharStr(char *outbuf, FREE(tocode); if (cd != (iconv_t) - 1) { - rc = iconv(cd, (ICONV_CONST char **) &pin, &inleft, &pout, &outleft); + rc = (int) iconv(cd, (ICONV_CONST char **) &pin, &inleft, + &pout, &outleft); iconv_close(cd); if ((pout - outbuf) == 3) { CTRACE((tfp, "It seems to be a JIS X 0201 code(%ld). Not supported.\n", unicode)); pin = str; inleft = 2; - pout = outbuf, outleft = buflen; + pout = outbuf; + outleft = (size_t) buflen; } else if (rc >= 0) { *pout = '\0'; - return (strlen(outbuf)); + return (int) strlen(outbuf); } } } #endif rc = conv_uni_to_str(outbuf, buflen, unicode, 1); if (rc >= 0) - return (strlen(outbuf)); + return (int) strlen(outbuf); } if (rc == ucNotFound) { if (!isdefault) @@ -1015,7 +1018,7 @@ int UCTransUniCharStr(char *outbuf, if ((rc == ucNotFound) && (isdefault || trydefault)) rc = conv_uni_to_str(outbuf, buflen, 0xfffd, 1); if (rc >= 0) - return (strlen(outbuf)); + return (int) strlen(outbuf); } if (chk_single_flag && src == ucNotFound) { if (!isdefault) @@ -1152,7 +1155,7 @@ long int UCTransJPToUni(char *inbuf, pin = inbuf; pout = outbuf; ilen = 2; - olen = buflen; + olen = (size_t) buflen; cd = iconv_open("UTF-16BE", LYCharSet_UC[charset_in].MIMEname); rc = iconv(cd, (ICONV_CONST char **) &pin, &ilen, &pout, &olen); @@ -1192,7 +1195,7 @@ long int UCTransToUni(char ch_in, unsigned need; char *ptr; - buffer[inx++] = ch_iu; + buffer[inx++] = (char) ch_iu; buffer[inx] = '\0'; need = utf8_length(TRUE, buffer); if (need && (need + 1) == inx) { @@ -1426,7 +1429,7 @@ int UCTransCharStr(char *outbuf, } rc = conv_uni_to_str(outbuf, buflen, unicode, 0); if (rc >= 0) - return (strlen(outbuf)); + return (int) strlen(outbuf); } if (trydefault && chk_single_flag) { src = conv_uni_to_pc(unicode, 1); @@ -1439,7 +1442,7 @@ int UCTransCharStr(char *outbuf, if (isdefault || trydefault) { rc = conv_uni_to_str(outbuf, buflen, unicode, 1); if (rc >= 0) - return (strlen(outbuf)); + return (int) strlen(outbuf); } if (rc == -4) { if (!isdefault) @@ -1447,7 +1450,7 @@ int UCTransCharStr(char *outbuf, if ((rc == -4) && (isdefault || trydefault)) rc = conv_uni_to_str(outbuf, buflen, 0xfffd, 1); if (rc >= 0) - return (strlen(outbuf)); + return (int) strlen(outbuf); } if (chk_single_flag && src == -4) { if (!isdefault) @@ -1819,7 +1822,7 @@ static const char **UC_setup_LYCharSets_repl(int UC_charset_in_hndl, */ static char dummy[2]; /* one char dummy string */ - dummy[0] = ti[UCH(*s8) - 160]; + dummy[0] = (char) ti[UCH(*s8) - 160]; *p = HTAtom_name(HTAtom_for(dummy)); } changed = 1; @@ -1921,7 +1924,7 @@ static int UC_Register_with_LYCharSets(int s, } if (!found && LYhndl > 0) { - repl = UC_setup_LYCharSets_repl(s, UCInfo[s].lowest_eight); + repl = UC_setup_LYCharSets_repl(s, (unsigned) UCInfo[s].lowest_eight); if (repl) { LYCharSets[LYhndl] = repl; /* diff --git a/src/chrtrans/makeuctb.c b/src/chrtrans/makeuctb.c index c98adb4c..e36b8902 100644 --- a/src/chrtrans/makeuctb.c +++ b/src/chrtrans/makeuctb.c @@ -1,5 +1,5 @@ /* - * $LynxId: makeuctb.c,v 1.38 2008/12/31 22:04:03 tom Exp $ + * $LynxId: makeuctb.c,v 1.39 2009/01/01 17:01:15 tom Exp $ * * makeuctb.c, derived from conmakehash.c - kw * @@ -153,7 +153,6 @@ static const char *hdrname; static int RawOrEnc = 0; static int Raw_found = 0; /* whether explicit R directive found */ static int CodePage = 0; -static int CodePage_found = 0; /* whether explicit C directive found */ #define MAX_UNIPAIRS 4500 @@ -503,7 +502,6 @@ int main(int argc, char **argv) p++; } CodePage = strtol(p, 0, 10); - CodePage_found = 1; continue; } diff --git a/src/parsdate.c b/src/parsdate.c index 0549a6e3..97578ef3 100644 --- a/src/parsdate.c +++ b/src/parsdate.c @@ -33,7 +33,7 @@ static int yygrowstack(void); #define YYPREFIX "yy" #line 2 "./parsdate.y" /* - * $LynxId: parsdate.c,v 1.7 2008/12/27 01:03:28 tom Exp $ + * $LynxId: parsdate.c,v 1.8 2009/01/01 22:12:42 tom Exp $ * * This module is adapted and extended from tin, to use for LYmktime(). * @@ -842,7 +842,7 @@ date_lex(void) (c = *yyInput++) != '\0' && CTYPE(isdigit, c); ) { if (p < &buff[sizeof buff - 1]) - *p++ = c; + *p++ = (char) c; } *p = '\0'; i = atoi(buff); @@ -858,7 +858,7 @@ date_lex(void) (c = *yyInput++) == '.' || CTYPE(isalpha, c); ) { if (p < &buff[sizeof buff - 1]) - *p++ = CTYPE(isupper, c) ? tolower(c) : c; + *p++ = (char) (CTYPE(isupper, c) ? tolower(c) : c); } *p = '\0'; yyInput--; diff --git a/src/parsdate.y b/src/parsdate.y index fdfdbad2..3466fc65 100644 --- a/src/parsdate.y +++ b/src/parsdate.y @@ -1,6 +1,6 @@ %{ /* - * $LynxId: parsdate.y,v 1.11 2008/12/27 00:45:40 tom Exp $ + * $LynxId: parsdate.y,v 1.12 2009/01/01 22:12:25 tom Exp $ * * This module is adapted and extended from tin, to use for LYmktime(). * @@ -817,7 +817,7 @@ date_lex(void) (c = *yyInput++) != '\0' && CTYPE(isdigit, c); ) { if (p < &buff[sizeof buff - 1]) - *p++ = c; + *p++ = (char) c; } *p = '\0'; i = atoi(buff); @@ -833,7 +833,7 @@ date_lex(void) (c = *yyInput++) == '.' || CTYPE(isalpha, c); ) { if (p < &buff[sizeof buff - 1]) - *p++ = CTYPE(isupper, c) ? tolower(c) : c; + *p++ = (char) (CTYPE(isupper, c) ? tolower(c) : c); } *p = '\0'; yyInput--; |