diff --git a/ChangeLog b/ChangeLog index b8b355b..4c006b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2642,3 +2642,12 @@ Wed Oct 27 17:36:35 PDT 1999 Michael Jennings Modified libtool flags per recommendation of HJ Lu . ------------------------------------------------------------------------------- +Wed Oct 27 18:46:04 PDT 1999 Michael Jennings + + Fixed lots of issues revealed by the -ansi -pedantic flags. The only + warnings you get with those flags now are implicit declaration + warnings for non-ANSI functions and warnings specific to certain OS's + and their non-ANSI implementations of ANSI functions, neither of + which I can do much about. :-) + +------------------------------------------------------------------------------- diff --git a/libmej/mem.c b/libmej/mem.c index da8fd64..335e483 100644 --- a/libmej/mem.c +++ b/libmej/mem.c @@ -353,17 +353,6 @@ void HandleSigSegv(int sig) { - static unsigned char segv_again = 0; - - /* Reinstate ourselves as the SIGSEGV handler if we're replaced */ - (void) signal(SIGSEGV, HandleSigSegv); - - /* Recursive seg faults are not cool.... */ - if (segv_again) { - printf("Recursive segmentation fault detected!\n"); - _exit(EXIT_FAILURE); - } - segv_again = 1; #if DEBUG >= DEBUG_MALLOC fprintf(stderr, "Fatal memory fault (%d)! Dumping memory table.\n", sig); memrec_dump(); diff --git a/libmej/strings.c b/libmej/strings.c index 2f4cdaa..5666f08 100644 --- a/libmej/strings.c +++ b/libmej/strings.c @@ -323,8 +323,9 @@ LowerStr(char *str) register char *tmp; - for (tmp = str; *tmp; tmp++) + for (tmp = str; *tmp; tmp++) { *tmp = tolower(*tmp); + } D_STRINGS(("LowerStr() returning %s\n", str)); return (str); } @@ -335,8 +336,9 @@ UpStr(char *str) register char *tmp; - for (tmp = str; *tmp; tmp++) + for (tmp = str; *tmp; tmp++) { *tmp = toupper(*tmp); + } D_STRINGS(("UpStr() returning %s\n", str)); return (str); } diff --git a/libmej/strings.h b/libmej/strings.h index bd97eca..6197263 100644 --- a/libmej/strings.h +++ b/libmej/strings.h @@ -97,6 +97,13 @@ extern void *memmem(void *, size_t, void *, size_t); #ifndef HAVE_USLEEP extern void usleep(unsigned long); #endif +#ifndef HAVE_SNPRINTF +# ifdef HAVE_STDARG_H +# include +# endif +extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args); +extern int snprintf(char *str, size_t count, const char *fmt, ...); +#endif /* #ifndef HAVE_NANOSLEEP extern void nanosleep(unsigned long); diff --git a/src/actions.c b/src/actions.c index 138dbbf..33b4e1a 100644 --- a/src/actions.c +++ b/src/actions.c @@ -58,7 +58,7 @@ unsigned char action_handle_string(event_t *ev, action_t *action) { REQUIRE_RVAL(action->param.string != NULL, 0); - cmd_write(action->param.string, strlen(action->param.string)); + cmd_write((unsigned char *) action->param.string, strlen(action->param.string)); return 1; ev = NULL; } @@ -67,7 +67,7 @@ unsigned char action_handle_echo(event_t *ev, action_t *action) { REQUIRE_RVAL(action->param.string != NULL, 0); - tt_write(action->param.string, strlen(action->param.string)); + tt_write((unsigned char *) action->param.string, strlen(action->param.string)); return 1; ev = NULL; } diff --git a/src/command.c b/src/command.c index af62914..5ac0abb 100644 --- a/src/command.c +++ b/src/command.c @@ -1031,7 +1031,7 @@ Child_signal(int sig) const char *message = "\r\nPress any key to exit " APL_NAME "...."; scr_refresh(DEFAULT_REFRESH); - scr_add_lines(message, 1, strlen(message)); + scr_add_lines((unsigned char *) message, 1, strlen(message)); scr_refresh(DEFAULT_REFRESH); keypress_exit = 1; return; @@ -1043,7 +1043,7 @@ Child_signal(int sig) D_CMD(("Child_signal: installing signal handler\n")); signal(SIGCHLD, Child_signal); - return ((RETSIGTYPE) 0); + SIG_RETURN(0); } /* Handles signals usually sent by a user, like HUP, TERM, INT. */ @@ -1062,6 +1062,7 @@ Exit_signal(int sig) D_CMD(("Exit_signal(): exit(%s)\n", sig_to_str(sig))); exit(sig); + SIG_RETURN(0); } /* Handles abnormal termination signals -- mej */ @@ -1081,6 +1082,7 @@ SegvHandler(int sig) /* Exit */ exit(sig); + SIG_RETURN(0); } /* @@ -1122,6 +1124,8 @@ clean_exit(void) */ #ifdef __sgi +inline int sgi_get_pty(void); + inline int sgi_get_pty(void) { @@ -1135,6 +1139,8 @@ sgi_get_pty(void) #endif #ifdef HAVE_DEV_PTC +inline int aix_get_pty(void); + inline int aix_get_pty(void) { @@ -1150,6 +1156,8 @@ aix_get_pty(void) #endif #ifdef HAVE_SCO_PTYS +inline int sco_get_pty(void); + inline int sco_get_pty(void) { @@ -1183,6 +1191,7 @@ sco_get_pty(void) #ifdef HAVE_DEV_PTMX inline int svr_get_pty(void); + inline int svr_get_pty(void) { @@ -1215,6 +1224,7 @@ svr_get_pty(void) #define PTYCHAR2 "0123456789abcdefghijklmnopqrstuvwxyz" inline int gen_get_pty(void); + inline int gen_get_pty(void) { @@ -2308,17 +2318,17 @@ check_pixmap_change(int sig) static unsigned char in_cpc = 0; if (in_cpc) - CPC_RETURN(0); + SIG_RETURN(0); in_cpc = 1; D_PIXMAP(("check_pixmap_change(%d): rs_anim_delay == %lu seconds, last_update == %lu\n", sig, rs_anim_delay, last_update)); if (!rs_anim_delay) - CPC_RETURN(0); + SIG_RETURN(0); if (last_update == 0) { last_update = time(NULL); old_handler = signal(SIGALRM, check_pixmap_change); alarm(rs_anim_delay); in_cpc = 0; - CPC_RETURN(0); + SIG_RETURN(0); } now = time(NULL); D_PIXMAP(("now %lu >= %lu (last_update %lu + rs_anim_delay %lu) ?\n", now, last_update + rs_anim_delay, last_update, rs_anim_delay)); @@ -2336,9 +2346,9 @@ check_pixmap_change(int sig) } in_cpc = 0; if (old_handler) { - CPC_RETURN((*old_handler) (sig)); + SIG_RETURN((*old_handler) (sig)); } else { - CPC_RETURN(sig); + SIG_RETURN(sig); } } #endif /* BACKGROUND_CYCLING_SUPPORT */ @@ -2517,9 +2527,9 @@ tt_printf(const unsigned char *fmt,...) va_list arg_ptr; va_start(arg_ptr, fmt); - vsprintf(buf, fmt, arg_ptr); + vsprintf((char *) buf, (char *) fmt, arg_ptr); va_end(arg_ptr); - tt_write(buf, strlen(buf)); + tt_write(buf, strlen((char *) buf)); } /* Read and process output from the application */ diff --git a/src/command.h b/src/command.h index 1de7d3b..84c9275 100644 --- a/src/command.h +++ b/src/command.h @@ -261,12 +261,10 @@ if (test) PrivateModes |= (bit); else PrivateModes &= ~(bit);} while (0) #define PTYCHAR1 "pqrstuvwxyz" #define PTYCHAR2 "0123456789abcdefghijklmnopqrstuvwxyz" -#ifdef BACKGROUND_CYCLING_SUPPORT -# if RETSIGTYPE != void -# define CPC_RETURN(x) return ((RETSIGTYPE) x) -# else -# define CPC_RETURN(x) return -# endif +#if RETSIGTYPE != void +# define SIG_RETURN(x) return ((RETSIGTYPE) x) +#else +# define SIG_RETURN(x) return #endif #define CHARS_READ() (cmdbuf_ptr < cmdbuf_endp) diff --git a/src/e.c b/src/e.c index 0ede64a..d714d32 100644 --- a/src/e.c +++ b/src/e.c @@ -183,7 +183,8 @@ static RETSIGTYPE enl_ipc_timeout(int sig) { timeout = 1; - return ((RETSIGTYPE) sig); + SIG_RETURN(sig); + sig = 0; } char * @@ -285,13 +286,13 @@ eterm_ipc_parse(char *str) } if (!strcasecmp(str, "echo") || !strcasecmp(str, "tty_write")) { if (params) { - tt_write(params, strlen(params)); + tt_write((unsigned char *) params, strlen(params)); } else { print_error("IPC Error: Invalid syntax in command \"%s\"", str); } } else if (!strcasecmp(str, "parse")) { if (params) { - cmd_write(params, strlen(params)); + cmd_write((unsigned char *) params, strlen(params)); } else { print_error("IPC Error: Invalid syntax in command \"%s\"", str); } @@ -307,9 +308,9 @@ eterm_ipc_parse(char *str) reply = enl_send_and_wait(params); snprintf(header, sizeof(header), "Enlightenment IPC Reply to \"%s\":\n\n", params); - tt_write(header, strlen(header)); - tt_write(reply, strlen(reply)); - tt_write("\n", 1); + tt_write((unsigned char *) header, strlen(header)); + tt_write((unsigned char *) reply, strlen(reply)); + tt_write((unsigned char *) "\n", 1); FREE(reply); } else { print_error("IPC Error: Invalid syntax in command \"%s\"", str); diff --git a/src/menus.c b/src/menus.c index ad22c28..dcfc372 100644 --- a/src/menus.c +++ b/src/menus.c @@ -1003,10 +1003,10 @@ menu_action(menuitem_t * item) D_MENU(("Internal Program Error: menu_action() called for a submenu.\n")); break; case MENUITEM_STRING: - cmd_write(item->action.string, strlen(item->action.string)); + cmd_write((unsigned char *) item->action.string, strlen(item->action.string)); break; case MENUITEM_ECHO: - tt_write(item->action.string, strlen(item->action.string)); + tt_write((unsigned char *) item->action.string, strlen(item->action.string)); break; default: fatal_error("Internal Program Error: Unknown menuitem type: %u\n", item->type); diff --git a/src/misc.c b/src/misc.c index e2e6e82..4aec588 100644 --- a/src/misc.c +++ b/src/misc.c @@ -251,7 +251,7 @@ parse_escaped_string(char *str) if (!BEG_STRCASECMP(str, "\033x") && *(pnew - 1) != '\r') { D_STRINGS(("Adding carriage return\n")); *(pnew++) = '\r'; - } else if (!BEG_STRCASECMP(str, "\e]") && *(pnew - 1) != '\a') { + } else if (!BEG_STRCASECMP(str, "\033]") && *(pnew - 1) != '\a') { D_STRINGS(("Adding bell character\n")); *(pnew++) = '\a'; } diff --git a/src/options.c b/src/options.c index d030349..7d93770 100644 --- a/src/options.c +++ b/src/options.c @@ -2077,7 +2077,7 @@ parse_keyboard(char *buff) *p = len; strncpy(p + 1, str, len); - KeySym_map[sym] = p; + KeySym_map[sym] = (unsigned char *) p; } } #else @@ -2364,7 +2364,7 @@ parse_image(char *buff) if (allow_list) { char *allow; - for (; (allow = strsep(&allow_list, " ")) != NULL;) { + for (; (allow = (char *) strsep(&allow_list, " ")) != NULL;) { if (!BEG_STRCASECMP("image", allow)) { images[idx].mode |= ALLOW_IMAGE; } else if (!BEG_STRCASECMP("transparent", allow)) { diff --git a/src/pixmap.c b/src/pixmap.c index 548077a..ac9b388 100644 --- a/src/pixmap.c +++ b/src/pixmap.c @@ -130,7 +130,7 @@ parse_pixmap_ops(char *str) REQUIRE_RVAL(str && *str, OP_NONE); D_PIXMAP(("parse_pixmap_ops(str [%s]) called.\n", str)); - for (; (token = strsep(&str, ":"));) { + for (; (token = (char *) strsep(&str, ":"));) { if (!BEG_STRCASECMP("tiled", token)) { op |= OP_TILE; } else if (!BEG_STRCASECMP("hscaled", token)) { @@ -152,7 +152,8 @@ set_pixmap_scale(const char *geom, pixmap_t *pmap) static char str[GEOM_LEN + 1] = {'\0'}; - int w = 0, h = 0, x = 0, y = 0; + unsigned int w = 0, h = 0; + int x = 0, y = 0; unsigned short op = OP_NONE; int flags; unsigned short changed = 0; @@ -216,12 +217,12 @@ set_pixmap_scale(const char *geom, pixmap_t *pmap) } } - if (pmap->w != w) { - pmap->w = w; + if (pmap->w != (int) w) { + pmap->w = (int) w; changed++; } - if (pmap->h != h) { - pmap->h = h; + if (pmap->h != (int) h) { + pmap->h = (int) h; changed++; } } @@ -1005,7 +1006,7 @@ colormod_trans(Pixmap p, GC gc, unsigned short w, unsigned short h) XImage *ximg; register unsigned long v, i; unsigned long x, y; - unsigned int r, g, b; + int r, g, b; unsigned short rm, gm, bm, shade; ImlibColor ctab[256]; int real_depth = 0; diff --git a/src/screen.c b/src/screen.c index 947189d..d7a2f9b 100644 --- a/src/screen.c +++ b/src/screen.c @@ -1384,7 +1384,7 @@ scr_rvideo_mode(int mode) void scr_report_position(void) { - tt_printf("\033[%d;%dR", screen.row + 1, screen.col + 1); + tt_printf((unsigned char *) "\033[%d;%dR", screen.row + 1, screen.col + 1); } /* ------------------------------------------------------------------------- * @@ -2227,7 +2227,8 @@ PasteIt(unsigned char *data, unsigned int nitems) void selection_paste(Window win, unsigned prop, int Delete) { - long nread, bytes_after, nitems; + long nread; + unsigned long bytes_after, nitems; unsigned char *data; Atom actual_type; int actual_fmt; @@ -2444,7 +2445,8 @@ selection_make(Time tm) return; } i = (selection.end.row - selection.beg.row + 1) * (TermWin.ncol + 1) + 1; - new_selection_text = str = MALLOC(i * sizeof(char)); + str = MALLOC(i * sizeof(char)); + new_selection_text = (unsigned char *) str; col = max(selection.beg.col, 0); row = selection.beg.row + TermWin.saveLines; @@ -2487,7 +2489,7 @@ selection_make(Time tm) if (i) *str++ = '\n'; *str = '\0'; - if ((i = strlen(new_selection_text)) == 0) { + if ((i = strlen((char *) new_selection_text)) == 0) { FREE(new_selection_text); return; } @@ -3039,7 +3041,7 @@ selection_send(XSelectionRequestEvent * rq) target_list[1] = (Atom32) XA_STRING; XChangeProperty(Xdisplay, rq->requestor, rq->property, rq->target, (8 * sizeof(target_list[0])), PropModeReplace, - (char *) target_list, + (unsigned char *) target_list, (sizeof(target_list) / sizeof(target_list[0]))); ev.xselection.property = rq->property; } else if (rq->target == XA_STRING) { @@ -3062,7 +3064,7 @@ mouse_report(XButtonEvent * ev) button_number = ((ev->button == AnyButton) ? 3 : (ev->button - Button1)); key_state = ((ev->state & (ShiftMask | ControlMask)) + ((ev->state & Mod1Mask) ? 2 : 0)); - tt_printf("\033[M%c%c%c", + tt_printf((unsigned char *) "\033[M%c%c%c", (32 + button_number + (key_state << 2)), (32 + Pixel2Col(ev->x) + 1), (32 + Pixel2Row(ev->y) + 1)); diff --git a/src/scrollbar.c b/src/scrollbar.c index 881cc4a..a066906 100644 --- a/src/scrollbar.c +++ b/src/scrollbar.c @@ -60,7 +60,7 @@ static GC scrollbarGC; static short last_top = 0, last_bot = 0; /* old (drawn) values */ #ifdef XTERM_SCROLLBAR /* bitmap scrollbar */ static GC shadowGC; -static char xterm_sb_bits[] = +static unsigned char xterm_sb_bits[] = {0xaa, 0x0a, 0x55, 0x05}; /* 12x2 bitmap */ #endif #if defined(MOTIF_SCROLLBAR) || defined(NEXT_SCROLLBAR) @@ -390,19 +390,19 @@ sb_handle_button_press(event_t * ev) if (button_state.report_mode) { /* Mouse report disabled scrollbar. Arrows send cursor key up/down, trough sends pageup/pagedown */ if (scrollbar_upButton(ev->xany.window, ev->xbutton.y)) - tt_printf("\033[A"); + tt_printf((unsigned char *) "\033[A"); else if (scrollbar_dnButton(ev->xany.window, ev->xbutton.y)) - tt_printf("\033[B"); + tt_printf((unsigned char *) "\033[B"); else switch (ev->xbutton.button) { case Button2: - tt_printf("\014"); + tt_printf((unsigned char *) "\014"); break; case Button1: - tt_printf("\033[6~"); + tt_printf((unsigned char *) "\033[6~"); break; case Button3: - tt_printf("\033[5~"); + tt_printf((unsigned char *) "\033[5~"); break; } } else @@ -498,7 +498,8 @@ sb_handle_button_release(event_t * ev) { Window root, child; - int root_x, root_y, win_x, win_y, mask; + int root_x, root_y, win_x, win_y; + unsigned int mask; D_EVENTS(("sb_handle_button_release(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window)); @@ -719,7 +720,7 @@ scrollbar_show(short mouseoffset) #ifdef XTERM_SCROLLBAR if (scrollBar.type == SCROLLBAR_XTERM) { - gcvalue.stipple = XCreateBitmapFromData(Xdisplay, scrollBar.win, xterm_sb_bits, 12, 2); + gcvalue.stipple = XCreateBitmapFromData(Xdisplay, scrollBar.win, (char *) xterm_sb_bits, 12, 2); if (!gcvalue.stipple) { print_error("Unable to create xterm scrollbar bitmap. Reverting to default scrollbar."); scrollBar.type = SCROLLBAR_MOTIF; diff --git a/src/scrollbar.h b/src/scrollbar.h index 16c2af1..ccd7896 100644 --- a/src/scrollbar.h +++ b/src/scrollbar.h @@ -115,9 +115,9 @@ typedef struct { short beg, end; /* beg/end of slider sub-window */ short top, bot; /* top/bot of slider */ unsigned char state; /* scrollbar state */ - unsigned char type:2; /* scrollbar type (see above) */ - unsigned char init:1; /* has scrollbar been drawn? */ - unsigned char shadow:5; /* shadow width */ + unsigned int type:2; /* scrollbar type (see above) */ + unsigned int init:1; /* has scrollbar been drawn? */ + unsigned int shadow:5; /* shadow width */ unsigned short width, height; /* scrollbar width and height, without the shadow */ unsigned short win_width, win_height; /* scrollbar window dimensions */ short up_arrow_loc, down_arrow_loc; /* y coordinates for arrows */ diff --git a/src/term.c b/src/term.c index 7a9d8c6..57ba41f 100644 --- a/src/term.c +++ b/src/term.c @@ -141,19 +141,19 @@ lookup_key(XEvent * ev) Status status_return; kbuf[0] = '\0'; - len = XmbLookupString(Input_Context, &ev->xkey, (char *)kbuf, + len = XmbLookupString(Input_Context, &ev->xkey, (char *) kbuf, sizeof(short_buf), &keysym, &status_return); if (status_return == XBufferOverflow) { kbuf = (unsigned char *) MALLOC(len + 1); kbuf_alloced = 1; - len = XmbLookupString(Input_Context, &ev->xkey, (char *)kbuf, len, &keysym, &status_return); + len = XmbLookupString(Input_Context, &ev->xkey, (char *) kbuf, len, &keysym, &status_return); } valid_keysym = (status_return == XLookupKeySym) || (status_return == XLookupBoth); } else { - len = XLookupString(&ev->xkey, kbuf, sizeof(short_buf), &keysym, NULL); + len = XLookupString(&ev->xkey, (char *) kbuf, sizeof(short_buf), &keysym, NULL); } #else /* USE_XIM */ - len = XLookupString(&ev->xkey, kbuf, sizeof(kbuf), &keysym, NULL); + len = XLookupString(&ev->xkey, (char *) kbuf, sizeof(kbuf), &keysym, NULL); /* * have unmapped Latin[2-4] entries -> Latin1 @@ -181,7 +181,7 @@ lookup_key(XEvent * ev) } if ((Options & Opt_report_as_keysyms) && (keysym >= 0xff00)) { - len = sprintf(kbuf, "\e[k%X;%X~", (unsigned int) (ev->xkey.state & 0xff), (unsigned int) (keysym & 0xff)); + len = sprintf((char *) kbuf, "\033[k%X;%X~", (unsigned int) (ev->xkey.state & 0xff), (unsigned int) (keysym & 0xff)); tt_write(kbuf, len); LK_RET(); } @@ -523,7 +523,7 @@ lookup_key(XEvent * ev) #define FKEY(n,fkey) do { \ len = 5; \ -sprintf(kbuf,"\033[%02d~", (int)((n) + (keysym - fkey))); \ +sprintf((char *) kbuf,"\033[%02d~", (int)((n) + (keysym - fkey))); \ } while (0); case XK_F1: /* "\033[11~" */ @@ -647,7 +647,7 @@ sprintf(kbuf,"\033[%02d~", (int)((n) + (keysym - fkey))); \ int i; fprintf(stderr, "key 0x%04X[%d]: `", (unsigned int) keysym, len); - for (i = 0, p = kbuf; i < len; i++, p++) + for (i = 0, p = (char *) kbuf; i < len; i++, p++) fprintf(stderr, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p); fprintf(stderr, "'\n"); } @@ -662,7 +662,7 @@ sprintf(kbuf,"\033[%02d~", (int)((n) + (keysym - fkey))); \ FILE * popen_printer(void) { - FILE *stream = popen(rs_print_pipe, "w"); + FILE *stream = (FILE *) popen(rs_print_pipe, "w"); if (stream == NULL) print_error("can't open printer pipe \"%s\" -- %s", rs_print_pipe, strerror(errno)); @@ -749,11 +749,11 @@ process_escape_seq(void) scr_index(UP); break; case 'E': - scr_add_lines("\n\r", 1, 2); + scr_add_lines((unsigned char *) "\n\r", 1, 2); break; case 'G': if ((ch = cmd_getc()) == 'Q') { /* query graphics */ - tt_printf("\033G0\n"); /* no graphics */ + tt_printf((unsigned char *) "\033G0\n"); /* no graphics */ } else { do { ch = cmd_getc(); @@ -769,7 +769,7 @@ process_escape_seq(void) /*case 'N': scr_single_shift (2); break; */ /*case 'O': scr_single_shift (3); break; */ case 'Z': - tt_printf(ESCZ_ANSWER); + tt_printf((unsigned char *) ESCZ_ANSWER); break; /* steal obsolete ESC [ c */ case '[': process_csi_seq(); @@ -929,14 +929,14 @@ process_csi_seq(void) case 'n': /* request for information */ switch (arg[0]) { case 5: - tt_printf("\033[0n"); + tt_printf((unsigned char *) "\033[0n"); break; /* ready */ case 6: scr_report_position(); break; #if defined (ENABLE_DISPLAY_ANSWER) case 7: - tt_printf("%s\n", display_name); + tt_printf((unsigned char *) "%s\n", display_name); break; #endif case 8: @@ -1076,12 +1076,12 @@ process_xterm_seq(void) } } string[n] = '\0'; - xterm_seq(arg, string); + xterm_seq(arg, (char *) string); } else { unsigned long n = 0; - for (; ch != '\e'; ch = cmd_getc()) { + for (; ch != '\033'; ch = cmd_getc()) { if (ch) { if (ch == '\t') ch = ' '; /* translate '\t' to space */ @@ -1099,13 +1099,13 @@ process_xterm_seq(void) } switch (arg) { case 'l': - xterm_seq(XTerm_title, string); + xterm_seq(XTerm_title, (char *) string); break; case 'L': - xterm_seq(XTerm_iconName, string); + xterm_seq(XTerm_iconName, (char *) string); break; case 'I': - set_icon_pixmap(string, NULL); + set_icon_pixmap((char *) string, NULL); break; default: break; @@ -1119,7 +1119,7 @@ process_window_mode(unsigned int nargs, int args[]) { register unsigned int i; - unsigned int x, y; + int x, y; Screen *scr; Window dummy_child; char buff[128], *name; @@ -1136,7 +1136,7 @@ process_window_mode(unsigned int nargs, int args[]) unsigned int dummy_border, dummy_depth; /* Store current width and height in x and y */ - XGetGeometry(Xdisplay, TermWin.parent, &dummy_child, &dummy_x, &dummy_y, &x, &y, &dummy_border, &dummy_depth); + XGetGeometry(Xdisplay, TermWin.parent, &dummy_child, &dummy_x, &dummy_y, (unsigned int *) (&x), (unsigned int *) (&y), &dummy_border, &dummy_depth); } switch (args[i]) { case 1: @@ -1150,7 +1150,7 @@ process_window_mode(unsigned int nargs, int args[]) return; /* Make sure there are 2 args left */ x = args[++i]; y = args[++i]; - if (x > (unsigned long) scr->width || y > (unsigned long) scr->height) + if (((unsigned int) x > (unsigned int) scr->width) || ((unsigned int) y > (unsigned int) scr->height)) return; /* Don't move off-screen */ XMoveWindow(Xdisplay, TermWin.parent, x, y); break; @@ -1189,27 +1189,27 @@ process_window_mode(unsigned int nargs, int args[]) break; case 13: XTranslateCoordinates(Xdisplay, TermWin.parent, Xroot, 0, 0, &x, &y, &dummy_child); - snprintf(buff, sizeof(buff), "\e[3;%d;%dt", x, y); - tt_write(buff, strlen(buff)); + snprintf(buff, sizeof(buff), "\033[3;%d;%dt", x, y); + tt_write((unsigned char *) buff, strlen(buff)); break; case 14: - snprintf(buff, sizeof(buff), "\e[4;%d;%dt", y, x); - tt_write(buff, strlen(buff)); + snprintf(buff, sizeof(buff), "\033[4;%d;%dt", y, x); + tt_write((unsigned char *) buff, strlen(buff)); break; case 18: - snprintf(buff, sizeof(buff), "\e[8;%d;%dt", TermWin.nrow, TermWin.ncol); - tt_write(buff, strlen(buff)); + snprintf(buff, sizeof(buff), "\033[8;%d;%dt", TermWin.nrow, TermWin.ncol); + tt_write((unsigned char *) buff, strlen(buff)); break; case 20: XGetIconName(Xdisplay, TermWin.parent, &name); - snprintf(buff, sizeof(buff), "\e]L%s\e\\", name); - tt_write(buff, strlen(buff)); + snprintf(buff, sizeof(buff), "\033]L%s\033\\", name); + tt_write((unsigned char *) buff, strlen(buff)); XFree(name); break; case 21: XFetchName(Xdisplay, TermWin.parent, &name); - snprintf(buff, sizeof(buff), "\e]l%s\e\\", name); - tt_write(buff, strlen(buff)); + snprintf(buff, sizeof(buff), "\033]l%s\033\\", name); + tt_write((unsigned char *) buff, strlen(buff)); XFree(name); break; default: @@ -1599,7 +1599,7 @@ xterm_seq(int op, const char *str) set_title(str); break; case XTerm_prop: - if ((nstr = strsep(&tnstr, ";")) == NULL) { + if ((nstr = (char *) strsep(&tnstr, ";")) == NULL) { break; } if ((valptr = strchr(nstr, '=')) != NULL) { @@ -1648,7 +1648,7 @@ xterm_seq(int op, const char *str) */ D_CMD(("Got XTerm_EtermSeq sequence\n")); - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); eterm_seq_op = (unsigned char) strtol(nstr, (char **) NULL, 10); D_CMD((" XTerm_EtermSeq operation is %d\n", eterm_seq_op)); /* Yes, there is order to the numbers for this stuff. And here it is: @@ -1664,7 +1664,7 @@ xterm_seq(int op, const char *str) switch (eterm_seq_op) { #ifdef PIXMAP_OFFSET case 0: - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); if (nstr) { if (BOOL_OPT_ISTRUE(nstr)) { D_CMD((" Request to enable transparency.\n")); @@ -1695,7 +1695,7 @@ xterm_seq(int op, const char *str) redraw_all_images(); break; case 1: - if ((color = strsep(&tnstr, ";")) == NULL) { + if ((color = (char *) strsep(&tnstr, ";")) == NULL) { break; } if ((strlen(color) == 2) || (!strcasecmp(color, "down"))) { @@ -1713,16 +1713,16 @@ xterm_seq(int op, const char *str) } else { break; } - if ((color = strsep(&tnstr, ";")) == NULL) { + if ((color = (char *) strsep(&tnstr, ";")) == NULL) { break; } } else { which = image_bg; } - if ((mod = strsep(&tnstr, ";")) == NULL) { + if ((mod = (char *) strsep(&tnstr, ";")) == NULL) { break; } - if ((valptr = strsep(&tnstr, ";")) == NULL) { + if ((valptr = (char *) strsep(&tnstr, ";")) == NULL) { break; } D_CMD(("Modifying the %s attribute of the %s color modifier of the %s image to be %s\n", mod, color, get_image_type(which), valptr)); @@ -1809,7 +1809,7 @@ xterm_seq(int op, const char *str) break; #endif case 10: - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); if (nstr && *nstr) { if (!strcasecmp(nstr, "xterm")) { #ifdef XTERM_SCROLLBAR @@ -1837,7 +1837,7 @@ xterm_seq(int op, const char *str) map_scrollbar(1); scrollbar_show(0); } - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); if (nstr && *nstr) { scrollBar.width = strtoul(nstr, (char **) NULL, 0); if (scrollBar.width == 0) { @@ -1851,7 +1851,7 @@ xterm_seq(int op, const char *str) } break; case 11: - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); OPT_SET_OR_TOGGLE(nstr, Options, Opt_scrollBar_right); scrollbar_reset(); map_scrollbar(0); @@ -1859,7 +1859,7 @@ xterm_seq(int op, const char *str) scrollbar_show(0); break; case 12: - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); OPT_SET_OR_TOGGLE(nstr, Options, Opt_scrollBar_floating); scrollbar_reset(); map_scrollbar(0); @@ -1867,42 +1867,42 @@ xterm_seq(int op, const char *str) scrollbar_show(0); break; case 13: - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); OPT_SET_OR_TOGGLE(nstr, Options, Opt_scrollbar_popup); break; case 20: - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); OPT_SET_OR_TOGGLE(nstr, Options, Opt_visualBell); break; #ifdef MAPALERT_OPTION case 21: - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); OPT_SET_OR_TOGGLE(nstr, Options, Opt_mapAlert); break; #endif case 22: - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); OPT_SET_OR_TOGGLE(nstr, Options, Opt_xterm_select); break; case 23: - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); OPT_SET_OR_TOGGLE(nstr, Options, Opt_select_whole_line); break; case 24: - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); FOREACH_IMAGE(if (!image_mode_is(idx, MODE_VIEWPORT) && image_mode_is(idx, ALLOW_VIEWPORT)) {image_set_mode(idx, MODE_VIEWPORT);}); redraw_all_images(); break; case 25: - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); OPT_SET_OR_TOGGLE(nstr, Options, Opt_select_trailing_spaces); break; case 26: - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); OPT_SET_OR_TOGGLE(nstr, Options, Opt_report_as_keysyms); break; case 30: - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); if (nstr) { if (XParseColor(Xdisplay, cmap, nstr, &xcol) && XAllocColor(Xdisplay, cmap, &xcol)) { PixColors[fgColor] = xcol.pixel; @@ -1911,7 +1911,7 @@ xterm_seq(int op, const char *str) } break; case 40: - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); if (nstr) { if (XParseColor(Xdisplay, cmap, nstr, &xcol) && XAllocColor(Xdisplay, cmap, &xcol)) { PixColors[bgColor] = xcol.pixel; @@ -1921,7 +1921,7 @@ xterm_seq(int op, const char *str) break; case 50: /* Change desktops */ - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); if (nstr && *nstr) { XClientMessageEvent xev; @@ -1941,7 +1941,7 @@ xterm_seq(int op, const char *str) break; case 71: /* Save current config */ - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); if (nstr && *nstr) { save_config(nstr); } else { @@ -1950,7 +1950,7 @@ xterm_seq(int op, const char *str) break; case 80: /* Set debugging level */ - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); if (nstr && *nstr) { debug_level = (unsigned int) strtoul(nstr, (char **) NULL, 0); } @@ -1968,14 +1968,14 @@ xterm_seq(int op, const char *str) load_image("", image_bg); bg_needs_update = 1; } else { - nstr = strsep(&tnstr, ";"); + nstr = (char *) strsep(&tnstr, ";"); if (nstr) { if (*nstr) { set_pixmap_scale("", images[image_bg].current->pmap); bg_needs_update = 1; load_image(nstr, image_bg); } - while ((nstr = strsep(&tnstr, ";")) && *nstr) { + while ((nstr = (char *) strsep(&tnstr, ";")) && *nstr) { changed += set_pixmap_scale(nstr, images[image_bg].current->pmap); scaled = 1; } @@ -1991,7 +1991,7 @@ xterm_seq(int op, const char *str) break; case XTerm_EtermIPC: - for (; (nstr = strsep(&tnstr, ";"));) { + for (; (nstr = (char *) strsep(&tnstr, ";"));) { eterm_ipc_parse(nstr); } break; diff --git a/src/windows.c b/src/windows.c index ab0c824..29ca62c 100644 --- a/src/windows.c +++ b/src/windows.c @@ -83,7 +83,7 @@ set_text_property(Window win, char *propname, char *value) XDeleteProperty(Xdisplay, win, atom); } else { atom = XInternAtom(Xdisplay, propname, False); - prop.value = value; + prop.value = (unsigned char *) value; prop.encoding = XA_STRING; prop.format = 8; prop.nitems = strlen(value); @@ -96,7 +96,7 @@ get_bottom_shadow_color(Pixel norm_color, const char *type) { XColor xcol; - unsigned int r, g, b; + int r, g, b; xcol.pixel = norm_color; XQueryColor(Xdisplay, cmap, &xcol); @@ -121,7 +121,7 @@ get_top_shadow_color(Pixel norm_color, const char *type) { XColor xcol, white; - unsigned int r, g, b; + int r, g, b; # ifdef PREFER_24BIT white.red = white.green = white.blue = r = g = b = ~0; @@ -166,7 +166,7 @@ Create_Windows(int argc, char *argv[]) CARD32 val; int i, x = 0, y = 0, flags; unsigned int width = 0, height = 0; - unsigned int r, g, b; + int r, g, b; MWMHints mwmhints; if (Options & Opt_borderless) {