diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2009-01-03 18:48:31 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2009-01-03 18:48:31 -0500 |
commit | 97cbb26ac61781231fdb61c9f59aaecd1583f9f4 (patch) | |
tree | 4c3f3787f280f3c8c446b0355b12ab53a565c089 /src | |
parent | dfae7cc51e19e1ca4aa857bf858e7e0ad4fa9ce1 (diff) | |
download | lynx-snapshots-97cbb26ac61781231fdb61c9f59aaecd1583f9f4.tar.gz |
snapshot of project "lynx", label v2-8-7dev_12b
Diffstat (limited to 'src')
-rw-r--r-- | src/HTAlert.c | 10 | ||||
-rw-r--r-- | src/LYCurses.c | 59 | ||||
-rw-r--r-- | src/LYCurses.h | 18 | ||||
-rw-r--r-- | src/LYKeymap.c | 13 | ||||
-rw-r--r-- | src/LYMail.c | 29 | ||||
-rw-r--r-- | src/LYShowInfo.c | 10 | ||||
-rw-r--r-- | src/UCAux.c | 9 |
7 files changed, 93 insertions, 55 deletions
diff --git a/src/HTAlert.c b/src/HTAlert.c index a5fbf13e..e0e3a581 100644 --- a/src/HTAlert.c +++ b/src/HTAlert.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTAlert.c,v 1.82 2008/09/06 14:35:56 tom Exp $ + * $LynxId: HTAlert.c,v 1.83 2009/01/03 00:43:04 tom Exp $ * * Displaying messages and getting input for Lynx Browser * ========================================================== @@ -551,7 +551,7 @@ BOOL confirm_post_resub(const char *address, char buf[240]; char *temp = NULL; BOOL res; - size_t maxlen = LYcolLimit - 5; + size_t maxlen = (size_t) (LYcolLimit - 5); if (!address) { return (NO); @@ -864,11 +864,11 @@ BOOL HTConfirmCookie(domain_entry * de, const char *server, space_free = (LYcolLimit - (LYstrCells(prompt) - 10) /* %s and %.*s and %.*s chars */ - -strlen(server)); + - (int) strlen(server)); if (space_free < 0) space_free = 0; - namelen = strlen(name); - valuelen = strlen(value); + namelen = (int) strlen(name); + valuelen = (int) strlen(value); if ((namelen + valuelen) > space_free) { /* * Argh... there isn't enough space on our single line for diff --git a/src/LYCurses.c b/src/LYCurses.c index 77300aa1..77d29f23 100644 --- a/src/LYCurses.c +++ b/src/LYCurses.c @@ -1,4 +1,4 @@ -/* $LynxId: LYCurses.c,v 1.136 2008/09/10 19:48:30 tom Exp $ */ +/* $LynxId: LYCurses.c,v 1.137 2009/01/03 00:36:42 tom Exp $ */ #include <HTUtils.h> #include <HTAlert.h> @@ -260,7 +260,7 @@ static char *attr_to_string(int code) int bold = (pair != 0 && (code & A_BOLD) != 0); if (bold) - code &= ~A_BOLD; + code &= (int) ~A_BOLD; *result = 0; for (i = 0; i < TABLESIZE(Mono_Attrs); i++) { @@ -337,12 +337,25 @@ void LYbox(WINDOW * win, BOOLEAN formfield GCC_UNUSED) */ LynxWChangeStyle(win, s_menu_frame, STACK_ON); #ifdef HAVE_WBORDER - if (!boxvert || !boxhori) - box(win, boxvert, boxhori); - else if (boxvert == '*' || boxhori == '*') - wborder(win, boxvert, boxvert, boxhori, boxhori, '*', '*', '*', '*'); - else - wborder(win, boxvert, boxvert, boxhori, boxhori, '/', '\\', '\\', '/'); + if (!boxvert || !boxhori) { + box(win, + (chtype) boxvert, + (chtype) boxhori); + } else if (boxvert == '*' || boxhori == '*') { + wborder(win, + (chtype) boxvert, + (chtype) boxvert, + (chtype) boxhori, + (chtype) boxhori, + '*', '*', '*', '*'); + } else { + wborder(win, + (chtype) boxvert, + (chtype) boxvert, + (chtype) boxhori, + (chtype) boxhori, + '/', '\\', '\\', '/'); + } #else box(win, boxvert, boxhori); #endif @@ -652,7 +665,7 @@ static int encode_color_attr(int color_attr) static int decode_mono_code(int mono_code) { - int result = 0; + unsigned result = 0; if (mono_code & 1) result |= A_BOLD; @@ -661,7 +674,7 @@ static int decode_mono_code(int mono_code) if (mono_code & 4) result |= A_UNDERLINE; - return result; + return (int) result; } /* @@ -690,7 +703,7 @@ char *LYgetTableString(int code) int mask = decode_mono_code(code); int second = encode_color_attr(mask); int pair = PAIR_NUMBER(second); - int mono = mask & A_ATTRIBUTES; + int mono = (int) (mask & A_ATTRIBUTES); int fg = lynx_color_pairs[pair].fg; int bg = lynx_color_pairs[pair].bg; unsigned n; @@ -820,7 +833,7 @@ static void lynx_init_colors(void) lynx_color_cfg[0].bg = default_bg; for (n = 0; n < TABLESIZE(lynx_color_cfg); n++) { - lynx_init_color_pair(n); + lynx_init_color_pair((int) n); } } else if (LYShowColor != SHOW_COLOR_NEVER) { LYShowColor = SHOW_COLOR_OFF; @@ -1699,18 +1712,17 @@ void LYsubAttr(int a) * color to a uniform width in the popup-menu. */ #ifndef USE_SLANG -void LYpaddstr(WINDOW * the_window, int width, - const char *the_string) +void LYpaddstr(WINDOW * the_window, int width, const char *the_string) { int y, x; - int actual = strlen(the_string); + int actual = (int) strlen(the_string); getyx(the_window, y, x); if (width + x > LYcolLimit) width = LYcolLimit - x; if (actual > width) actual = width; - LYwaddnstr(the_window, the_string, actual); + LYwaddnstr(the_window, the_string, (size_t) actual); width -= actual; while (width-- > 0) waddstr(the_window, " "); @@ -1736,7 +1748,7 @@ void LYsubwindow(WINDOW * param) { long b = LYgetattrs(my_subwindow); - wbkgd(my_subwindow, b | ' '); + wbkgd(my_subwindow, (chtype) (b | ' ')); } LynxWChangeStyle(my_subwindow, s_menu_bg, STACK_OFF); #elif defined(HAVE_GETBKGD) /* not defined in ncurses 1.8.7 */ @@ -1949,7 +1961,7 @@ int LYstrExtent(const char *string, int len, int maxCells) int used; if (len < 0) - used = strlen(string); + used = (int) strlen(string); else used = len; @@ -2010,7 +2022,7 @@ int LYstrExtent2(const char *string, int len) */ int LYstrCells(const char *string) { - return LYstrExtent2(string, strlen(string)); + return LYstrExtent2(string, (int) strlen(string)); } #ifdef VMS @@ -2525,7 +2537,7 @@ void LYnormalColor(void) int color = displayStyles[DSTYLE_NORMAL].color; if (color >= 0) { - wbkgd(LYwin, color | ' '); + wbkgd(LYwin, (chtype) (color | ' ')); LYrefresh(); } } @@ -2859,19 +2871,20 @@ static void make_blink_boldbg(void) */ long LYgetattrs(WINDOW * win) { + long result; #if ( defined(HAVE_GETATTRS) && ( !defined(NCURSES_VERSION_MAJOR) || NCURSES_VERSION_MAJOR < 5 ) ) - long result = 0; result = getattrs(win); #else - attr_t result = 0; + attr_t attrs = 0; short pair = 0; /* * FIXME: this ignores the color-pair, which for most implementations is * not stored in the attribute value. */ - wattr_get(win, &result, &pair, NULL); + wattr_get(win, &attrs, &pair, NULL); + result = (long) attrs; #endif return result; } diff --git a/src/LYCurses.h b/src/LYCurses.h index 41dbf648..18a611fa 100644 --- a/src/LYCurses.h +++ b/src/LYCurses.h @@ -1,4 +1,4 @@ -/* $LynxId: LYCurses.h,v 1.77 2007/07/02 00:09:00 tom Exp $ */ +/* $LynxId: LYCurses.h,v 1.79 2009/01/03 16:55:08 tom Exp $ */ #ifndef LYCURSES_H #define LYCURSES_H @@ -50,6 +50,7 @@ #ifdef USE_SLANG #include <slang.h> +typedef unsigned long chtype; #undef WINDOW typedef struct { @@ -116,8 +117,23 @@ typedef struct { #ifdef VMS #define FANCY_CURSES + #endif /* VMS */ +#ifndef HAVE_TYPE_CHTYPE + +#ifdef __PDCURSES__ +#define HAVE_TYPE_CHTYPE 1 +#endif + +#if defined(_VMS_CURSES) || defined(VMS) +typedef char chtype; + +#define HAVE_TYPE_CHTYPE 1 +#endif + +#endif /* ! HAVE_TYPE_CHTYPE */ + /* * CR may be defined before the curses.h include occurs. * There is a conflict between the termcap char *CR and the define. diff --git a/src/LYKeymap.c b/src/LYKeymap.c index 8e7baecb..ddad2284 100644 --- a/src/LYKeymap.c +++ b/src/LYKeymap.c @@ -1,4 +1,4 @@ -/* $LynxId: LYKeymap.c,v 1.66 2009/01/01 23:09:11 tom Exp $ */ +/* $LynxId: LYKeymap.c,v 1.67 2009/01/03 02:06:45 Paul.Gilmartin Exp $ */ #include <HTUtils.h> #include <LYUtils.h> #include <LYGlobalDefs.h> @@ -1171,16 +1171,17 @@ char *LYKeycodeToString(int c, } if (!named) { - if (c > ' ' - && c < 0177) + if (c <= 0377 + && TOASCII(c) > TOASCII(' ') + && TOASCII(c) < 0177) sprintf(buf, "%c", c); else if (upper8 - && c > ' ' + && TOASCII(c) > TOASCII(' ') && c <= 0377 && c <= LYlowest_eightbit[current_char_set]) sprintf(buf, "%c", c); - else if (c < ' ') - sprintf(buf, "^%c", c | 0100); + else if (TOASCII(c) < TOASCII(' ')) + sprintf(buf, "^%c", FROMASCII(TOASCII(c) | 0100)); else if (c >= 0400) sprintf(buf, "key-0x%x", c); else diff --git a/src/LYMail.c b/src/LYMail.c index 0354740e..1aea8ea0 100644 --- a/src/LYMail.c +++ b/src/LYMail.c @@ -1,3 +1,6 @@ +/* + * $LynxId: LYMail.c,v 1.71 2009/01/03 00:39:50 tom Exp $ + */ #include <HTUtils.h> #include <HTParse.h> #include <LYGlobalDefs.h> @@ -83,7 +86,7 @@ static void extract_field(char **dst, char *src, const char *keyword) { - int len = strlen(keyword); + int len = (int) strlen(keyword); char *cp, *cp1; cp = (src + 1); @@ -115,7 +118,7 @@ static void extract_subject(char *dst, char *src) { const char *keyword = "subject="; - int len = strlen(keyword); + int len = (int) strlen(keyword); char *cp, *cp1; cp = (src + 1); @@ -150,7 +153,7 @@ static void extract_body(char **dst, char *src) { const char *keyword = "body="; - int len = strlen(keyword); + int len = (int) strlen(keyword); int i; char *cp, *cp0, *cp1, *temp = 0; @@ -178,21 +181,21 @@ static void extract_body(char **dst, } } i = 0; - len = strlen(cp0); + len = (int) strlen(cp0); while (len > 78) { HTSprintf(dst, "%.78s\n", &cp0[i]); i += 78; - len = strlen(&cp0[i]); + len = (int) strlen(&cp0[i]); } HTSprintf(dst, "%s\n", &cp0[i]); cp0 = (cp + 1); } i = 0; - len = strlen(cp0); + len = (int) strlen(cp0); while (len > 78) { HTSprintf(dst, "%.78s\n", &cp0[i]); i += 78; - len = strlen(&cp0[i]); + len = (int) strlen(&cp0[i]); } if (len) { HTSprintf(dst, "%s\n", &cp0[i]); @@ -767,25 +770,25 @@ void mailform(const char *mailto_address, while ((cp = strchr(mailto_content, '\n')) != NULL) { *cp = '\0'; i = 0; - len = strlen(mailto_content); + len = (int) strlen(mailto_content); while (len > 78) { strncpy(buf, &mailto_content[i], 78); buf[78] = '\0'; fprintf(fd, "%s\n", buf); i += 78; - len = strlen(&mailto_content[i]); + len = (int) strlen(&mailto_content[i]); } fprintf(fd, "%s\n", &mailto_content[i]); mailto_content = (cp + 1); } i = 0; - len = strlen(mailto_content); + len = (int) strlen(mailto_content); while (len > 78) { strncpy(buf, &mailto_content[i], 78); buf[78] = '\0'; fprintf(fd, "%s\n", buf); i += 78; - len = strlen(&mailto_content[i]); + len = (int) strlen(&mailto_content[i]); } if (len) fprintf(fd, "%s\n", &mailto_content[i]); @@ -1668,8 +1671,8 @@ void reply_by_mail(char *mail_address, #else fputs(header, fp); #endif - while ((n = fread(buf, 1, sizeof(buf), fd)) != 0) { - fwrite(buf, 1, n, fp); + while ((n = (int) fread(buf, 1, sizeof(buf), fd)) != 0) { + fwrite(buf, 1, (size_t) n, fp); } #if CAN_PIPE_TO_MAILER pclose(fp); diff --git a/src/LYShowInfo.c b/src/LYShowInfo.c index c24a3cd6..01740684 100644 --- a/src/LYShowInfo.c +++ b/src/LYShowInfo.c @@ -1,4 +1,4 @@ -/* $LynxId: LYShowInfo.c,v 1.67 2008/12/25 14:35:50 tom Exp $ */ +/* $LynxId: LYShowInfo.c,v 1.68 2009/01/03 00:37:51 tom Exp $ */ #include <HTUtils.h> #include <HTFile.h> #include <HTParse.h> @@ -77,7 +77,7 @@ static void dt_String(FILE *fp, StrAllocCopy(the_label, label); StrAllocCopy(the_value, value); - have = strlen(the_label); + have = (int) strlen(the_label); need = LYstrExtent(the_label, have, label_columns); LYEntify(&the_label, TRUE); @@ -148,7 +148,7 @@ int LYShowInfo(DocInfo *doc, (url_type == LYNXEXEC_URL_TYPE || url_type == LYNXPROG_URL_TYPE)) { char *last_slash = strrchr(links[doc->link].lname, '/'); - int next_to_last = strlen(links[doc->link].lname) - 1; + int next_to_last = (int) strlen(links[doc->link].lname) - 1; if ((last_slash - links[doc->link].lname) == next_to_last) { links[doc->link].lname[next_to_last] = '\0'; @@ -215,10 +215,10 @@ int LYShowInfo(DocInfo *doc, ADD_SS(gettext("Points to file:"), buf); } #endif - name = HTAA_UidToName(dir_info.st_uid); + name = HTAA_UidToName((int) dir_info.st_uid); if (*name) ADD_SS(gettext("Name of owner:"), name); - name = HTAA_GidToName(dir_info.st_gid); + name = HTAA_GidToName((int) dir_info.st_gid); if (*name) ADD_SS(gettext("Group name:"), name); if (S_ISREG(dir_info.st_mode)) { diff --git a/src/UCAux.c b/src/UCAux.c index 89911909..3a8e9158 100644 --- a/src/UCAux.c +++ b/src/UCAux.c @@ -1,5 +1,5 @@ /* - * $LynxId: UCAux.c,v 1.38 2009/01/01 00:42:23 tom Exp $ + * $LynxId: UCAux.c,v 1.39 2009/01/03 18:46:33 tom Exp $ */ #include <HTUtils.h> @@ -342,14 +342,19 @@ void UCSetBoxChars(int cset, * This is important if we have loaded a font, which would * confuse curses. */ -#ifdef EXP_CHARTRANS_AUTOSWITCH /* US-ASCII vs Latin-1 is safe (usually) */ if ((cset == US_ASCII || cset == LATIN1) && (linedrawing_char_set == US_ASCII || linedrawing_char_set == LATIN1)) { +#if (defined(FANCY_CURSES) && defined(A_ALTCHARSET)) || defined(USE_SLANG) + vert_in = 0; + hori_in = 0; +#else ; +#endif } +#ifdef EXP_CHARTRANS_AUTOSWITCH #if defined(NCURSES_VERSION) || defined(HAVE_TIGETSTR) else { static BOOL first = TRUE; |