diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-04-22 22:33:57 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-04-22 22:33:57 +0000 |
commit | eb3593b38b7b6b658e93ad05d6caf76d58cc0c35 (patch) | |
tree | 39210f19a86e4db2914523b0fde4a5ff9d345c16 /src | |
parent | 57657d85c6c3d812e99b5e5d5161c07c66ac7dc7 (diff) | |
download | vim-git-eb3593b38b7b6b658e93ad05d6caf76d58cc0c35.tar.gz |
updated for version 7.0e06v7.0e06
Diffstat (limited to 'src')
-rw-r--r-- | src/Make_mvc.mak | 44 | ||||
-rw-r--r-- | src/diff.c | 3 | ||||
-rw-r--r-- | src/edit.c | 55 | ||||
-rw-r--r-- | src/eval.c | 29 | ||||
-rw-r--r-- | src/ex_cmds.c | 1 | ||||
-rw-r--r-- | src/ex_docmd.c | 3 | ||||
-rw-r--r-- | src/ex_eval.c | 6 | ||||
-rw-r--r-- | src/fold.c | 3 | ||||
-rw-r--r-- | src/getchar.c | 19 | ||||
-rw-r--r-- | src/gui_gtk.c | 4 | ||||
-rw-r--r-- | src/gui_gtk_x11.c | 6 | ||||
-rw-r--r-- | src/gui_w32.c | 131 | ||||
-rw-r--r-- | src/hardcopy.c | 10 | ||||
-rw-r--r-- | src/mbyte.c | 2 | ||||
-rw-r--r-- | src/menu.c | 3 | ||||
-rw-r--r-- | src/message.c | 32 | ||||
-rw-r--r-- | src/misc1.c | 10 | ||||
-rw-r--r-- | src/misc2.c | 28 | ||||
-rw-r--r-- | src/netbeans.c | 38 | ||||
-rw-r--r-- | src/normal.c | 6 | ||||
-rw-r--r-- | src/ops.c | 11 | ||||
-rw-r--r-- | src/option.c | 26 | ||||
-rw-r--r-- | src/os_mswin.c | 20 | ||||
-rw-r--r-- | src/os_unix.c | 2 | ||||
-rw-r--r-- | src/os_win32.c | 2 | ||||
-rw-r--r-- | src/proto/message.pro | 137 | ||||
-rw-r--r-- | src/regexp.c | 6 | ||||
-rw-r--r-- | src/spell.c | 8 | ||||
-rw-r--r-- | src/syntax.c | 3 | ||||
-rw-r--r-- | src/testdir/test61.in | 7 | ||||
-rw-r--r-- | src/testdir/test61.ok | 2 | ||||
-rw-r--r-- | src/version.h | 6 | ||||
-rw-r--r-- | src/vim.h | 10 | ||||
-rw-r--r-- | src/window.c | 2 |
34 files changed, 448 insertions, 227 deletions
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index f9d211d34..a78f756ec 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -1,9 +1,8 @@ -# Makefile for Vim on Win32 (Windows NT and Windows 95), using the -# Microsoft Visual C++ 2.x and MSVC 4.x compilers (or newer). -# It builds on Windows 95 and all four NT platforms: i386, Alpha, MIPS, and -# PowerPC. The NT/i386 binary and the Windows 95 binary are identical. +# Makefile for Vim on Win32 (Windows NT/2000/XP/2003 and Windows 95/98/Me) +# and Win64, using the Microsoft Visual C++ compilers. Known to work with +# VC5, VC6 (VS98), VC7.0 (VS2002), VC7.1 (VS2003), and VC8 (VS2005). # -# To build using Borland C++, use Make_bc3.mak or Make_bc5.mak. +# To build using other Windows compilers, see INSTALLpc.txt # # This makefile can build the console, GUI, OLE-enable, Perl-enabled and # Python-enabled versions of vim for Win32 platforms. @@ -172,8 +171,11 @@ OBJDIR = $(OBJDIR)d !ifdef PROCESSOR_ARCHITECTURE # We're on Windows NT or using VC 6+ -! ifndef CPU +! ifdef CPU +ASSEMBLY_ARCHITECTURE=$(CPU) +! else CPU = $(PROCESSOR_ARCHITECTURE) +ASSEMBLY_ARCHITECTURE = $(PROCESSOR_ARCHITECTURE) ! if ("$(CPU)" == "x86") || ("$(CPU)" == "X86") CPU = i386 ! endif @@ -183,6 +185,9 @@ CPU = i386 CPU = i386 !endif # !PROCESSOR_ARCHITECTURE +!if ("$(CPU)" == "AMD64") || ("$(CPU)" == "IA64") +DEFINES=$(DEFINES) /Wp64 +!endif # Build a retail version by default @@ -752,6 +757,7 @@ clean: - if exist $(VIM).pdb del $(VIM).pdb - if exist $(VIM).map del $(VIM).map - if exist $(VIM).ncb del $(VIM).ncb + - if exist gvim.exe.mnf del gvim.exe.mnf - if exist vimrun.exe del vimrun.exe - if exist install.exe del install.exe - if exist uninstal.exe del uninstal.exe @@ -933,7 +939,7 @@ $(OUTDIR)/window.obj: $(OUTDIR) window.c $(INCL) $(OUTDIR)/xpm_w32.obj: $(OUTDIR) xpm_w32.c $(CC) $(CFLAGS) $(XPM_INC) xpm_w32.c -$(OUTDIR)/vim.res: $(OUTDIR) vim.rc version.h tools.bmp tearoff.bmp \ +$(OUTDIR)/vim.res: $(OUTDIR) gvim.exe.mnf vim.rc version.h tools.bmp tearoff.bmp \ vim.ico vim_error.ico vim_alert.ico vim_info.ico vim_quest.ico $(RC) /l 0x409 /Fo$(OUTDIR)/vim.res $(RCFLAGS) vim.rc @@ -963,6 +969,30 @@ $(PATHDEF_SRC): auto @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> $(PATHDEF_SRC) @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> $(PATHDEF_SRC) +gvim.exe.mnf: auto + @echo ^<?xml version="1.0" encoding="UTF-8" standalone="yes"?^> >$@ + @echo ^<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"^> >>$@ + @echo ^<assemblyIdentity >>$@ + @echo processorArchitecture="$(ASSEMBLY_ARCHITECTURE)" >>$@ + @echo version="7.0.0.0" >>$@ + @echo type="win32" >>$@ + @echo name="Vim" >>$@ + @echo /^> >>$@ + @echo ^<description^>Vi Improved - A Text Editor^</description^> >>$@ + @echo ^<dependency^> >>$@ + @echo ^<dependentAssembly^> >>$@ + @echo ^<assemblyIdentity >>$@ + @echo type="win32" >>$@ + @echo name="Microsoft.Windows.Common-Controls" >>$@ + @echo version="6.0.0.0" >>$@ + @echo publicKeyToken="6595b64144ccf1df" >>$@ + @echo language="*" >>$@ + @echo processorArchitecture="$(ASSEMBLY_ARCHITECTURE)" >>$@ + @echo /^> >>$@ + @echo ^</dependentAssembly^> >>$@ + @echo ^</dependency^> >>$@ + @echo ^</assembly^> >>$@ + auto: if not exist auto/nul mkdir auto diff --git a/src/diff.c b/src/diff.c index 5f8a84a17..22cf5af0d 100644 --- a/src/diff.c +++ b/src/diff.c @@ -1330,7 +1330,7 @@ diff_read(idx_orig, idx_new, fname) /* Allocate a new diffblock. */ dp = diff_alloc_new(curtab, dprev, dp); if (dp == NULL) - return; + goto done; dp->df_lnum[idx_orig] = lnum_orig; dp->df_count[idx_orig] = count_orig; @@ -1357,6 +1357,7 @@ diff_read(idx_orig, idx_new, fname) notset = TRUE; } +done: fclose(fd); } diff --git a/src/edit.c b/src/edit.c index ed416f30a..2c9711960 100644 --- a/src/edit.c +++ b/src/edit.c @@ -178,7 +178,9 @@ static int spell_bad_len = 0; /* length of located bad word */ #endif static void stop_insert __ARGS((pos_T *end_insert_pos, int esc)); static int echeck_abbr __ARGS((int)); +#if 0 static void replace_push_off __ARGS((int c)); +#endif static int replace_pop __ARGS((void)); static void replace_join __ARGS((int off)); static void replace_pop_ins __ARGS((void)); @@ -5823,7 +5825,7 @@ redo_literal(c) */ static void start_arrow(end_insert_pos) - pos_T *end_insert_pos; + pos_T *end_insert_pos; /* can be NULL */ { if (!arrow_used) /* something has been inserted */ { @@ -5912,11 +5914,13 @@ stop_arrow() } /* - * do a few things to stop inserting + * Do a few things to stop inserting. + * "end_insert_pos" is where insert ended. It is NULL when we already jumped + * to another window/buffer. */ static void stop_insert(end_insert_pos, esc) - pos_T *end_insert_pos; /* where insert ended */ + pos_T *end_insert_pos; int esc; /* called by ins_esc() */ { int cc; @@ -5941,7 +5945,7 @@ stop_insert(end_insert_pos, esc) else vim_free(ptr); - if (!arrow_used) + if (!arrow_used && end_insert_pos != NULL) { /* Auto-format now. It may seem strange to do this when stopping an * insertion (or moving the cursor), but it's required when appending @@ -5987,7 +5991,7 @@ stop_insert(end_insert_pos, esc) * of the line, and put the cursor back. * Do this when ESC was used or moving the cursor up/down. */ if (did_ai && (esc || (vim_strchr(p_cpo, CPO_INDENT) == NULL - && curwin->w_cursor.lnum != end_insert_pos->lnum))) + && curwin->w_cursor.lnum != end_insert_pos->lnum))) { pos_T tpos = curwin->w_cursor; @@ -6030,9 +6034,13 @@ stop_insert(end_insert_pos, esc) can_si_back = FALSE; #endif - /* set '[ and '] to the inserted text */ - curbuf->b_op_start = Insstart; - curbuf->b_op_end = *end_insert_pos; + /* Set '[ and '] to the inserted text. When end_insert_pos is NULL we are + * now in a different buffer. */ + if (end_insert_pos != NULL) + { + curbuf->b_op_start = Insstart; + curbuf->b_op_end = *end_insert_pos; + } } /* @@ -6563,6 +6571,7 @@ replace_push(c) ++replace_stack_nr; } +#if 0 /* * call replace_push(c) with replace_offset set to the first NUL. */ @@ -6580,6 +6589,7 @@ replace_push_off(c) replace_push(c); replace_offset = 0; } +#endif /* * Pop one item from the replace stack. @@ -8023,7 +8033,9 @@ ins_bs(c, mode, inserted_space_p) int ts; colnr_T vcol; colnr_T want_vcol; +#if 0 int extra = 0; +#endif *inserted_space_p = FALSE; if (p_sta && in_indent) @@ -8082,15 +8094,19 @@ ins_bs(c, mode, inserted_space_p) #endif { ins_str((char_u *)" "); - if ((State & REPLACE_FLAG) && extra <= 1) + if ((State & REPLACE_FLAG) /* && extra <= 1 */) { +#if 0 if (extra) replace_push_off(NUL); else +#endif replace_push(NUL); } +#if 0 if (extra == 2) extra = 1; +#endif } getvcol(curwin, &curwin->w_cursor, &vcol, NULL, NULL); } @@ -8205,6 +8221,7 @@ ins_mouse(c) int c; { pos_T tpos; + win_T *old_curwin = curwin; # ifdef FEAT_GUI /* When GUI is active, also move/paste when 'mouse' is empty */ @@ -8217,7 +8234,25 @@ ins_mouse(c) tpos = curwin->w_cursor; if (do_mouse(NULL, c, BACKWARD, 1L, 0)) { - start_arrow(&tpos); +#ifdef FEAT_WINDOWS + win_T *new_curwin = curwin; + + if (curwin != old_curwin && win_valid(old_curwin)) + { + /* Mouse took us to another window. We need to go back to the + * previous one to stop insert there properly. */ + curwin = old_curwin; + curbuf = curwin->w_buffer; + } +#endif + start_arrow(curwin == old_curwin ? &tpos : NULL); +#ifdef FEAT_WINDOWS + if (curwin != new_curwin && win_valid(new_curwin)) + { + curwin = new_curwin; + curbuf = curwin->w_buffer; + } +#endif # ifdef FEAT_CINDENT can_cindent = TRUE; # endif diff --git a/src/eval.c b/src/eval.c index 1e75a31a3..14460a0a9 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1413,7 +1413,7 @@ call_vim_function(func, argc, argv, safe, rettv) void *save_funccalp = NULL; int ret; - argvars = (typval_T *)alloc((unsigned)(argc * sizeof(typval_T))); + argvars = (typval_T *)alloc((unsigned)((argc + 1) * sizeof(typval_T))); if (argvars == NULL) return FAIL; @@ -7318,7 +7318,7 @@ get_func_tv(name, len, rettv, arg, firstline, lastline, doesrange, { char_u *argp; int ret = OK; - typval_T argvars[MAX_FUNC_ARGS]; /* vars for arguments */ + typval_T argvars[MAX_FUNC_ARGS + 1]; /* vars for arguments */ int argcount = 0; /* number of arguments found */ /* @@ -7375,7 +7375,8 @@ call_func(name, len, rettv, argcount, argvars, firstline, lastline, int len; /* length of "name" */ typval_T *rettv; /* return value goes here */ int argcount; /* number of "argvars" */ - typval_T *argvars; /* vars for arguments */ + typval_T *argvars; /* vars for arguments, must have "argcount" + PLUS ONE elements! */ linenr_T firstline; /* first line of range */ linenr_T lastline; /* last line of range */ int *doesrange; /* return: function handled range */ @@ -8064,7 +8065,7 @@ f_call(argvars, rettv) typval_T *rettv; { char_u *func; - typval_T argv[MAX_FUNC_ARGS]; + typval_T argv[MAX_FUNC_ARGS + 1]; int argc = 0; listitem_T *item; int dummy; @@ -8943,7 +8944,7 @@ f_extend(argvars, rettv) break; if (i == 3) { - EMSGN(_(e_invarg2), action); + EMSG2(_(e_invarg2), action); return; } } @@ -12997,7 +12998,7 @@ remote_common(argvars, rettv, expr) char_u str[30]; char_u *idvar; - sprintf((char *)str, "0x%x", (unsigned int)w); + sprintf((char *)str, PRINTF_HEX_LONG_U, (long_u)w); v.di_tv.v_type = VAR_STRING; v.di_tv.vval.v_string = vim_strsave(str); idvar = get_tv_string_chk(&argvars[2]); @@ -13064,7 +13065,7 @@ f_remote_peek(argvars, rettv) dictitem_T v; char_u *s = NULL; # ifdef WIN32 - int n = 0; + long_u n = 0; # endif char_u *serverid; @@ -13080,7 +13081,7 @@ f_remote_peek(argvars, rettv) return; /* type error; errmsg already given */ } # ifdef WIN32 - sscanf(serverid, "%x", &n); + sscanf(serverid, SCANF_HEX_LONG_U, &n); if (n == 0) rettv->vval.v_number = -1; else @@ -13128,9 +13129,9 @@ f_remote_read(argvars, rettv) { # ifdef WIN32 /* The server's HWND is encoded in the 'id' parameter */ - int n = 0; + long_u n = 0; - sscanf(serverid, "%x", &n); + sscanf(serverid, SCANF_HEX_LONG_U, &n); if (n != 0) r = serverGetReply((HWND)n, FALSE, TRUE, TRUE); if (r == NULL) @@ -14585,7 +14586,7 @@ item_compare2(s1, s2) { int res; typval_T rettv; - typval_T argv[2]; + typval_T argv[3]; int dummy; /* shortcut after failure in previous call; compare all items equal */ @@ -15133,11 +15134,12 @@ f_strridx(argvars, rettv) needle = get_tv_string_chk(&argvars[1]); haystack = get_tv_string_buf_chk(&argvars[0], buf); - haystack_len = (int)STRLEN(haystack); rettv->vval.v_number = -1; if (needle == NULL || haystack == NULL) return; /* type error; errmsg already given */ + + haystack_len = (int)STRLEN(haystack); if (argvars[2].v_type != VAR_UNKNOWN) { /* Third argument: upper limit for index */ @@ -15398,7 +15400,10 @@ f_system(argvars, rettv) } p = get_tv_string_buf_chk(&argvars[1], buf); if (p == NULL) + { + fclose(fd); goto done; /* type error; errmsg already given */ + } if (fwrite(p, STRLEN(p), 1, fd) != 1) err = TRUE; if (fclose(fd) != 0) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index aafe31cf0..b5920c8d0 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -1778,6 +1778,7 @@ write_viminfo(file, forceit) tt = msg_didany; EMSG2(_("E137: Viminfo file is not writable: %s"), fname); msg_didany = tt; + fclose(fp_in); goto end; } #endif diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 4943bfcfb..3e4c963c4 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -9438,7 +9438,8 @@ eval_vars(src, usedlen, lnump, errormsg, srcstart) break; #if defined(FEAT_CLIENTSERVER) case SPEC_CLIENT: /* Source of last submitted input */ - sprintf((char *)strbuf, "0x%x", (unsigned int)clientWindow); + sprintf((char *)strbuf, PRINTF_HEX_LONG_U, + (long_u)clientWindow); result = strbuf; break; #endif diff --git a/src/ex_eval.c b/src/ex_eval.c index c89cb2bd0..8714958f0 100644 --- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -1136,7 +1136,7 @@ ex_continue(eap) * next). Therefor, inactivate all conditionals except the ":while" * itself (if reached). */ idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, FALSE); - if ((cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) + if (idx >= 0 && (cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) { rewind_conditionals(cstack, idx, CSF_TRY, &cstack->cs_trylevel); @@ -1175,7 +1175,7 @@ ex_break(eap) * executed next) is found. In the latter case, make the ":break" * pending for execution at the ":endtry". */ idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, TRUE); - if (!(cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) + if (idx >= 0 && !(cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) { cstack->cs_pending[idx] = CSTP_BREAK; report_make_pending(CSTP_BREAK, NULL); @@ -1861,7 +1861,7 @@ ex_endtry(eap) * after errors except when this ":endtry" is not within a ":try". * Restore "emsg_silent" if it has been reset by this try conditional. */ - cleanup_conditionals(cstack, CSF_TRY | CSF_SILENT, TRUE); + (void)cleanup_conditionals(cstack, CSF_TRY | CSF_SILENT, TRUE); --cstack->cs_idx; --cstack->cs_trylevel; diff --git a/src/fold.c b/src/fold.c index 8cd51a9c2..bb7b8b7cc 100644 --- a/src/fold.c +++ b/src/fold.c @@ -2594,8 +2594,9 @@ foldUpdateIEMSRecurse(gap, level, startlnum, flp, getlevel, bot, topflags) /* * The fold includes the line "flp->lnum" and "flp->lnum_save". + * Check "fp" for safety. */ - if (lvl > level) + if (lvl > level && fp != NULL) { /* * There is a nested fold, handle it recursively. diff --git a/src/getchar.c b/src/getchar.c index 88381b176..782bdbee0 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -4053,14 +4053,19 @@ ExpandMappings(regmatch, num_file, file) } } /* for (round) */ - /* Sort the matches */ - sort_strings(*file, count); - - /* Remove multiple entries */ + if (count > 1) { - char_u **ptr1 = *file; - char_u **ptr2 = ptr1 + 1; - char_u **ptr3 = ptr1 + count; + char_u **ptr1; + char_u **ptr2; + char_u **ptr3; + + /* Sort the matches */ + sort_strings(*file, count); + + /* Remove multiple entries */ + ptr1 = *file; + ptr2 = ptr1 + 1; + ptr3 = ptr1 + count; while (ptr2 < ptr3) { diff --git a/src/gui_gtk.c b/src/gui_gtk.c index d9477d5b6..6c8694859 100644 --- a/src/gui_gtk.c +++ b/src/gui_gtk.c @@ -787,12 +787,12 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) # endif /* FEAT_TOOLBAR */ { /* No parent, must be a non-menubar menu */ - if (parent->submenu_id == NULL) + if (parent == NULL || parent->submenu_id == NULL) return; /* Make place for the possible tearoff handle item. Not in the popup * menu, it doesn't have a tearoff item. */ - if (parent != NULL && !menu_is_popup(parent->name)) + if (!menu_is_popup(parent->name)) ++idx; if (menu_is_separator(menu->name)) diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 79557a834..3bec1f59f 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -2024,6 +2024,8 @@ drag_handle_uri_list(GdkDragContext *context, gui_handle_drop(x, y, modifiers, fnames, nfiles); } + else + vim_free(fnames); } static void @@ -4707,7 +4709,7 @@ gui_mch_font_dialog(char_u *oldval) * that, because in 'guifont' it separates names. */ p = vim_strsave_escaped((char_u *)name, (char_u *)","); g_free(name); - if (input_conv.vc_type != CONV_NONE) + if (p != NULL && input_conv.vc_type != CONV_NONE) { fontname = string_convert(&input_conv, p, NULL); vim_free(p); @@ -6870,7 +6872,7 @@ mch_set_mouse_shape(int shape) else id &= ~1; /* they are always even (why?) */ } - else + else if (shape < sizeof(mshape_ids) / sizeof(int)) id = mshape_ids[shape]; # ifdef HAVE_GTK_MULTIHEAD c = gdk_cursor_new_for_display( diff --git a/src/gui_w32.c b/src/gui_w32.c index ac05ee9a1..a700ac0c4 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -181,13 +181,14 @@ # define ID_BEVAL_TOOLTIP 200 # define BEVAL_TEXT_LEN MAXPATHL -static void make_tooltip __ARGS((BalloonEval *beval, char *text, POINT pt)); -static void delete_tooltip __ARGS((BalloonEval *beval)); -static VOID CALLBACK BevalTimerProc __ARGS((HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)); - #ifndef UINT_PTR # define UINT_PTR UINT #endif + +static void make_tooltip __ARGS((BalloonEval *beval, char *text, POINT pt)); +static void delete_tooltip __ARGS((BalloonEval *beval)); +static VOID CALLBACK BevalTimerProc __ARGS((HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)); + static BalloonEval *cur_beval = NULL; static UINT_PTR BevalTimerId = 0; static DWORD LastActivity = 0; @@ -811,9 +812,102 @@ _WndProc( case WM_NOTIFY: switch (((LPNMHDR) lParam)->code) { -# ifdef FEAT_TOOLBAR +# ifdef FEAT_MBYTE + case TTN_GETDISPINFOW: +# endif case TTN_NEEDTEXT: +# ifdef FEAT_GUI_TABLINE + if (gui_mch_showing_tabline() + && ((LPNMHDR)lParam)->hwndFrom == + TabCtrl_GetToolTips(s_tabhwnd)) { + LPNMTTDISPINFO lpdi; + POINT pt; + static char *tt_text = NULL; + static int tt_text_len = 0; + + /* + * Mouse is over the GUI tabline. Display the tooltip + * for the tab under the cursor + */ + lpdi = (LPNMTTDISPINFO)lParam; + lpdi->hinst = NULL; + lpdi->szText[0] = '\0'; + + /* + * Get the cursor position within the tab control + */ + GetCursorPos(&pt); + if (ScreenToClient(s_tabhwnd, &pt) != 0) + { + TCHITTESTINFO htinfo; + int idx; + + /* + * Get the tab under the cursor + */ + htinfo.pt.x = pt.x; + htinfo.pt.y = pt.y; + idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); + if (idx != -1) + { + tabpage_T *tp; + + tp = find_tabpage(idx + 1); + if (tp != NULL) + { +# ifdef FEAT_MBYTE + WCHAR *wstr = NULL; +# endif + get_tabline_label(tp, TRUE); +# ifdef FEAT_MBYTE + if (enc_codepage >= 0 + && (int)GetACP() != enc_codepage) + { + wstr = enc_to_ucs2(NameBuff, NULL); + if (wstr != NULL) + { + int wlen; + + wlen = (wcslen(wstr) + 1) + * sizeof(WCHAR); + if (tt_text_len < wlen) + { + tt_text = vim_realloc(tt_text, + wlen); + if (tt_text != NULL) + tt_text_len = wlen; + } + if (tt_text != NULL) + wcscpy((WCHAR *)tt_text, wstr); + lpdi->lpszText = tt_text; + vim_free(wstr); + } + } + if (wstr == NULL) +# endif + { + int len; + + len = STRLEN(NameBuff) + 1; + if (tt_text_len < len) + { + tt_text = vim_realloc(tt_text, len); + if (tt_text != NULL) + tt_text_len = len; + } + if (tt_text != NULL) + STRCPY(tt_text, NameBuff); + lpdi->lpszText = tt_text; + } + } + } + } + } + else +# endif + { +# ifdef FEAT_TOOLBAR LPTOOLTIPTEXT lpttt; UINT idButton; int idx; @@ -831,9 +925,9 @@ _WndProc( lpttt->lpszText = pMenu->strings[idx]; } } +# endif } break; -# endif # ifdef FEAT_GUI_TABLINE case TCN_SELCHANGE: if (gui_mch_showing_tabline() @@ -2341,7 +2435,7 @@ gui_mch_add_menu( { InsertMenu((parent == NULL) ? s_menuBar : parent->submenu_id, (UINT)pos, MF_POPUP | MF_STRING | MF_BYPOSITION, - (UINT)menu->submenu_id, (LPCTSTR) menu->name); + (long_u)menu->submenu_id, (LPCTSTR) menu->name); } else { @@ -2361,7 +2455,7 @@ gui_mch_add_menu( infow.cbSize = sizeof(infow); infow.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID | MIIM_SUBMENU; - infow.dwItemData = (DWORD)menu; + infow.dwItemData = (long_u)menu; infow.wID = menu->id; infow.fType = MFT_STRING; infow.dwTypeData = wn; @@ -2384,7 +2478,7 @@ gui_mch_add_menu( info.cbSize = sizeof(info); info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID | MIIM_SUBMENU; - info.dwItemData = (DWORD)menu; + info.dwItemData = (long_u)menu; info.wID = menu->id; info.fType = MFT_STRING; info.dwTypeData = (LPTSTR)menu->name; @@ -2661,7 +2755,7 @@ gui_mch_menu_grey( if (menu->children == NULL) menuID = (WORD)(menu->id); else - menuID = (WORD)((DWORD)(menu->submenu_id) | (DWORD)0x8000); + menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); menuHandle = GetDlgItem(menu->parent->tearoff_handle, menuID); if (menuHandle) EnableWindow(menuHandle, !grey); @@ -2860,7 +2954,7 @@ gui_mch_dialog( /* allocate some memory for dialog template */ /* TODO should compute this really */ pdlgtemplate = p = (PWORD)LocalAlloc(LPTR, - DLG_ALLOC_SIZE + STRLEN(message)); + DLG_ALLOC_SIZE + STRLEN(message) * 2); if (p == NULL) return -1; @@ -3281,6 +3375,7 @@ gui_mch_dialog( } #endif /* FEAT_GUI_DIALOG */ + /* * Put a simple element (basic class) onto a dialog template in memory. * return a pointer to where the next item should be added. @@ -3344,9 +3439,9 @@ add_dialog_element( lpwAlign( LPWORD lpIn) { - ULONG ul; + long_u ul; - ul = (ULONG)lpIn; + ul = (long_u)lpIn; ul += 3; ul >>= 2; ul <<= 2; @@ -3435,7 +3530,7 @@ tearoff_callback( if (GetCursorPos(&mp) && GetWindowRect(hwnd, &rect)) { (void)TrackPopupMenu( - (HMENU)(LOWORD(wParam) ^ 0x8000), + (HMENU)(long_u)(LOWORD(wParam) ^ 0x8000), TPM_LEFTALIGN | TPM_LEFTBUTTON, (int)rect.right - 8, (int)mp.y, @@ -3794,7 +3889,7 @@ gui_mch_tearoff( else { len += (int)STRLEN(TEAROFF_SUBMENU_LABEL); - menuID = (WORD)((DWORD)(menu->submenu_id) | (DWORD)0x8000); + menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); } /* Allocate menu label and fill it in */ @@ -3953,7 +4048,7 @@ get_toolbar_bitmap(vimmenu_T *menu) TBADDBITMAP tbAddBitmap; tbAddBitmap.hInst = NULL; - tbAddBitmap.nID = (UINT)hbitmap; + tbAddBitmap.nID = (long_u)hbitmap; i = (int)SendMessage(s_toolbarhwnd, TB_ADDBITMAP, (WPARAM)1, (LPARAM)&tbAddBitmap); @@ -3978,7 +4073,7 @@ initialise_tabline(void) InitCommonControls(); s_tabhwnd = CreateWindow(WC_TABCONTROL, "Vim tabline", - WS_CHILD|TCS_FOCUSNEVER, + WS_CHILD|TCS_FOCUSNEVER|TCS_TOOLTIPS, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, s_hwnd, NULL, s_hinst, NULL); @@ -4404,7 +4499,7 @@ delete_tooltip(beval) BevalTimerProc(hwnd, uMsg, idEvent, dwTime) HWND hwnd; UINT uMsg; - UINT idEvent; + UINT_PTR idEvent; DWORD dwTime; { POINT pt; diff --git a/src/hardcopy.c b/src/hardcopy.c index 62567a3db..bc5a219fc 100644 --- a/src/hardcopy.c +++ b/src/hardcopy.c @@ -2538,12 +2538,11 @@ mch_print_init(psettings, jobname, forceit) /* Build CMap name - will be same for all multi-byte fonts used */ prt_cmap[0] = NUL; - prt_custom_cmap = prt_out_mbyte && p_mbchar == NULL; - + prt_custom_cmap = (p_mbchar == NULL); if (!prt_custom_cmap) { /* Check encoding and character set are compatible */ - if ((p_mbenc->needs_charset&p_mbchar->has_charset) == 0) + if ((p_mbenc->needs_charset & p_mbchar->has_charset) == 0) { EMSG(_("E673: Incompatible multi-byte encoding and character set.")); return FALSE; @@ -2862,6 +2861,7 @@ mch_print_begin(psettings) struct prt_ps_resource_S res_encoding; char buffer[256]; char_u *p_encoding; + char_u *p; #ifdef FEAT_MBYTE struct prt_ps_resource_S res_cidfont; struct prt_ps_resource_S res_cmap; @@ -2880,7 +2880,9 @@ mch_print_begin(psettings) now = time(NULL); p_time = ctime(&now); /* Note: ctime() adds a \n so we have to remove it :-( */ - *(vim_strchr((char_u *)p_time, '\n')) = '\0'; + p = vim_strchr((char_u *)p_time, '\n'); + if (p != NULL) + *p = NUL; prt_dsc_textline("CreationDate", p_time); prt_dsc_textline("DocumentData", "Clean8Bit"); prt_dsc_textline("Orientation", "Portrait"); diff --git a/src/mbyte.c b/src/mbyte.c index 98d4e0009..2114654d5 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -3100,7 +3100,7 @@ enc_locale() else s = p + 1; } - for (i = 0; s[i] != NUL && i < sizeof(buf) - 1; ++i) + for (i = 0; s[i] != NUL && s + i < buf + sizeof(buf) - 1; ++i) { if (s[i] == '_' || s[i] == '-') buf[i] = '-'; diff --git a/src/menu.c b/src/menu.c index 55fba1fd6..8b4539563 100644 --- a/src/menu.c +++ b/src/menu.c @@ -59,7 +59,7 @@ static char_u *menutrans_lookup __ARGS((char_u *name, int len)); #endif /* The character for each menu mode */ -static char_u menu_mode_chars[] = {'n', 'v', 'o', 'i', 'c', 't'}; +static char_u menu_mode_chars[] = {'n', 'v', 's', 'o', 'i', 'c', 't'}; static char_u e_notsubmenu[] = N_("E327: Part of menu-item path is not sub-menu"); static char_u e_othermode[] = N_("E328: Menu only exists in another mode"); @@ -1293,6 +1293,7 @@ set_context_in_menu_cmd(xp, cmd, arg, forceit) name = p; menu = menu->children; } + vim_free(path_name); xp->xp_context = expand_menus ? EXPAND_MENUNAMES : EXPAND_MENUS; xp->xp_pattern = after_dot; diff --git a/src/message.c b/src/message.c index c0146c962..08810ad82 100644 --- a/src/message.c +++ b/src/message.c @@ -529,6 +529,25 @@ msg_source(attr) } /* + * Return TRUE if not giving error messages right now: + * If "emsg_off" is set: no error messages at the moment. + * If "msg" is in 'debug': do error message but without side effects. + * If "emsg_skip" is set: never do error messages. + */ + int +emsg_not_now() +{ + if ((emsg_off > 0 && vim_strchr(p_debug, 'm') == NULL + && vim_strchr(p_debug, 't') == NULL) +#ifdef FEAT_EVAL + || emsg_skip > 0 +#endif + ) + return TRUE; + return FALSE; +} + +/* * emsg() - display an error message * * Rings the bell, if appropriate, and calls message() to do the real work @@ -559,17 +578,8 @@ emsg(s) emsg_severe = FALSE; #endif - /* - * If "emsg_off" is set: no error messages at the moment. - * If "msg" is in 'debug': do error message but without side effects. - * If "emsg_skip" is set: never do error messages. - */ - if ((emsg_off > 0 && vim_strchr(p_debug, 'm') == NULL - && vim_strchr(p_debug, 't') == NULL) -#ifdef FEAT_EVAL - || emsg_skip > 0 -#endif - ) + /* Skip this if not giving error messages at the moment. */ + if (emsg_not_now()) return TRUE; if (!emsg_off || vim_strchr(p_debug, 't') != NULL) diff --git a/src/misc1.c b/src/misc1.c index 67a2fc06d..4f0ef0274 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -321,7 +321,7 @@ copy_indent(size, src) ++ind_done; } ++ind_len; - if (round == 2) + if (p != NULL) *p++ = *s; ++s; } @@ -332,7 +332,7 @@ copy_indent(size, src) { todo -= tab_pad; ++ind_len; - if (round == 2) + if (p != NULL) *p++ = TAB; } @@ -341,7 +341,7 @@ copy_indent(size, src) { todo -= (int)curbuf->b_p_ts; ++ind_len; - if (round == 2) + if (p != NULL) *p++ = TAB; } @@ -350,11 +350,11 @@ copy_indent(size, src) { --todo; ++ind_len; - if (round == 2) + if (p != NULL) *p++ = ' '; } - if (round == 1) + if (p == NULL) { /* Allocate memory for the result: the copied indent, new indent * and the rest of the line. */ diff --git a/src/misc2.c b/src/misc2.c index 4667a563d..a9f8fef0c 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -270,14 +270,15 @@ coladvance2(pos, addspaces, finetune, wcol) /* Break a tab */ int linelen = (int)STRLEN(line); int correct = wcol - col - csize + 1; /* negative!! */ - char_u *newline = alloc(linelen + csize); + char_u *newline; int t, s = 0; int v; - /* - * break a tab - */ - if (newline == NULL || -correct > csize) + if (-correct > csize) + return FAIL; + + newline = alloc(linelen + csize); + if (newline == NULL) return FAIL; for (t = 0; t < linelen; t++) @@ -5816,14 +5817,9 @@ filewritable(fname) emsg3(s, a1, a2) char_u *s, *a1, *a2; { - if ((emsg_off > 0 && vim_strchr(p_debug, 'm') == NULL - && vim_strchr(p_debug, 't') == NULL) -#ifdef FEAT_EVAL - || emsg_skip > 0 -#endif - ) + if (emsg_not_now()) return TRUE; /* no error messages at the moment */ - vim_snprintf((char *)IObuff, IOSIZE, (char *)s, (long)a1, (long)a2); + vim_snprintf((char *)IObuff, IOSIZE, (char *)s, (long_u)a1, (long_u)a2); return emsg(IObuff); } @@ -5836,14 +5832,8 @@ emsgn(s, n) char_u *s; long n; { - if ((emsg_off > 0 && vim_strchr(p_debug, 'm') == NULL - && vim_strchr(p_debug, 't') == NULL) -#ifdef FEAT_EVAL - || emsg_skip > 0 -#endif - ) + if (emsg_not_now()) return TRUE; /* no error messages at the moment */ vim_snprintf((char *)IObuff, IOSIZE, (char *)s, n); return emsg(IObuff); } - diff --git a/src/netbeans.c b/src/netbeans.c index 731b98b24..e2f3a9da9 100644 --- a/src/netbeans.c +++ b/src/netbeans.c @@ -1641,17 +1641,30 @@ nb_do_cmd( } else if (streq((char *)cmd, "insertDone")) { - buf->bufp->b_start_eol = *args == 'T'; - buf->insertDone = TRUE; - args += 2; - buf->bufp->b_p_ro = *args == 'T'; - print_read_msg(buf); + if (buf == NULL || buf->bufp == NULL) + { + nbdebug((" null bufp in insertDone")); + } + else + { + buf->bufp->b_start_eol = *args == 'T'; + buf->insertDone = TRUE; + args += 2; + buf->bufp->b_p_ro = *args == 'T'; + print_read_msg(buf); + } /* =====================================================================*/ } else if (streq((char *)cmd, "saveDone")) { - long savedChars = atol((char *) args); - print_save_msg(buf, savedChars); + long savedChars = atol((char *)args); + + if (buf == NULL || buf->bufp == NULL) + { + nbdebug((" null bufp in saveDone")); + } + else + print_save_msg(buf, savedChars); /* =====================================================================*/ } else if (streq((char *)cmd, "startDocumentListen")) @@ -1856,12 +1869,17 @@ nb_do_cmd( } else if (streq((char *)cmd, "setModtime")) { - buf->bufp->b_mtime = atoi((char *) args); + if (buf == NULL || buf->bufp == NULL) + nbdebug((" null bufp in setModtime")); + else + buf->bufp->b_mtime = atoi((char *)args); /* =====================================================================*/ } else if (streq((char *)cmd, "setReadOnly")) { - if (streq((char *)args, "T")) + if (buf == NULL || buf->bufp == NULL) + nbdebug((" null bufp in setReadOnly")); + else if (streq((char *)args, "T")) buf->bufp->b_p_ro = TRUE; else buf->bufp->b_p_ro = FALSE; @@ -2637,7 +2655,7 @@ netbeans_file_activated(buf_T *bufp) return; q = nb_quote(bufp->b_ffname); - if (q == NULL || bp == NULL || bufp == NULL) + if (q == NULL || bp == NULL) return; vim_snprintf(buffer, sizeof(buffer), "%d:fileOpened=%d \"%s\" %s %s\n", diff --git a/src/normal.c b/src/normal.c index 189b21c66..651257451 100644 --- a/src/normal.c +++ b/src/normal.c @@ -831,6 +831,12 @@ getcount: { unshift_special(&ca); idx = find_command(ca.cmdchar); + if (idx < 0) + { + /* Just in case */ + clearopbeep(oap); + goto normal_end; + } } else if ((nv_cmds[idx].cmd_flags & NV_SSS) && (mod_mask & MOD_MASK_SHIFT)) @@ -3723,11 +3723,10 @@ error: end: if (allocated) - { vim_free(insert_string); - if (regname == '=') - vim_free(y_array); - } + if (regname == '=') + vim_free(y_array); + /* If the cursor is past the end of the line put it at the end. */ if (gchar_cursor() == NUL && curwin->w_cursor.col > 0 @@ -4967,10 +4966,6 @@ do_addsub(command, Prenum1) --col; } - /* truncate to max length of a number */ - if (length >= NUMBUFLEN - 1) - length = NUMBUFLEN - 2; - /* * If a number was found, and saving for undo works, replace the number. */ diff --git a/src/option.c b/src/option.c index c1fc7dc3d..59b84fd06 100644 --- a/src/option.c +++ b/src/option.c @@ -3396,7 +3396,7 @@ set_option_default(opt_idx, opt_flags, compatible) win_comp_scroll(curwin); else { - *(long *)varp = (long)options[opt_idx].def_val[dvi]; + *(long *)varp = (long)(long_i)options[opt_idx].def_val[dvi]; /* May also set global value for local option. */ if (both) *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = @@ -3405,8 +3405,9 @@ set_option_default(opt_idx, opt_flags, compatible) } else /* P_BOOL */ { - /* the cast to long is required for Manx C */ - *(int *)varp = (int)(long)options[opt_idx].def_val[dvi]; + /* the cast to long is required for Manx C, long_i is needed for + * MSVC */ + *(int *)varp = (int)(long)(long_i)options[opt_idx].def_val[dvi]; /* May also set global value for local option. */ if (both) *(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = @@ -3488,7 +3489,7 @@ set_number_default(name, val) opt_idx = findoption((char_u *)name); if (opt_idx >= 0) - options[opt_idx].def_val[VI_DEFAULT] = (char_u *)val; + options[opt_idx].def_val[VI_DEFAULT] = (char_u *)(long_i)val; } #if defined(EXITFREE) || defined(PROTO) @@ -3858,7 +3859,7 @@ set_title_defaults() else #endif val = mch_can_restore_title(); - options[idx1].def_val[VI_DEFAULT] = (char_u *)val; + options[idx1].def_val[VI_DEFAULT] = (char_u *)(long_i)val; p_title = val; } idx1 = findoption((char_u *)"icon"); @@ -3870,7 +3871,7 @@ set_title_defaults() else #endif val = mch_can_restore_icon(); - options[idx1].def_val[VI_DEFAULT] = (char_u *)val; + options[idx1].def_val[VI_DEFAULT] = (char_u *)(long_i)val; p_icon = val; } } @@ -4206,7 +4207,7 @@ do_set(arg, opt_flags) if (nextchar == '!') value = *(int *)(varp) ^ 1; else if (nextchar == '&') - value = (int)(long)options[opt_idx].def_val[ + value = (int)(long)(long_i)options[opt_idx].def_val[ ((flags & P_VI_DEF) || cp_val) ? VI_DEFAULT : VIM_DEFAULT]; else if (nextchar == '<') @@ -4261,7 +4262,7 @@ do_set(arg, opt_flags) */ ++arg; if (nextchar == '&') - value = (long)options[opt_idx].def_val[ + value = (long)(long_i)options[opt_idx].def_val[ ((flags & P_VI_DEF) || cp_val) ? VI_DEFAULT : VIM_DEFAULT]; else if (nextchar == '<') @@ -8401,10 +8402,11 @@ optval_default(p, varp) return TRUE; /* hidden option is always at default */ dvi = ((p->flags & P_VI_DEF) || p_cp) ? VI_DEFAULT : VIM_DEFAULT; if (p->flags & P_NUM) - return (*(long *)varp == (long)p->def_val[dvi]); + return (*(long *)varp == (long)(long_i)p->def_val[dvi]); if (p->flags & P_BOOL) - /* the cast to long is required for Manx C */ - return (*(int *)varp == (int)(long)p->def_val[dvi]); + /* the cast to long is required for Manx C, long_i is + * needed for MSVC */ + return (*(int *)varp == (int)(long)(long_i)p->def_val[dvi]); /* P_STRING */ return (STRCMP(*(char_u **)varp, p->def_val[dvi]) == 0); } @@ -9993,7 +9995,7 @@ option_value2string(opp, opt_flags) NameBuff[0] = NUL; #ifdef FEAT_CRYPT /* don't show the actual value of 'key', only that it's set */ - if (opp->var == (char_u *)&p_key && *varp) + else if (opp->var == (char_u *)&p_key && *varp) STRCPY(NameBuff, "*****"); #endif else if (opp->flags & P_EXPAND) diff --git a/src/os_mswin.c b/src/os_mswin.c index 642dc43b4..9e8b64d2d 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -770,14 +770,14 @@ check_str_len(char_u *str) if (VirtualQuery(str, &mbi, sizeof(mbi))) { /* pre cast these (typing savers) */ - DWORD dwStr = (DWORD)str; - DWORD dwBaseAddress = (DWORD)mbi.BaseAddress; + long_u dwStr = (long_u)str; + long_u dwBaseAddress = (long_u)mbi.BaseAddress; /* get start address of page that str is on */ - DWORD strPage = dwStr - (dwStr - dwBaseAddress) % si.dwPageSize; + long_u strPage = dwStr - (dwStr - dwBaseAddress) % si.dwPageSize; /* get length from str to end of page */ - DWORD pageLength = si.dwPageSize - (dwStr - strPage); + long_u pageLength = si.dwPageSize - (dwStr - strPage); for (p = str; !IsBadReadPtr(p, pageLength); p += pageLength, pageLength = si.dwPageSize) @@ -2625,7 +2625,7 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) #ifdef FEAT_AUTOCMD else if (data->dwData == COPYDATA_REPLY) { - sprintf((char *)winstr, "0x%x", (unsigned)sender); + sprintf((char *)winstr, PRINTF_HEX_LONG_U, (long_u)sender); apply_autocmds(EVENT_REMOTEREPLY, winstr, str, TRUE, curbuf); } @@ -2834,13 +2834,13 @@ serverSendReply(name, reply) { HWND target; COPYDATASTRUCT data; - int n = 0; + long_u n = 0; /* The "name" argument is a magic cookie obtained from expand("<client>"). * It should be of the form 0xXXXXX - i.e. a C hex literal, which is the * value of the client's message window HWND. */ - sscanf((char *)name, "%x", &n); + sscanf((char *)name, SCANF_HEX_LONG_U, &n); if (n == 0) return -1; @@ -3130,7 +3130,7 @@ int current_font_height = -12; /* also used in gui_w48.c */ * calculation is for a vertical (height) size or a horizontal (width) one. */ static int -points_to_pixels(char_u *str, char_u **end, int vertical, int pprinter_dc) +points_to_pixels(char_u *str, char_u **end, int vertical, long_i pprinter_dc) { int pixels; int points = 0; @@ -3338,10 +3338,10 @@ get_logfont( switch (*p++) { case 'h': - lf->lfHeight = - points_to_pixels(p, &p, TRUE, (int)printer_dc); + lf->lfHeight = - points_to_pixels(p, &p, TRUE, (long_i)printer_dc); break; case 'w': - lf->lfWidth = points_to_pixels(p, &p, FALSE, (int)printer_dc); + lf->lfWidth = points_to_pixels(p, &p, FALSE, (long_i)printer_dc); break; case 'b': #ifndef MSWIN16_FASTTEXT diff --git a/src/os_unix.c b/src/os_unix.c index 90129744f..5d52a7fae 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3602,7 +3602,7 @@ mch_call_shell(cmd, options) *p++ = NUL; p = skipwhite(p); } - if (i == 0) + if (argv == NULL) { argv = (char **)alloc((unsigned)((argc + 4) * sizeof(char *))); if (argv == NULL) /* out of memory */ diff --git a/src/os_win32.c b/src/os_win32.c index 630df5a4a..af6590652 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -1288,7 +1288,7 @@ create_conin(void) g_hConIn = CreateFile("CONIN$", GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, (LPSECURITY_ATTRIBUTES) NULL, - OPEN_EXISTING, (DWORD)NULL, (HANDLE)NULL); + OPEN_EXISTING, 0, (HANDLE)NULL); did_create_conin = TRUE; } diff --git a/src/proto/message.pro b/src/proto/message.pro index 9161b054f..cff7d6b50 100644 --- a/src/proto/message.pro +++ b/src/proto/message.pro @@ -1,70 +1,71 @@ /* message.c */ -extern int msg __ARGS((char_u *s)); -extern int verb_msg __ARGS((char_u *s)); -extern int msg_attr __ARGS((char_u *s, int attr)); -extern int msg_attr_keep __ARGS((char_u *s, int attr, int keep)); -extern char_u *msg_strtrunc __ARGS((char_u *s, int force)); -extern void trunc_string __ARGS((char_u *s, char_u *buf, int room)); -extern void reset_last_sourcing __ARGS((void)); -extern void msg_source __ARGS((int attr)); -extern int emsg __ARGS((char_u *s)); -extern int emsg2 __ARGS((char_u *s, char_u *a1)); -extern void emsg_invreg __ARGS((int name)); -extern char_u *msg_trunc_attr __ARGS((char_u *s, int force, int attr)); -extern char_u *msg_may_trunc __ARGS((int force, char_u *s)); -extern int delete_first_msg __ARGS((void)); -extern void ex_messages __ARGS((exarg_T *eap)); -extern void msg_end_prompt __ARGS((void)); -extern void wait_return __ARGS((int redraw)); -extern void set_keep_msg __ARGS((char_u *s, int attr)); -extern void set_keep_msg_from_hist __ARGS((void)); -extern void msg_start __ARGS((void)); -extern void msg_starthere __ARGS((void)); -extern void msg_putchar __ARGS((int c)); -extern void msg_putchar_attr __ARGS((int c, int attr)); -extern void msg_outnum __ARGS((long n)); -extern void msg_home_replace __ARGS((char_u *fname)); -extern void msg_home_replace_hl __ARGS((char_u *fname)); -extern int msg_outtrans __ARGS((char_u *str)); -extern int msg_outtrans_attr __ARGS((char_u *str, int attr)); -extern int msg_outtrans_len __ARGS((char_u *str, int len)); -extern char_u *msg_outtrans_one __ARGS((char_u *p, int attr)); -extern int msg_outtrans_len_attr __ARGS((char_u *msgstr, int len, int attr)); -extern void msg_make __ARGS((char_u *arg)); -extern int msg_outtrans_special __ARGS((char_u *strstart, int from)); -extern char_u *str2special __ARGS((char_u **sp, int from)); -extern void str2specialbuf __ARGS((char_u *sp, char_u *buf, int len)); -extern void msg_prt_line __ARGS((char_u *s, int list)); -extern void msg_puts __ARGS((char_u *s)); -extern void msg_puts_title __ARGS((char_u *s)); -extern void msg_puts_long_attr __ARGS((char_u *longstr, int attr)); -extern void msg_puts_long_len_attr __ARGS((char_u *longstr, int len, int attr)); -extern void msg_puts_attr __ARGS((char_u *s, int attr)); -extern void may_clear_sb_text __ARGS((void)); -extern void clear_sb_text __ARGS((void)); -extern void show_sb_text __ARGS((void)); -extern int msg_use_printf __ARGS((void)); -extern void mch_errmsg __ARGS((char *str)); -extern void mch_msg __ARGS((char *str)); -extern void msg_moremsg __ARGS((int full)); -extern void repeat_message __ARGS((void)); -extern void msg_clr_eos __ARGS((void)); -extern void msg_clr_eos_force __ARGS((void)); -extern void msg_clr_cmdline __ARGS((void)); -extern int msg_end __ARGS((void)); -extern void msg_check __ARGS((void)); -extern void verbose_enter __ARGS((void)); -extern void verbose_leave __ARGS((void)); -extern void verbose_enter_scroll __ARGS((void)); -extern void verbose_leave_scroll __ARGS((void)); -extern void verbose_stop __ARGS((void)); -extern int verbose_open __ARGS((void)); -extern void give_warning __ARGS((char_u *message, int hl)); -extern void msg_advance __ARGS((int col)); -extern int do_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int dfltbutton, char_u *textfield)); -extern void display_confirm_msg __ARGS((void)); -extern int vim_dialog_yesno __ARGS((int type, char_u *title, char_u *message, int dflt)); -extern int vim_dialog_yesnocancel __ARGS((int type, char_u *title, char_u *message, int dflt)); -extern int vim_dialog_yesnoallcancel __ARGS((int type, char_u *title, char_u *message, int dflt)); -extern char_u *do_browse __ARGS((int flags, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter, buf_T *buf)); +int msg __ARGS((char_u *s)); +int verb_msg __ARGS((char_u *s)); +int msg_attr __ARGS((char_u *s, int attr)); +int msg_attr_keep __ARGS((char_u *s, int attr, int keep)); +char_u *msg_strtrunc __ARGS((char_u *s, int force)); +void trunc_string __ARGS((char_u *s, char_u *buf, int room)); +void reset_last_sourcing __ARGS((void)); +void msg_source __ARGS((int attr)); +int emsg_not_now __ARGS((void)); +int emsg __ARGS((char_u *s)); +int emsg2 __ARGS((char_u *s, char_u *a1)); +void emsg_invreg __ARGS((int name)); +char_u *msg_trunc_attr __ARGS((char_u *s, int force, int attr)); +char_u *msg_may_trunc __ARGS((int force, char_u *s)); +int delete_first_msg __ARGS((void)); +void ex_messages __ARGS((exarg_T *eap)); +void msg_end_prompt __ARGS((void)); +void wait_return __ARGS((int redraw)); +void set_keep_msg __ARGS((char_u *s, int attr)); +void set_keep_msg_from_hist __ARGS((void)); +void msg_start __ARGS((void)); +void msg_starthere __ARGS((void)); +void msg_putchar __ARGS((int c)); +void msg_putchar_attr __ARGS((int c, int attr)); +void msg_outnum __ARGS((long n)); +void msg_home_replace __ARGS((char_u *fname)); +void msg_home_replace_hl __ARGS((char_u *fname)); +int msg_outtrans __ARGS((char_u *str)); +int msg_outtrans_attr __ARGS((char_u *str, int attr)); +int msg_outtrans_len __ARGS((char_u *str, int len)); +char_u *msg_outtrans_one __ARGS((char_u *p, int attr)); +int msg_outtrans_len_attr __ARGS((char_u *msgstr, int len, int attr)); +void msg_make __ARGS((char_u *arg)); +int msg_outtrans_special __ARGS((char_u *strstart, int from)); +char_u *str2special __ARGS((char_u **sp, int from)); +void str2specialbuf __ARGS((char_u *sp, char_u *buf, int len)); +void msg_prt_line __ARGS((char_u *s, int list)); +void msg_puts __ARGS((char_u *s)); +void msg_puts_title __ARGS((char_u *s)); +void msg_puts_long_attr __ARGS((char_u *longstr, int attr)); +void msg_puts_long_len_attr __ARGS((char_u *longstr, int len, int attr)); +void msg_puts_attr __ARGS((char_u *s, int attr)); +void may_clear_sb_text __ARGS((void)); +void clear_sb_text __ARGS((void)); +void show_sb_text __ARGS((void)); +int msg_use_printf __ARGS((void)); +void mch_errmsg __ARGS((char *str)); +void mch_msg __ARGS((char *str)); +void msg_moremsg __ARGS((int full)); +void repeat_message __ARGS((void)); +void msg_clr_eos __ARGS((void)); +void msg_clr_eos_force __ARGS((void)); +void msg_clr_cmdline __ARGS((void)); +int msg_end __ARGS((void)); +void msg_check __ARGS((void)); +void verbose_enter __ARGS((void)); +void verbose_leave __ARGS((void)); +void verbose_enter_scroll __ARGS((void)); +void verbose_leave_scroll __ARGS((void)); +void verbose_stop __ARGS((void)); +int verbose_open __ARGS((void)); +void give_warning __ARGS((char_u *message, int hl)); +void msg_advance __ARGS((int col)); +int do_dialog __ARGS((int type, char_u *title, char_u *message, char_u *buttons, int dfltbutton, char_u *textfield)); +void display_confirm_msg __ARGS((void)); +int vim_dialog_yesno __ARGS((int type, char_u *title, char_u *message, int dflt)); +int vim_dialog_yesnocancel __ARGS((int type, char_u *title, char_u *message, int dflt)); +int vim_dialog_yesnoallcancel __ARGS((int type, char_u *title, char_u *message, int dflt)); +char_u *do_browse __ARGS((int flags, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter, buf_T *buf)); /* vim: set ft=c : */ diff --git a/src/regexp.c b/src/regexp.c index e0bfb0305..2cd3120c6 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -7054,7 +7054,7 @@ reg_submatch(no) int round; linenr_T lnum; - if (!can_f_submatch) + if (!can_f_submatch || no < 0) return NULL; if (submatch_match == NULL) @@ -7112,10 +7112,10 @@ reg_submatch(no) ++len; } - if (round == 1) + if (retval == NULL) { retval = lalloc((long_u)len, TRUE); - if (s == NULL) + if (retval == NULL) return NULL; } } diff --git a/src/spell.c b/src/spell.c index 3ae44d4d0..5db914eaf 100644 --- a/src/spell.c +++ b/src/spell.c @@ -5102,7 +5102,10 @@ spell_read_aff(spin, fname) */ aff = (afffile_T *)getroom(spin, sizeof(afffile_T), TRUE); if (aff == NULL) + { + fclose(fd); return NULL; + } hash_init(&aff->af_pref); hash_init(&aff->af_suff); hash_init(&aff->af_comp); @@ -7361,7 +7364,8 @@ tree_add_word(spin, word, root, flags, region, affixID) /* Link the new node in the list, there will be one ref. */ np->wn_refs = 1; - *copyprev = np; + if (copyprev != NULL) + *copyprev = np; copyprev = &np->wn_sibling; /* Let "node" point to the head of the copied list. */ @@ -15464,7 +15468,7 @@ spell_dump_compl(buf, pat, ic, dir, dumpflags_arg) if (pat != NULL && slang->sl_pbyts == NULL) patlen = (int)STRLEN(pat); else - patlen = 0; + patlen = -1; /* round 1: case-folded tree * round 2: keep-case tree */ diff --git a/src/syntax.c b/src/syntax.c index 714de44d2..5308f903c 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -1371,7 +1371,8 @@ store_current_state(sp) for (p = syn_buf->b_sst_first; p != NULL; p = p->sst_next) if (p->sst_next == sp) break; - p->sst_next = sp->sst_next; + if (p != NULL) /* just in case */ + p->sst_next = sp->sst_next; } syn_stack_free_entry(syn_buf, sp); sp = NULL; diff --git a/src/testdir/test61.in b/src/testdir/test61.in index 749d8ad04..7ce72e627 100644 --- a/src/testdir/test61.in +++ b/src/testdir/test61.in @@ -43,6 +43,13 @@ Ac:set ul=100 :.w >>test.out :later 1h :.w >>test.out +:" +:" test undojoin +Goaaaa:set ul=100 +obbbbu:.w >>test.out +obbbb:set ul=100 +:undojoin +occccu:.w >>test.out :qa! ENDTEST diff --git a/src/testdir/test61.ok b/src/testdir/test61.ok index c23fe2298..020dd5383 100644 --- a/src/testdir/test61.ok +++ b/src/testdir/test61.ok @@ -20,3 +20,5 @@ 123456789 123456 123456abc +aaaa +aaaa diff --git a/src/version.h b/src/version.h index bb77f87e2..ef0ff31ce 100644 --- a/src/version.h +++ b/src/version.h @@ -35,6 +35,6 @@ */ #define VIM_VERSION_NODOT "vim70e" #define VIM_VERSION_SHORT "7.0e" -#define VIM_VERSION_MEDIUM "7.0e05 BETA" -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0e05 BETA (2006 Apr 21)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0e05 BETA (2006 Apr 21, compiled " +#define VIM_VERSION_MEDIUM "7.0e06 BETA" +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0e06 BETA (2006 Apr 22)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0e06 BETA (2006 Apr 22, compiled " @@ -342,14 +342,19 @@ typedef unsigned char char_u; typedef unsigned short short_u; typedef unsigned int int_u; -/* Make sure long_u is big enough to hold a pointer. On Win64 longs are 32 - * bit and pointers 64 bit. */ +/* Make sure long_u is big enough to hold a pointer. + * On Win64 longs are 32 bit and pointers 64 bit. + * For printf() and scanf() we need to take care of long_u specifically. */ #ifdef _WIN64 typedef unsigned __int64 long_u; typedef __int64 long_i; +# define SCANF_HEX_LONG_U "%Ix" +# define PRINTF_HEX_LONG_U "0x%Ix" #else typedef unsigned long long_u; typedef long long_i; +# define SCANF_HEX_LONG_U "%lx" +# define PRINTF_HEX_LONG_U "0x%lx" #endif /* @@ -1382,6 +1387,7 @@ typedef enum #define EMSG2(s, p) emsg2((char_u *)(s), (char_u *)(p)) #define EMSG3(s, p, q) emsg3((char_u *)(s), (char_u *)(p), (char_u *)(q)) #define EMSGN(s, n) emsgn((char_u *)(s), (long)(n)) +#define EMSGU(s, n) emsgu((char_u *)(s), (long_u)(n)) #define OUT_STR(s) out_str((char_u *)(s)) #define OUT_STR_NF(s) out_str_nf((char_u *)(s)) #define MSG_PUTS(s) msg_puts((char_u *)(s)) diff --git a/src/window.c b/src/window.c index d9d5bca23..628f9e0f9 100644 --- a/src/window.c +++ b/src/window.c @@ -5077,7 +5077,7 @@ win_drag_vsep_line(dragwin, offset) int n; fr = dragwin->w_frame; - if (fr == topframe) /* only one window (cannot happe?) */ + if (fr == topframe) /* only one window (cannot happen?) */ return; curfr = fr; fr = fr->fr_parent; |