| To: vim-dev@vim.org |
| Subject: Patch 7.2.055 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.2.055 |
| Problem: Various compiler warnings with strict checking. |
| Solution: Avoid the warnings by using return values and renaming. |
| Files: src/diff.c, src/eval.c, src/ex_cmds.c, src/ex_docmd.c, |
| src/fileio.c, src/fold.c, src/globals.h, src/gui.c, |
| src/gui_at_sb.c, src/gui_gtk_x11.c, src/gui_xmdlg.c, |
| src/gui_xmebw.c, src/main.c, src/mbyte.c, src/message.c, |
| src/netbeans.c, src/option.c, src/os_unix.c, src/spell.c, |
| src/ui.c, src/window.c |
| |
| |
| |
| |
| |
| *** 661,666 **** |
| --- 665,671 ---- |
| char_u *tmp_diff; |
| FILE *fd; |
| int ok; |
| + int io_error = FALSE; |
| |
| /* Delete all diffblocks. */ |
| diff_clear(curtab); |
| |
| *** 697,714 **** |
| { |
| ok = FALSE; |
| fd = mch_fopen((char *)tmp_orig, "w"); |
| ! if (fd != NULL) |
| { |
| ! fwrite("line1\n", (size_t)6, (size_t)1, fd); |
| fclose(fd); |
| fd = mch_fopen((char *)tmp_new, "w"); |
| ! if (fd != NULL) |
| { |
| ! fwrite("line2\n", (size_t)6, (size_t)1, fd); |
| fclose(fd); |
| diff_file(tmp_orig, tmp_new, tmp_diff); |
| fd = mch_fopen((char *)tmp_diff, "r"); |
| ! if (fd != NULL) |
| { |
| char_u linebuf[LBUFLEN]; |
| |
| --- 702,727 ---- |
| { |
| ok = FALSE; |
| fd = mch_fopen((char *)tmp_orig, "w"); |
| ! if (fd == NULL) |
| ! io_error = TRUE; |
| ! else |
| { |
| ! if (fwrite("line1\n", (size_t)6, (size_t)1, fd) != 1) |
| ! io_error = TRUE; |
| fclose(fd); |
| fd = mch_fopen((char *)tmp_new, "w"); |
| ! if (fd == NULL) |
| ! io_error = TRUE; |
| ! else |
| { |
| ! if (fwrite("line2\n", (size_t)6, (size_t)1, fd) != 1) |
| ! io_error = TRUE; |
| fclose(fd); |
| diff_file(tmp_orig, tmp_new, tmp_diff); |
| fd = mch_fopen((char *)tmp_diff, "r"); |
| ! if (fd == NULL) |
| ! io_error = TRUE; |
| ! else |
| { |
| char_u linebuf[LBUFLEN]; |
| |
| |
| *** 761,766 **** |
| --- 774,781 ---- |
| } |
| if (!ok) |
| { |
| + if (io_error) |
| + EMSG(_("E810: Cannot read or write temp files")); |
| EMSG(_("E97: Cannot create diffs")); |
| diff_a_works = MAYBE; |
| #if defined(MSWIN) || defined(MSDOS) |
| |
| *** 925,934 **** |
| { |
| # ifdef TEMPDIRNAMES |
| if (vim_tempdir != NULL) |
| ! mch_chdir((char *)vim_tempdir); |
| else |
| # endif |
| ! mch_chdir("/tmp"); |
| shorten_fnames(TRUE); |
| } |
| #endif |
| --- 940,949 ---- |
| { |
| # ifdef TEMPDIRNAMES |
| if (vim_tempdir != NULL) |
| ! ignored = mch_chdir((char *)vim_tempdir); |
| else |
| # endif |
| ! ignored = mch_chdir("/tmp"); |
| shorten_fnames(TRUE); |
| } |
| #endif |
| |
| |
| |
| *** 10641,10647 **** |
| # ifdef FEAT_WINDOWS |
| win_T *wp; |
| # endif |
| ! int n = 1; |
| |
| if (row >= 0 && col >= 0) |
| { |
| --- 10641,10647 ---- |
| # ifdef FEAT_WINDOWS |
| win_T *wp; |
| # endif |
| ! int winnr = 1; |
| |
| if (row >= 0 && col >= 0) |
| { |
| |
| *** 10651,10659 **** |
| (void)mouse_comp_pos(win, &row, &col, &lnum); |
| # ifdef FEAT_WINDOWS |
| for (wp = firstwin; wp != win; wp = wp->w_next) |
| ! ++n; |
| # endif |
| ! vimvars[VV_MOUSE_WIN].vv_nr = n; |
| vimvars[VV_MOUSE_LNUM].vv_nr = lnum; |
| vimvars[VV_MOUSE_COL].vv_nr = col + 1; |
| } |
| --- 10651,10659 ---- |
| (void)mouse_comp_pos(win, &row, &col, &lnum); |
| # ifdef FEAT_WINDOWS |
| for (wp = firstwin; wp != win; wp = wp->w_next) |
| ! ++winnr; |
| # endif |
| ! vimvars[VV_MOUSE_WIN].vv_nr = winnr; |
| vimvars[VV_MOUSE_LNUM].vv_nr = lnum; |
| vimvars[VV_MOUSE_COL].vv_nr = col + 1; |
| } |
| |
| |
| |
| *** 1941,1947 **** |
| * root. |
| */ |
| if (fp_out != NULL) |
| ! (void)fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid); |
| #endif |
| } |
| } |
| --- 1941,1947 ---- |
| * root. |
| */ |
| if (fp_out != NULL) |
| ! ignored = fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid); |
| #endif |
| } |
| } |
| |
| |
| |
| *** 8753,8760 **** |
| else if (*dirnow != NUL |
| && (ssop_flags & SSOP_CURDIR) && globaldir != NULL) |
| { |
| ! (void)mch_chdir((char *)globaldir); |
| ! shorten_fnames(TRUE); |
| } |
| |
| failed |= (makeopens(fd, dirnow) == FAIL); |
| --- 8753,8760 ---- |
| else if (*dirnow != NUL |
| && (ssop_flags & SSOP_CURDIR) && globaldir != NULL) |
| { |
| ! if (mch_chdir((char *)globaldir) == OK) |
| ! shorten_fnames(TRUE); |
| } |
| |
| failed |= (makeopens(fd, dirnow) == FAIL); |
| |
| |
| |
| *** 2214,2220 **** |
| { |
| /* Use stderr for stdin, makes shell commands work. */ |
| close(0); |
| ! dup(2); |
| } |
| #endif |
| |
| --- 2214,2220 ---- |
| { |
| /* Use stderr for stdin, makes shell commands work. */ |
| close(0); |
| ! ignored = dup(2); |
| } |
| #endif |
| |
| |
| *** 3449,3455 **** |
| { |
| # ifdef UNIX |
| # ifdef HAVE_FCHOWN |
| ! fchown(fd, st_old.st_uid, st_old.st_gid); |
| # endif |
| if (mch_stat((char *)IObuff, &st) < 0 |
| || st.st_uid != st_old.st_uid |
| --- 3449,3455 ---- |
| { |
| # ifdef UNIX |
| # ifdef HAVE_FCHOWN |
| ! ignored = fchown(fd, st_old.st_uid, st_old.st_gid); |
| # endif |
| if (mch_stat((char *)IObuff, &st) < 0 |
| || st.st_uid != st_old.st_uid |
| |
| *** 4365,4371 **** |
| || st.st_uid != st_old.st_uid |
| || st.st_gid != st_old.st_gid) |
| { |
| ! fchown(fd, st_old.st_uid, st_old.st_gid); |
| if (perm >= 0) /* set permission again, may have changed */ |
| (void)mch_setperm(wfname, perm); |
| } |
| --- 4365,4371 ---- |
| || st.st_uid != st_old.st_uid |
| || st.st_gid != st_old.st_gid) |
| { |
| ! ignored = fchown(fd, st_old.st_uid, st_old.st_gid); |
| if (perm >= 0) /* set permission again, may have changed */ |
| (void)mch_setperm(wfname, perm); |
| } |
| |
| *** 6030,6038 **** |
| { |
| tbuf[FGETS_SIZE - 2] = NUL; |
| #ifdef USE_CR |
| ! fgets_cr((char *)tbuf, FGETS_SIZE, fp); |
| #else |
| ! fgets((char *)tbuf, FGETS_SIZE, fp); |
| #endif |
| } while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n'); |
| } |
| --- 6030,6038 ---- |
| { |
| tbuf[FGETS_SIZE - 2] = NUL; |
| #ifdef USE_CR |
| ! ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp); |
| #else |
| ! ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp); |
| #endif |
| } while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n'); |
| } |
| |
| |
| |
| *** 48,54 **** |
| static int foldFind __ARGS((garray_T *gap, linenr_T lnum, fold_T **fpp)); |
| static int foldLevelWin __ARGS((win_T *wp, linenr_T lnum)); |
| static void checkupdate __ARGS((win_T *wp)); |
| ! static void setFoldRepeat __ARGS((linenr_T lnum, long count, int open)); |
| static linenr_T setManualFold __ARGS((linenr_T lnum, int opening, int recurse, int *donep)); |
| static linenr_T setManualFoldWin __ARGS((win_T *wp, linenr_T lnum, int opening, int recurse, int *donep)); |
| static void foldOpenNested __ARGS((fold_T *fpr)); |
| --- 48,54 ---- |
| static int foldFind __ARGS((garray_T *gap, linenr_T lnum, fold_T **fpp)); |
| static int foldLevelWin __ARGS((win_T *wp, linenr_T lnum)); |
| static void checkupdate __ARGS((win_T *wp)); |
| ! static void setFoldRepeat __ARGS((linenr_T lnum, long count, int do_open)); |
| static linenr_T setManualFold __ARGS((linenr_T lnum, int opening, int recurse, int *donep)); |
| static linenr_T setManualFoldWin __ARGS((win_T *wp, linenr_T lnum, int opening, int recurse, int *donep)); |
| static void foldOpenNested __ARGS((fold_T *fpr)); |
| |
| *** 1241,1250 **** |
| * Repeat "count" times. |
| */ |
| static void |
| ! setFoldRepeat(lnum, count, open) |
| linenr_T lnum; |
| long count; |
| ! int open; |
| { |
| int done; |
| long n; |
| --- 1241,1250 ---- |
| * Repeat "count" times. |
| */ |
| static void |
| ! setFoldRepeat(lnum, count, do_open) |
| linenr_T lnum; |
| long count; |
| ! int do_open; |
| { |
| int done; |
| long n; |
| |
| *** 1252,1258 **** |
| for (n = 0; n < count; ++n) |
| { |
| done = DONE_NOTHING; |
| ! (void)setManualFold(lnum, open, FALSE, &done); |
| if (!(done & DONE_ACTION)) |
| { |
| /* Only give an error message when no fold could be opened. */ |
| --- 1252,1258 ---- |
| for (n = 0; n < count; ++n) |
| { |
| done = DONE_NOTHING; |
| ! (void)setManualFold(lnum, do_open, FALSE, &done); |
| if (!(done & DONE_ACTION)) |
| { |
| /* Only give an error message when no fold could be opened. */ |
| |
| |
| |
| *** 1549,1554 **** |
| --- 1549,1562 ---- |
| EXTERN time_t starttime; |
| |
| /* |
| + * Some compilers warn for not using a return value, but in some situations we |
| + * can't do anything useful with the value. Assign to this variable to avoid |
| + * the warning. |
| + */ |
| + EXTERN int ignored; |
| + EXTERN char *ignoredp; |
| + |
| + /* |
| * Optional Farsi support. Include it here, so EXTERN and INIT are defined. |
| */ |
| #ifdef FEAT_FKMAP |
| |
| |
| |
| *** 139,145 **** |
| /* The read returns when the child closes the pipe (or when |
| * the child dies for some reason). */ |
| close(pipefd[1]); |
| ! (void)read(pipefd[0], &dummy, (size_t)1); |
| close(pipefd[0]); |
| } |
| |
| --- 139,145 ---- |
| /* The read returns when the child closes the pipe (or when |
| * the child dies for some reason). */ |
| close(pipefd[1]); |
| ! ignored = (int)read(pipefd[0], &dummy, (size_t)1); |
| close(pipefd[0]); |
| } |
| |
| |
| |
| |
| *** 1078,1083 **** |
| --- 1078,1089 ---- |
| Cardinal *num_params; /* unused */ |
| { |
| ScrollbarWidget sbw = (ScrollbarWidget)w; |
| + /* Use a union to avoid a warning for the weird conversion from float to |
| + * XtPointer. Comes from Xaw/Scrollbar.c. */ |
| + union { |
| + XtPointer xtp; |
| + float xtf; |
| + } xtpf; |
| |
| if (LookAhead(w, event)) |
| return; |
| |
| *** 1085,1091 **** |
| /* thumbProc is not pretty, but is necessary for backwards |
| compatibility on those architectures for which it work{s,ed}; |
| the intent is to pass a (truncated) float by value. */ |
| ! XtCallCallbacks(w, XtNthumbProc, *(XtPointer*)&sbw->scrollbar.top); |
| XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top); |
| } |
| |
| --- 1091,1098 ---- |
| /* thumbProc is not pretty, but is necessary for backwards |
| compatibility on those architectures for which it work{s,ed}; |
| the intent is to pass a (truncated) float by value. */ |
| ! xtpf.xtf = sbw->scrollbar.top; |
| ! XtCallCallbacks(w, XtNthumbProc, xtpf.xtp); |
| XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top); |
| } |
| |
| |
| |
| |
| *** 4070,4083 **** |
| |
| if (mask & (XValue | YValue)) |
| { |
| ! int w, h; |
| ! gui_mch_get_screen_dimensions(&w, &h); |
| ! h += p_ghr + get_menu_tool_height(); |
| ! w += get_menu_tool_width(); |
| if (mask & XNegative) |
| ! x += w - pixel_width; |
| if (mask & YNegative) |
| ! y += h - pixel_height; |
| #ifdef HAVE_GTK2 |
| gtk_window_move(GTK_WINDOW(gui.mainwin), x, y); |
| #else |
| --- 4070,4083 ---- |
| |
| if (mask & (XValue | YValue)) |
| { |
| ! int ww, hh; |
| ! gui_mch_get_screen_dimensions(&ww, &hh); |
| ! hh += p_ghr + get_menu_tool_height(); |
| ! ww += get_menu_tool_width(); |
| if (mask & XNegative) |
| ! x += ww - pixel_width; |
| if (mask & YNegative) |
| ! y += hh - pixel_height; |
| #ifdef HAVE_GTK2 |
| gtk_window_move(GTK_WINDOW(gui.mainwin), x, y); |
| #else |
| |
| |
| |
| *** 369,378 **** |
| char buf[TEMP_BUF_SIZE]; |
| XmString items[MAX_ENTRIES_IN_LIST]; |
| int i; |
| ! int index; |
| |
| ! for (index = (int)ENCODING; index < (int)NONE; ++index) |
| ! count[index] = 0; |
| |
| /* First we insert the wild char into every single list. */ |
| if (fix != ENCODING) |
| --- 369,378 ---- |
| char buf[TEMP_BUF_SIZE]; |
| XmString items[MAX_ENTRIES_IN_LIST]; |
| int i; |
| ! int idx; |
| |
| ! for (idx = (int)ENCODING; idx < (int)NONE; ++idx) |
| ! count[idx] = 0; |
| |
| /* First we insert the wild char into every single list. */ |
| if (fix != ENCODING) |
| |
| *** 503,516 **** |
| /* |
| * Now loop trough the remaining lists and set them up. |
| */ |
| ! for (index = (int)NAME; index < (int)NONE; ++index) |
| { |
| Widget w; |
| |
| ! if (fix == (enum ListSpecifier)index) |
| continue; |
| |
| ! switch ((enum ListSpecifier)index) |
| { |
| case NAME: |
| w = data->list[NAME]; |
| --- 503,516 ---- |
| /* |
| * Now loop trough the remaining lists and set them up. |
| */ |
| ! for (idx = (int)NAME; idx < (int)NONE; ++idx) |
| { |
| Widget w; |
| |
| ! if (fix == (enum ListSpecifier)idx) |
| continue; |
| |
| ! switch ((enum ListSpecifier)idx) |
| { |
| case NAME: |
| w = data->list[NAME]; |
| |
| *** 525,545 **** |
| w = (Widget)0; /* for lint */ |
| } |
| |
| ! for (i = 0; i < count[index]; ++i) |
| { |
| ! items[i] = XmStringCreateLocalized(list[index][i]); |
| ! XtFree(list[index][i]); |
| } |
| XmListDeleteAllItems(w); |
| ! XmListAddItems(w, items, count[index], 1); |
| ! if (data->sel[index]) |
| { |
| XmStringFree(items[0]); |
| ! items[0] = XmStringCreateLocalized(data->sel[index]); |
| XmListSelectItem(w, items[0], False); |
| XmListSetBottomItem(w, items[0]); |
| } |
| ! for (i = 0; i < count[index]; ++i) |
| XmStringFree(items[i]); |
| } |
| } |
| --- 525,545 ---- |
| w = (Widget)0; /* for lint */ |
| } |
| |
| ! for (i = 0; i < count[idx]; ++i) |
| { |
| ! items[i] = XmStringCreateLocalized(list[idx][i]); |
| ! XtFree(list[idx][i]); |
| } |
| XmListDeleteAllItems(w); |
| ! XmListAddItems(w, items, count[idx], 1); |
| ! if (data->sel[idx]) |
| { |
| XmStringFree(items[0]); |
| ! items[0] = XmStringCreateLocalized(data->sel[idx]); |
| XmListSelectItem(w, items[0], False); |
| XmListSetBottomItem(w, items[0]); |
| } |
| ! for (i = 0; i < count[idx]; ++i) |
| XmStringFree(items[i]); |
| } |
| } |
| |
| *** 695,708 **** |
| int n; |
| XmString str; |
| Arg args[4]; |
| ! char *msg = _("no specific match"); |
| |
| n = 0; |
| ! str = XmStringCreateLocalized(msg); |
| XtSetArg(args[n], XmNlabelString, str); ++n; |
| XtSetValues(data->sample, args, n); |
| apply_fontlist(data->sample); |
| ! XmTextSetString(data->name, msg); |
| XmStringFree(str); |
| |
| return False; |
| --- 695,708 ---- |
| int n; |
| XmString str; |
| Arg args[4]; |
| ! char *nomatch_msg = _("no specific match"); |
| |
| n = 0; |
| ! str = XmStringCreateLocalized(nomatch_msg); |
| XtSetArg(args[n], XmNlabelString, str); ++n; |
| XtSetValues(data->sample, args, n); |
| apply_fontlist(data->sample); |
| ! XmTextSetString(data->name, nomatch_msg); |
| XmStringFree(str); |
| |
| return False; |
| |
| *** 886,906 **** |
| { |
| int i; |
| int max; |
| ! int index = 0; |
| int size; |
| ! char str[128]; |
| |
| for (i = 0, max = 0; i < data->num; i++) |
| { |
| ! get_part(fn(data, i), 7, str); |
| ! size = atoi(str); |
| if ((size > max) && (size < MAX_DISPLAY_SIZE)) |
| { |
| ! index = i; |
| max = size; |
| } |
| } |
| ! strcpy(big_font, fn(data, index)); |
| } |
| data->old = XLoadQueryFont(XtDisplay(parent), big_font); |
| data->old_list = gui_motif_create_fontlist(data->old); |
| --- 886,906 ---- |
| { |
| int i; |
| int max; |
| ! int idx = 0; |
| int size; |
| ! char buf[128]; |
| |
| for (i = 0, max = 0; i < data->num; i++) |
| { |
| ! get_part(fn(data, i), 7, buf); |
| ! size = atoi(buf); |
| if ((size > max) && (size < MAX_DISPLAY_SIZE)) |
| { |
| ! idx = i; |
| max = size; |
| } |
| } |
| ! strcpy(big_font, fn(data, idx)); |
| } |
| data->old = XLoadQueryFont(XtDisplay(parent), big_font); |
| data->old_list = gui_motif_create_fontlist(data->old); |
| |
| *** 1217,1244 **** |
| |
| if (i != 0) |
| { |
| ! char name[TEMP_BUF_SIZE]; |
| ! char style[TEMP_BUF_SIZE]; |
| ! char size[TEMP_BUF_SIZE]; |
| ! char encoding[TEMP_BUF_SIZE]; |
| char *found; |
| |
| found = names[0]; |
| |
| ! name_part(found, name); |
| ! style_part(found, style); |
| ! size_part(found, size, data->in_pixels); |
| ! encoding_part(found, encoding); |
| ! |
| ! if (strlen(name) > 0 |
| ! && strlen(style) > 0 |
| ! && strlen(size) > 0 |
| ! && strlen(encoding) > 0) |
| { |
| ! data->sel[NAME] = XtNewString(name); |
| ! data->sel[STYLE] = XtNewString(style); |
| ! data->sel[SIZE] = XtNewString(size); |
| ! data->sel[ENCODING] = XtNewString(encoding); |
| data->font_name = XtNewString(names[0]); |
| display_sample(data); |
| XmTextSetString(data->name, data->font_name); |
| --- 1217,1244 ---- |
| |
| if (i != 0) |
| { |
| ! char namebuf[TEMP_BUF_SIZE]; |
| ! char stylebuf[TEMP_BUF_SIZE]; |
| ! char sizebuf[TEMP_BUF_SIZE]; |
| ! char encodingbuf[TEMP_BUF_SIZE]; |
| char *found; |
| |
| found = names[0]; |
| |
| ! name_part(found, namebuf); |
| ! style_part(found, stylebuf); |
| ! size_part(found, sizebuf, data->in_pixels); |
| ! encoding_part(found, encodingbuf); |
| ! |
| ! if (strlen(namebuf) > 0 |
| ! && strlen(stylebuf) > 0 |
| ! && strlen(sizebuf) > 0 |
| ! && strlen(encodingbuf) > 0) |
| { |
| ! data->sel[NAME] = XtNewString(namebuf); |
| ! data->sel[STYLE] = XtNewString(stylebuf); |
| ! data->sel[SIZE] = XtNewString(sizebuf); |
| ! data->sel[ENCODING] = XtNewString(encodingbuf); |
| data->font_name = XtNewString(names[0]); |
| display_sample(data); |
| XmTextSetString(data->name, data->font_name); |
| |
| |
| |
| *** 1256,1262 **** |
| } |
| else |
| { |
| ! int adjust = 0; |
| |
| #if !defined(LESSTIF_VERSION) && (XmVersion > 1002) |
| /* |
| --- 1256,1262 ---- |
| } |
| else |
| { |
| ! adjust = 0; |
| |
| #if !defined(LESSTIF_VERSION) && (XmVersion > 1002) |
| /* |
| |
| *** 1268,1279 **** |
| { |
| case XmEXTERNAL_HIGHLIGHT: |
| adjust = (eb->primitive.highlight_thickness - |
| ! (eb->pushbutton.default_button_shadow_thickness ? |
| ! Xm3D_ENHANCE_PIXEL : 0)); |
| break; |
| |
| case XmINTERNAL_HIGHLIGHT: |
| - adjust = 0; |
| break; |
| |
| default: |
| --- 1268,1278 ---- |
| { |
| case XmEXTERNAL_HIGHLIGHT: |
| adjust = (eb->primitive.highlight_thickness - |
| ! (eb->pushbutton.default_button_shadow_thickness |
| ! ? Xm3D_ENHANCE_PIXEL : 0)); |
| break; |
| |
| case XmINTERNAL_HIGHLIGHT: |
| break; |
| |
| default: |
| |
| |
| |
| *** 2372,2378 **** |
| * Is there any other system that cannot do this? |
| */ |
| close(0); |
| ! dup(2); |
| #endif |
| } |
| |
| --- 2372,2378 ---- |
| * Is there any other system that cannot do this? |
| */ |
| close(0); |
| ! ignored = dup(2); |
| #endif |
| } |
| |
| |
| |
| |
| *** 717,723 **** |
| * where mblen() returns 0 for invalid character. |
| * Therefore, following condition includes 0. |
| */ |
| ! (void)mblen(NULL, 0); /* First reset the state. */ |
| if (mblen(buf, (size_t)1) <= 0) |
| n = 2; |
| else |
| --- 717,723 ---- |
| * where mblen() returns 0 for invalid character. |
| * Therefore, following condition includes 0. |
| */ |
| ! ignored = mblen(NULL, 0); /* First reset the state. */ |
| if (mblen(buf, (size_t)1) <= 0) |
| n = 2; |
| else |
| |
| *** 5278,5284 **** |
| |
| /*ARGSUSED*/ |
| static void |
| ! preedit_start_cbproc(XIC xic, XPointer client_data, XPointer call_data) |
| { |
| #ifdef XIM_DEBUG |
| xim_log("xim_decide_input_style()\n"); |
| --- 5278,5284 ---- |
| |
| /*ARGSUSED*/ |
| static void |
| ! preedit_start_cbproc(XIC thexic, XPointer client_data, XPointer call_data) |
| { |
| #ifdef XIM_DEBUG |
| xim_log("xim_decide_input_style()\n"); |
| |
| *** 5312,5318 **** |
| |
| /*ARGSUSED*/ |
| static void |
| ! preedit_draw_cbproc(XIC xic, XPointer client_data, XPointer call_data) |
| { |
| XIMPreeditDrawCallbackStruct *draw_data; |
| XIMText *text; |
| --- 5312,5318 ---- |
| |
| /*ARGSUSED*/ |
| static void |
| ! preedit_draw_cbproc(XIC thexic, XPointer client_data, XPointer call_data) |
| { |
| XIMPreeditDrawCallbackStruct *draw_data; |
| XIMText *text; |
| |
| *** 5453,5459 **** |
| |
| /*ARGSUSED*/ |
| static void |
| ! preedit_caret_cbproc(XIC xic, XPointer client_data, XPointer call_data) |
| { |
| #ifdef XIM_DEBUG |
| xim_log("preedit_caret_cbproc()\n"); |
| --- 5453,5459 ---- |
| |
| /*ARGSUSED*/ |
| static void |
| ! preedit_caret_cbproc(XIC thexic, XPointer client_data, XPointer call_data) |
| { |
| #ifdef XIM_DEBUG |
| xim_log("preedit_caret_cbproc()\n"); |
| |
| *** 5462,5468 **** |
| |
| /*ARGSUSED*/ |
| static void |
| ! preedit_done_cbproc(XIC xic, XPointer client_data, XPointer call_data) |
| { |
| #ifdef XIM_DEBUG |
| xim_log("preedit_done_cbproc()\n"); |
| --- 5462,5468 ---- |
| |
| /*ARGSUSED*/ |
| static void |
| ! preedit_done_cbproc(XIC thexic, XPointer client_data, XPointer call_data) |
| { |
| #ifdef XIM_DEBUG |
| xim_log("preedit_done_cbproc()\n"); |
| |
| |
| |
| *** 4585,4645 **** |
| if (remove_trailing_zeroes) |
| { |
| int i; |
| ! char *p; |
| |
| /* Using %g or %G: remove superfluous zeroes. */ |
| if (fmt_spec == 'f') |
| ! p = tmp + str_arg_l - 1; |
| else |
| { |
| ! p = (char *)vim_strchr((char_u *)tmp, |
| fmt_spec == 'e' ? 'e' : 'E'); |
| ! if (p != NULL) |
| { |
| /* Remove superfluous '+' and leading |
| * zeroes from the exponent. */ |
| ! if (p[1] == '+') |
| { |
| /* Change "1.0e+07" to "1.0e07" */ |
| ! STRMOVE(p + 1, p + 2); |
| --str_arg_l; |
| } |
| ! i = (p[1] == '-') ? 2 : 1; |
| ! while (p[i] == '0') |
| { |
| /* Change "1.0e07" to "1.0e7" */ |
| ! STRMOVE(p + i, p + i + 1); |
| --str_arg_l; |
| } |
| ! --p; |
| } |
| } |
| |
| ! if (p != NULL && !precision_specified) |
| /* Remove trailing zeroes, but keep the one |
| * just after a dot. */ |
| ! while (p > tmp + 2 && *p == '0' && p[-1] != '.') |
| { |
| ! STRMOVE(p, p + 1); |
| ! --p; |
| --str_arg_l; |
| } |
| } |
| else |
| { |
| ! char *p; |
| |
| /* Be consistent: some printf("%e") use 1.0e+12 |
| * and some 1.0e+012. Remove one zero in the last |
| * case. */ |
| ! p = (char *)vim_strchr((char_u *)tmp, |
| fmt_spec == 'e' ? 'e' : 'E'); |
| ! if (p != NULL && (p[1] == '+' || p[1] == '-') |
| ! && p[2] == '0' |
| ! && vim_isdigit(p[3]) |
| ! && vim_isdigit(p[4])) |
| { |
| ! STRMOVE(p + 2, p + 3); |
| --str_arg_l; |
| } |
| } |
| --- 4585,4646 ---- |
| if (remove_trailing_zeroes) |
| { |
| int i; |
| ! char *tp; |
| |
| /* Using %g or %G: remove superfluous zeroes. */ |
| if (fmt_spec == 'f') |
| ! tp = tmp + str_arg_l - 1; |
| else |
| { |
| ! tp = (char *)vim_strchr((char_u *)tmp, |
| fmt_spec == 'e' ? 'e' : 'E'); |
| ! if (tp != NULL) |
| { |
| /* Remove superfluous '+' and leading |
| * zeroes from the exponent. */ |
| ! if (tp[1] == '+') |
| { |
| /* Change "1.0e+07" to "1.0e07" */ |
| ! STRMOVE(tp + 1, tp + 2); |
| --str_arg_l; |
| } |
| ! i = (tp[1] == '-') ? 2 : 1; |
| ! while (tp[i] == '0') |
| { |
| /* Change "1.0e07" to "1.0e7" */ |
| ! STRMOVE(tp + i, tp + i + 1); |
| --str_arg_l; |
| } |
| ! --tp; |
| } |
| } |
| |
| ! if (tp != NULL && !precision_specified) |
| /* Remove trailing zeroes, but keep the one |
| * just after a dot. */ |
| ! while (tp > tmp + 2 && *tp == '0' |
| ! && tp[-1] != '.') |
| { |
| ! STRMOVE(tp, tp + 1); |
| ! --tp; |
| --str_arg_l; |
| } |
| } |
| else |
| { |
| ! char *tp; |
| |
| /* Be consistent: some printf("%e") use 1.0e+12 |
| * and some 1.0e+012. Remove one zero in the last |
| * case. */ |
| ! tp = (char *)vim_strchr((char_u *)tmp, |
| fmt_spec == 'e' ? 'e' : 'E'); |
| ! if (tp != NULL && (tp[1] == '+' || tp[1] == '-') |
| ! && tp[2] == '0' |
| ! && vim_isdigit(tp[3]) |
| ! && vim_isdigit(tp[4])) |
| { |
| ! STRMOVE(tp + 2, tp + 3); |
| --str_arg_l; |
| } |
| } |
| |
| |
| |
| *** 1043,1049 **** |
| nbdebug(("EVT: %s", buf)); |
| /* nb_send(buf, "netbeans_end"); avoid "write failed" messages */ |
| if (sd >= 0) |
| ! sock_write(sd, buf, (int)STRLEN(buf)); /* ignore errors */ |
| } |
| } |
| |
| --- 1043,1049 ---- |
| nbdebug(("EVT: %s", buf)); |
| /* nb_send(buf, "netbeans_end"); avoid "write failed" messages */ |
| if (sd >= 0) |
| ! ignored = sock_write(sd, buf, (int)STRLEN(buf)); |
| } |
| } |
| |
| |
| *** 2277,2285 **** |
| int serNum; |
| int localTypeNum; |
| int typeNum; |
| - # ifdef NBDEBUG |
| - int len; |
| - # endif |
| pos_T *pos; |
| |
| if (buf == NULL || buf->bufp == NULL) |
| --- 2277,2282 ---- |
| |
| *** 2303,2315 **** |
| pos = get_off_or_lnum(buf->bufp, &args); |
| |
| cp = (char *)args; |
| ! # ifdef NBDEBUG |
| ! len = |
| ! # endif |
| ! strtol(cp, &cp, 10); |
| args = (char_u *)cp; |
| # ifdef NBDEBUG |
| ! if (len != -1) |
| { |
| nbdebug((" partial line annotation -- Not Yet Implemented!\n")); |
| } |
| --- 2300,2309 ---- |
| pos = get_off_or_lnum(buf->bufp, &args); |
| |
| cp = (char *)args; |
| ! ignored = (int)strtol(cp, &cp, 10); |
| args = (char_u *)cp; |
| # ifdef NBDEBUG |
| ! if (ignored != -1) |
| { |
| nbdebug((" partial line annotation -- Not Yet Implemented!\n")); |
| } |
| |
| |
| |
| *** 8232,8244 **** |
| { |
| if (number == 0 && string != NULL) |
| { |
| ! int index; |
| |
| /* Either we are given a string or we are setting option |
| * to zero. */ |
| ! for (index = 0; string[index] == '0'; ++index) |
| ; |
| ! if (string[index] != NUL || index == 0) |
| { |
| /* There's another character after zeros or the string |
| * is empty. In both cases, we are trying to set a |
| --- 8232,8244 ---- |
| { |
| if (number == 0 && string != NULL) |
| { |
| ! int idx; |
| |
| /* Either we are given a string or we are setting option |
| * to zero. */ |
| ! for (idx = 0; string[idx] == '0'; ++idx) |
| ; |
| ! if (string[idx] != NUL || idx == 0) |
| { |
| /* There's another character after zeros or the string |
| * is empty. In both cases, we are trying to set a |
| |
| |
| |
| *** 315,326 **** |
| {-1, "Unknown!", FALSE} |
| }; |
| |
| void |
| mch_write(s, len) |
| char_u *s; |
| int len; |
| { |
| ! write(1, (char *)s, len); |
| if (p_wd) /* Unix is too fast, slow down a bit more */ |
| RealWaitForChar(read_cmd_fd, p_wd, NULL); |
| } |
| --- 315,329 ---- |
| {-1, "Unknown!", FALSE} |
| }; |
| |
| + /* |
| + * Write s[len] to the screen. |
| + */ |
| void |
| mch_write(s, len) |
| char_u *s; |
| int len; |
| { |
| ! ignored = (int)write(1, (char *)s, len); |
| if (p_wd) /* Unix is too fast, slow down a bit more */ |
| RealWaitForChar(read_cmd_fd, p_wd, NULL); |
| } |
| |
| *** 3927,3935 **** |
| */ |
| if (fd >= 0) |
| { |
| ! dup(fd); /* To replace stdin (file descriptor 0) */ |
| ! dup(fd); /* To replace stdout (file descriptor 1) */ |
| ! dup(fd); /* To replace stderr (file descriptor 2) */ |
| |
| /* Don't need this now that we've duplicated it */ |
| close(fd); |
| --- 3930,3938 ---- |
| */ |
| if (fd >= 0) |
| { |
| ! ignored = dup(fd); /* To replace stdin (fd 0) */ |
| ! ignored = dup(fd); /* To replace stdout (fd 1) */ |
| ! ignored = dup(fd); /* To replace stderr (fd 2) */ |
| |
| /* Don't need this now that we've duplicated it */ |
| close(fd); |
| |
| *** 3997,4009 **** |
| |
| /* set up stdin/stdout/stderr for the child */ |
| close(0); |
| ! dup(pty_slave_fd); |
| close(1); |
| ! dup(pty_slave_fd); |
| if (gui.in_use) |
| { |
| close(2); |
| ! dup(pty_slave_fd); |
| } |
| |
| close(pty_slave_fd); /* has been dupped, close it now */ |
| --- 4000,4012 ---- |
| |
| /* set up stdin/stdout/stderr for the child */ |
| close(0); |
| ! ignored = dup(pty_slave_fd); |
| close(1); |
| ! ignored = dup(pty_slave_fd); |
| if (gui.in_use) |
| { |
| close(2); |
| ! ignored = dup(pty_slave_fd); |
| } |
| |
| close(pty_slave_fd); /* has been dupped, close it now */ |
| |
| *** 4014,4026 **** |
| /* set up stdin for the child */ |
| close(fd_toshell[1]); |
| close(0); |
| ! dup(fd_toshell[0]); |
| close(fd_toshell[0]); |
| |
| /* set up stdout for the child */ |
| close(fd_fromshell[0]); |
| close(1); |
| ! dup(fd_fromshell[1]); |
| close(fd_fromshell[1]); |
| |
| # ifdef FEAT_GUI |
| --- 4017,4029 ---- |
| /* set up stdin for the child */ |
| close(fd_toshell[1]); |
| close(0); |
| ! ignored = dup(fd_toshell[0]); |
| close(fd_toshell[0]); |
| |
| /* set up stdout for the child */ |
| close(fd_fromshell[0]); |
| close(1); |
| ! ignored = dup(fd_fromshell[1]); |
| close(fd_fromshell[1]); |
| |
| # ifdef FEAT_GUI |
| |
| *** 4028,4034 **** |
| { |
| /* set up stderr for the child */ |
| close(2); |
| ! dup(1); |
| } |
| # endif |
| } |
| --- 4031,4037 ---- |
| { |
| /* set up stderr for the child */ |
| close(2); |
| ! ignored = dup(1); |
| } |
| # endif |
| } |
| |
| *** 4159,4165 **** |
| && (lnum != |
| curbuf->b_ml.ml_line_count |
| || curbuf->b_p_eol))) |
| ! write(toshell_fd, "\n", (size_t)1); |
| ++lnum; |
| if (lnum > curbuf->b_op_end.lnum) |
| { |
| --- 4162,4169 ---- |
| && (lnum != |
| curbuf->b_ml.ml_line_count |
| || curbuf->b_p_eol))) |
| ! ignored = write(toshell_fd, "\n", |
| ! (size_t)1); |
| ++lnum; |
| if (lnum > curbuf->b_op_end.lnum) |
| { |
| |
| |
| |
| *** 4950,4956 **** |
| static void put_sugtime __ARGS((spellinfo_T *spin, FILE *fd)); |
| static int write_vim_spell __ARGS((spellinfo_T *spin, char_u *fname)); |
| static void clear_node __ARGS((wordnode_T *node)); |
| ! static int put_node __ARGS((FILE *fd, wordnode_T *node, int index, int regionmask, int prefixtree)); |
| static void spell_make_sugfile __ARGS((spellinfo_T *spin, char_u *wfname)); |
| static int sug_filltree __ARGS((spellinfo_T *spin, slang_T *slang)); |
| static int sug_maketable __ARGS((spellinfo_T *spin)); |
| --- 4950,4956 ---- |
| static void put_sugtime __ARGS((spellinfo_T *spin, FILE *fd)); |
| static int write_vim_spell __ARGS((spellinfo_T *spin, char_u *fname)); |
| static void clear_node __ARGS((wordnode_T *node)); |
| ! static int put_node __ARGS((FILE *fd, wordnode_T *node, int idx, int regionmask, int prefixtree)); |
| static void spell_make_sugfile __ARGS((spellinfo_T *spin, char_u *wfname)); |
| static int sug_filltree __ARGS((spellinfo_T *spin, slang_T *slang)); |
| static int sug_maketable __ARGS((spellinfo_T *spin)); |
| |
| |
| |
| *** 1820,1826 **** |
| #ifdef HAVE_DUP |
| /* Use stderr for stdin, also works for shell commands. */ |
| close(0); |
| ! dup(2); |
| #else |
| read_cmd_fd = 2; /* read from stderr instead of stdin */ |
| #endif |
| --- 1820,1826 ---- |
| #ifdef HAVE_DUP |
| /* Use stderr for stdin, also works for shell commands. */ |
| close(0); |
| ! ignored = dup(2); |
| #else |
| read_cmd_fd = 2; /* read from stderr instead of stdin */ |
| #endif |
| |
| |
| |
| *** 4029,4042 **** |
| if (mch_dirname(cwd, MAXPATHL) == OK) |
| globaldir = vim_strsave(cwd); |
| } |
| ! mch_chdir((char *)curwin->w_localdir); |
| ! shorten_fnames(TRUE); |
| } |
| else if (globaldir != NULL) |
| { |
| /* Window doesn't have a local directory and we are not in the global |
| * directory: Change to the global directory. */ |
| ! mch_chdir((char *)globaldir); |
| vim_free(globaldir); |
| globaldir = NULL; |
| shorten_fnames(TRUE); |
| --- 4029,4042 ---- |
| if (mch_dirname(cwd, MAXPATHL) == OK) |
| globaldir = vim_strsave(cwd); |
| } |
| ! if (mch_chdir((char *)curwin->w_localdir) == 0) |
| ! shorten_fnames(TRUE); |
| } |
| else if (globaldir != NULL) |
| { |
| /* Window doesn't have a local directory and we are not in the global |
| * directory: Change to the global directory. */ |
| ! ignored = mch_chdir((char *)globaldir); |
| vim_free(globaldir); |
| globaldir = NULL; |
| shorten_fnames(TRUE); |
| |
| |
| |
| *** 678,679 **** |
| --- 678,681 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 55, |
| /**/ |
| |
| -- |
| PRINCE: He's come to rescue me, father. |
| LAUNCELOT: (embarrassed) Well, let's not jump to conclusions ... |
| "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ download, build and distribute -- http://www.A-A-P.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |