0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

Improve the MS-Windows installer.

This commit is contained in:
Bram Moolenaar
2010-05-24 21:34:22 +02:00
parent e66194a54e
commit 442b4225d3
16 changed files with 146 additions and 80 deletions

View File

@@ -113,6 +113,7 @@ DOSBIN_S = dosbin_s
# - "make amirt", "make amibin". # - "make amirt", "make amibin".
# #
# PC: # PC:
# - Run make on Unix to update the ".mo" files.
# - "make dossrc" and "make dosrt". Unpack the archives on a PC. # - "make dossrc" and "make dosrt". Unpack the archives on a PC.
# 16 bit DOS version: (OBSOLETE, 16 bit version doesn't build) # 16 bit DOS version: (OBSOLETE, 16 bit version doesn't build)
# - Set environment for compiling with Borland C++ 3.1. # - Set environment for compiling with Borland C++ 3.1.
@@ -130,9 +131,11 @@ DOSBIN_S = dosbin_s
# - Rename the executables to "vimd32.exe", "xxdd32.exe", "installd32.exe" and # - Rename the executables to "vimd32.exe", "xxdd32.exe", "installd32.exe" and
# "uninstald32.exe". # "uninstald32.exe".
# Win32 console version: # Win32 console version:
# - Set environment for Visual C++ 2008 Express Edition: "msvc2008.bat". Or, # - Set environment for Visual C++ 2010:
# when using the Visual C++ Toolkit 2003: "msvcsetup.bat" (adjust the paths # "E:\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat". Or, for Visual
# when necessary). For Windows 98 the 2003 version is required. # C++ 2008 Express Edition: "msvc2008.bat". Or, when using the Visual C++
# Toolkit 2003: "msvcsetup.bat" (adjust the paths when necessary). For
# Windows 98/ME the 2003 version is required.
# - "nmake -f Make_mvc.mak" # - "nmake -f Make_mvc.mak"
# - "rm testdir/*.out", "nmake -f Make_mvc.mak test" and check the output. # - "rm testdir/*.out", "nmake -f Make_mvc.mak test" and check the output.
# - Rename the executables to "vimw32.exe", "xxdw32.exe". # - Rename the executables to "vimw32.exe", "xxdw32.exe".
@@ -165,15 +168,18 @@ DOSBIN_S = dosbin_s
# - Copy all the "*.exe" files to where this Makefile is. # - Copy all the "*.exe" files to where this Makefile is.
# - Copy all the "*.pdb" files to where this Makefile is. # - Copy all the "*.pdb" files to where this Makefile is.
# - "make dosbin". # - "make dosbin".
# - Run make on Unix to update the ".mo" files.
# NSIS self installing exe: # NSIS self installing exe:
# - To get NSIS see http://nsis.sourceforge.net
# - Make sure gvim_ole.exe, vimd32.exe, vimw32.exe, installw32.exe, # - Make sure gvim_ole.exe, vimd32.exe, vimw32.exe, installw32.exe,
# uninstalw32.exe and xxdw32.exe have been build as mentioned above. # uninstalw32.exe and xxdw32.exe have been build as mentioned above.
# - put gvimext.dll in src/GvimExt and VisVim.dll in src/VisVim (get them # - copy these files (get them from a binary archive or build them):
# from a binary archive or build them) # gvimext.dll in src/GvimExt
# gvimext64.dll in src/GvimExt
# VisVim.dll in src/VisVim
# Note: VisVim needs to be build with MSVC 5, newer versions don't work. # Note: VisVim needs to be build with MSVC 5, newer versions don't work.
# gvimext64.dll can be obtained from http://code.google.com/p/vim-win3264/
# - make sure there is a diff.exe two levels up # - make sure there is a diff.exe two levels up
# - go to ../nsis and do "makensis gvim.nsi". # - go to ../nsis and do "makensis gvim.nsi" (takes a few minutes).
# - Copy gvim##.exe to the dist directory. # - Copy gvim##.exe to the dist directory.
# #
# OS/2: (OBSOLETE, OS/2 version is no longer distributed) # OS/2: (OBSOLETE, OS/2 version is no longer distributed)
@@ -355,11 +361,35 @@ amisrc: dist prepare
no_title.vim: Makefile no_title.vim: Makefile
echo "set notitle noicon nocp nomodeline viminfo=" >no_title.vim echo "set notitle noicon nocp nomodeline viminfo=" >no_title.vim
# MS-DOS sources
dossrc: dist no_title.vim dist/$(COMMENT_SRC) runtime/doc/uganda.nsis.txt
-rm -rf dist/vim$(VERSION)src.zip
-rm -rf dist/vim
mkdir dist/vim
mkdir dist/vim/$(VIMRTDIR)
tar cf - \
$(SRC_ALL) \
$(SRC_DOS) \
$(SRC_AMI_DOS) \
$(SRC_DOS_UNIX) \
runtime/doc/uganda.nsis.txt \
| (cd dist/vim/$(VIMRTDIR); tar xf -)
mv dist/vim/$(VIMRTDIR)/runtime/* dist/vim/$(VIMRTDIR)
rmdir dist/vim/$(VIMRTDIR)/runtime
find dist/vim/$(VIMRTDIR) -type f -exec $(VIM) -e -X -u no_title.vim -c ":set tx|wq" {} \;
tar cf - \
$(SRC_DOS_BIN) \
| (cd dist/vim/$(VIMRTDIR); tar xf -)
cd dist && zip -9 -rD -z vim$(VERSION)src.zip vim <$(COMMENT_SRC)
runtime/doc/uganda.nsis.txt: runtime/doc/uganda.txt
cd runtime/doc && $(MAKE) uganda.nsis.txt
dosrt: dist dist/$(COMMENT_RT) dosrt_unix2dos dosrt: dist dist/$(COMMENT_RT) dosrt_unix2dos
-rm -rf dist/vim$(VERSION)rt.zip -rm -rf dist/vim$(VERSION)rt.zip
cd dist && zip -9 -rD -z vim$(VERSION)rt.zip vim <$(COMMENT_RT) cd dist && zip -9 -rD -z vim$(VERSION)rt.zip vim <$(COMMENT_RT)
# Split in two parts to avoid a "argument list too long" error. # Split in two parts to avoid an "argument list too long" error.
dosrt_unix2dos: dist prepare no_title.vim dosrt_unix2dos: dist prepare no_title.vim
-rm -rf dist/vim -rm -rf dist/vim
mkdir dist/vim mkdir dist/vim
@@ -516,30 +546,6 @@ dosbin_s: dist no_title.vim dist/$(COMMENT_W32S)
cp uninstalw32.exe dist/vim/$(VIMRTDIR)/uninstal.exe cp uninstalw32.exe dist/vim/$(VIMRTDIR)/uninstal.exe
cd dist && zip -9 -rD -z gvim$(VERSION)_s.zip vim <$(COMMENT_W32S) cd dist && zip -9 -rD -z gvim$(VERSION)_s.zip vim <$(COMMENT_W32S)
# MS-DOS sources
dossrc: dist no_title.vim dist/$(COMMENT_SRC) runtime/doc/uganda.nsis.txt
-rm -rf dist/vim$(VERSION)src.zip
-rm -rf dist/vim
mkdir dist/vim
mkdir dist/vim/$(VIMRTDIR)
tar cf - \
$(SRC_ALL) \
$(SRC_DOS) \
$(SRC_AMI_DOS) \
$(SRC_DOS_UNIX) \
runtime/doc/uganda.nsis.txt \
| (cd dist/vim/$(VIMRTDIR); tar xf -)
mv dist/vim/$(VIMRTDIR)/runtime/* dist/vim/$(VIMRTDIR)
rmdir dist/vim/$(VIMRTDIR)/runtime
find dist/vim/$(VIMRTDIR) -type f -exec $(VIM) -e -X -u no_title.vim -c ":set tx|wq" {} \;
tar cf - \
$(SRC_DOS_BIN) \
| (cd dist/vim/$(VIMRTDIR); tar xf -)
cd dist && zip -9 -rD -z vim$(VERSION)src.zip vim <$(COMMENT_SRC)
runtime/doc/uganda.nsis.txt: runtime/doc/uganda.txt
cd runtime/doc && $(MAKE) uganda.nsis.txt
os2bin: dist no_title.vim dist/$(COMMENT_OS2) os2bin: dist no_title.vim dist/$(COMMENT_OS2)
-rm -rf dist/vim$(VERSION)os2.zip -rm -rf dist/vim$(VERSION)os2.zip
-rm -rf dist/vim -rm -rf dist/vim

View File

@@ -27,12 +27,15 @@
# ----------- No configurable settings below this line ----------- # ----------- No configurable settings below this line -----------
!include UpgradeDLL.nsh # for VisVim.dll !include UpgradeDLL.nsh # for VisVim.dll
!include LogicLib.nsh
!include x64.nsh
Name "Vim ${VER_MAJOR}.${VER_MINOR}" Name "Vim ${VER_MAJOR}.${VER_MINOR}"
OutFile gvim${VER_MAJOR}${VER_MINOR}.exe OutFile gvim${VER_MAJOR}${VER_MINOR}.exe
CRCCheck force CRCCheck force
SetCompressor lzma SetCompressor lzma
SetDatablockOptimize on SetDatablockOptimize on
RequestExecutionLevel highest
ComponentText "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer." ComponentText "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer."
DirText "Choose a directory to install Vim (must end in 'vim')" DirText "Choose a directory to install Vim (must end in 'vim')"
@@ -290,13 +293,21 @@ Section "Add an Edit-with-Vim context menu entry"
SetOutPath $0 SetOutPath $0
ClearErrors ClearErrors
SetOverwrite try SetOverwrite try
File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll ${If} ${RunningX64}
File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext64.dll
${Else}
File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll
${EndIf}
IfErrors 0 GvimExtDone IfErrors 0 GvimExtDone
# Can't copy gvimext.dll, create it under another name and rename it on # Can't copy gvimext.dll, create it under another name and rename it on
# next reboot. # next reboot.
GetTempFileName $3 $0 GetTempFileName $3 $0
File /oname=$3 ${VIMSRC}\GvimExt\gvimext.dll ${If} ${RunningX64}
File /oname=$3 ${VIMSRC}\GvimExt\gvimext64.dll
${Else}
File /oname=$3 ${VIMSRC}\GvimExt\gvimext.dll
${EndIf}
Rename /REBOOTOK $3 $0\gvimext.dll Rename /REBOOTOK $3 $0\gvimext.dll
GvimExtDone: GvimExtDone:

View File

@@ -37,7 +37,7 @@ The Win32 version was written by George V. Reilly <george@reilly.org>.
The original Windows NT port was done by Roger Knobbe <RogerK@wonderware.com>. The original Windows NT port was done by Roger Knobbe <RogerK@wonderware.com>.
The GUI version was made by George V. Reilly and Robert Webb. The GUI version was made by George V. Reilly and Robert Webb.
For compiling see "src/INSTALL.pc". *win32-compiling* For compiling see "src/INSTALLpc.txt". *win32-compiling*
============================================================================== ==============================================================================
1. Known problems *windows95* *win32-problems* 1. Known problems *windows95* *win32-problems*

View File

@@ -1084,12 +1084,12 @@ restored. (Luc St-Louis)
Vim 7.3: Vim 7.3:
- Use NSIS 2.45, it includes Windows 7 support. - Win32 DOS and Win32 console version: test69 fails.
Include "RequestExecutionLevel highest" - using NSIS 2.46: install on Windows 7 works, but no "Edit with Vim" menu.
Ron's version: http://dev.ronware.org/p/vim/finfo?name=gvim.nsi Ron's version: http://dev.ronware.org/p/vim/finfo?name=gvim.nsi
- Supply a 64 bit version of gvimext.dll for 64 bit windows. - When running uninstall program from NSIS via install.exe, still need to
http://code.google.com/p/vim-win3264/ ask confirmation in console window, uninstaller doesn't wait. Is there an
Gvim can be 32 bit. NSIS option to wait?
Patches to include: Patches to include:
- Persistent undo bugs / fixes: - Persistent undo bugs / fixes:
- Add undofile(name): get undo file name for buffer "name". - Add undofile(name): get undo file name for buffer "name".

View File

@@ -162,6 +162,17 @@ Visual C++ 2008 Express Edition *msvc-2008-express*
------------------------------- -------------------------------
Visual C++ 2008 Express Edition can be downloaded for free from: Visual C++ 2008 Express Edition can be downloaded for free from:
http://www.microsoft.com/express/downloads/
This includes the IDE and the debugger.
To set the environment execute the msvc2008.bat script. You can then build
Vim with Make_mvc.mak.
Visual C++ 2010 Express Edition *msvc-2010-express*
-------------------------------
Visual C++ 2010 Express Edition can be downloaded for free from:
http://www.microsoft.com/express/vc/Default.aspx http://www.microsoft.com/express/vc/Default.aspx
This includes the IDE and the debugger. This includes the IDE and the debugger.

View File

@@ -25,7 +25,7 @@ typedef union {
char_u uc[8]; char_u uc[8];
} block8; } block8;
#ifdef WIN3264 #if defined(WIN3264) || defined(DOS32)
/* MS-Windows is always little endian */ /* MS-Windows is always little endian */
#else #else
# ifdef HAVE_CONFIG_H # ifdef HAVE_CONFIG_H
@@ -406,7 +406,7 @@ bf_key_init(password)
int keylen; int keylen;
key = sha256_key(password); key = sha256_key(password);
keylen = STRLEN(key); keylen = (int)STRLEN(key);
for (i = 0; i < 256; ++i) for (i = 0; i < 256; ++i)
{ {
sbx[0][i] = sbi[0][i]; sbx[0][i] = sbi[0][i];

View File

@@ -451,7 +451,7 @@ get_vim_env(void)
* Return non-zero when found one. * Return non-zero when found one.
*/ */
static int static int
uninstall_check(void) uninstall_check(int skip_question)
{ {
HKEY key_handle; HKEY key_handle;
HKEY uninstall_key_handle; HKEY uninstall_key_handle;
@@ -502,7 +502,10 @@ uninstall_check(void)
printf("(The batch files used in a console and the \"Edit with Vim\" entry in\n"); printf("(The batch files used in a console and the \"Edit with Vim\" entry in\n");
printf("the popup menu will use the new version)\n"); printf("the popup menu will use the new version)\n");
printf("\nDo you want to uninstall \"%s\" now?\n(y)es/(n)o) ", temp_string_buffer); if (skip_question)
printf("\nRunning uninstall program for \"%s\"\n", temp_string_buffer);
else
printf("\nDo you want to uninstall \"%s\" now?\n(y)es/(n)o) ", temp_string_buffer);
fflush(stdout); fflush(stdout);
/* get the UninstallString */ /* get the UninstallString */
@@ -523,8 +526,13 @@ uninstall_check(void)
if (input != 'n') if (input != 'n')
printf("%c is an invalid reply. Please enter either 'y' or 'n'\n", input); printf("%c is an invalid reply. Please enter either 'y' or 'n'\n", input);
rewind(stdin); if (skip_question)
scanf("%c", &input); input = 'y';
else
{
rewind(stdin);
scanf("%c", &input);
}
switch (input) switch (input)
{ {
case 'y': case 'y':
@@ -535,12 +543,14 @@ uninstall_check(void)
&orig_num_keys, NULL, NULL, NULL, &orig_num_keys, NULL, NULL, NULL,
NULL, NULL, NULL, NULL); NULL, NULL, NULL, NULL);
#if 0 /* let the uninstall program delete the key */
/* Delete the uninstall key. It has no subkeys, so /* Delete the uninstall key. It has no subkeys, so
* this is easy. Do this before uninstalling, that * this is easy. Do this before uninstalling, that
* may try to delete the key as well. */ * may try to delete the key as well. */
RegDeleteKey(key_handle, subkey_name_buff); RegDeleteKey(key_handle, subkey_name_buff);
#endif
/* Find existing .bat files before deleting them. */ /* Find existing .bat files before deleting them. */
find_bat_exe(TRUE); find_bat_exe(TRUE);
/* Execute the uninstall program. Put it in double /* Execute the uninstall program. Put it in double
@@ -2376,16 +2386,23 @@ main(int argc, char **argv)
if (argc > 1 && strcmp(argv[1], "-uninstall-check") == 0) if (argc > 1 && strcmp(argv[1], "-uninstall-check") == 0)
{ {
/* Only check for already installed Vims. Used by NSIS installer. */ /* Only check for already installed Vims. Used by NSIS installer. */
i = uninstall_check(); i = uninstall_check(1);
/* Find the value of $VIM, because NSIS isn't able to do this by /* Find the value of $VIM, because NSIS isn't able to do this by
* itself. */ * itself. */
get_vim_env(); get_vim_env();
/* When nothing found exit quietly. If something found wait for /* When nothing found exit quietly. If something found wait for
* return pressed. */ * hitting Enter.
* We would like to exit without hitting Enter, but the uninstaller
* detaches itself, thus we get here before it's finished. */
if (i) if (i)
myexit(0); {
printf("\n");
printf("When the uninstall program is finished, press Enter to continue\n");
rewind(stdin);
(void)getchar();
}
exit(0); exit(0);
} }
#endif #endif
@@ -2399,7 +2416,7 @@ main(int argc, char **argv)
#ifdef WIN3264 #ifdef WIN3264
/* Check for already installed Vims. */ /* Check for already installed Vims. */
if (interactive) if (interactive)
uninstall_check(); uninstall_check(0);
#endif #endif
/* Find out information about the system. */ /* Find out information about the system. */
@@ -2449,6 +2466,7 @@ main(int argc, char **argv)
} }
} }
printf("\n"); printf("\n");
myexit(0);
} }
else else
{ {
@@ -2457,9 +2475,11 @@ main(int argc, char **argv)
*/ */
command_line_setup_choices(argc, argv); command_line_setup_choices(argc, argv);
install(); install();
/* Avoid that the user has to hit Enter, just wait a little bit to
* allow reading the messages. */
Sleep(2000);
} }
myexit(0);
/*NOTREACHED*/
return 0; return 0;
} }

View File

@@ -418,12 +418,12 @@ run_command(char *cmd)
/* There is a cmd.exe, so this might be Windows NT. If it is, /* There is a cmd.exe, so this might be Windows NT. If it is,
* we need to call cmd.exe explicitly. If it is a later OS, * we need to call cmd.exe explicitly. If it is a later OS,
* calling cmd.exe won't hurt if it is present. * calling cmd.exe won't hurt if it is present.
* Also, "wait" on NT expects a window title argument. * Also, "start" on NT expects a window title argument.
*/ */
/* Replace the slashes with backslashes. */ /* Replace the slashes with backslashes. */
while ((p = strchr(cmd_path, '/')) != NULL) while ((p = strchr(cmd_path, '/')) != NULL)
*p = '\\'; *p = '\\';
sprintf(cmd_buf, "%s /c start \"vimcmd\" /w %s", cmd_path, cmd); sprintf(cmd_buf, "%s /c start \"vimcmd\" /wait %s", cmd_path, cmd);
free(cmd_path); free(cmd_path);
} }
else else

View File

@@ -2848,7 +2848,7 @@ get_crypt_method(ptr, len)
return i; return i;
} }
i = STRLEN(crypt_magic_head); i = (int)STRLEN(crypt_magic_head);
if (len >= i && memcmp(ptr, crypt_magic_head, i) == 0) if (len >= i && memcmp(ptr, crypt_magic_head, i) == 0)
EMSG(_("E821: File is encrypted with unknown method")); EMSG(_("E821: File is encrypted with unknown method"));
@@ -4409,7 +4409,7 @@ restore_backup:
ptr = ml_get_buf(buf, lnum, FALSE) - 1; ptr = ml_get_buf(buf, lnum, FALSE) - 1;
#ifdef FEAT_PERSISTENT_UNDO #ifdef FEAT_PERSISTENT_UNDO
if (write_undo_file) if (write_undo_file)
sha256_update(&sha_ctx, ptr + 1, STRLEN(ptr + 1) + 1); sha256_update(&sha_ctx, ptr + 1, (UINT32_T)(STRLEN(ptr + 1) + 1));
#endif #endif
while ((c = *++ptr) != NUL) while ((c = *++ptr) != NUL)
{ {
@@ -5675,7 +5675,10 @@ need_conversion(fenc)
int fenc_flags; int fenc_flags;
if (*fenc == NUL || STRCMP(p_enc, fenc) == 0) if (*fenc == NUL || STRCMP(p_enc, fenc) == 0)
{
same_encoding = TRUE; same_encoding = TRUE;
fenc_flags = 0;
}
else else
{ {
/* Ignore difference between "ansi" and "latin1", "ucs-4" and /* Ignore difference between "ansi" and "latin1", "ucs-4" and

View File

@@ -183,7 +183,7 @@
# define ID_BEVAL_TOOLTIP 200 # define ID_BEVAL_TOOLTIP 200
# define BEVAL_TEXT_LEN MAXPATHL # define BEVAL_TEXT_LEN MAXPATHL
#if _MSC_VER < 1300 #if _MSC_VER < 1300 || !defined(UINT_PTR)
/* Work around old versions of basetsd.h which wrongly declares /* Work around old versions of basetsd.h which wrongly declares
* UINT_PTR as unsigned long. */ * UINT_PTR as unsigned long. */
# define UINT_PTR UINT # define UINT_PTR UINT
@@ -4765,9 +4765,7 @@ gui_mch_create_beval_area(target, mesg, mesgCB, clientData)
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
Handle_WM_Notify(hwnd, pnmh) Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh)
HWND hwnd;
LPNMHDR pnmh;
{ {
if (pnmh->idFrom != ID_BEVAL_TOOLTIP) /* it is not our tooltip */ if (pnmh->idFrom != ID_BEVAL_TOOLTIP) /* it is not our tooltip */
return; return;

View File

@@ -462,7 +462,7 @@ add_menu_path(menu_path, menuarg, pri_tab, call_data
* name (without mnemonic and accelerator text). */ * name (without mnemonic and accelerator text). */
next_name = menu_name_skip(name); next_name = menu_name_skip(name);
#ifdef FEAT_MULTI_LANG #ifdef FEAT_MULTI_LANG
map_to = menutrans_lookup(name,STRLEN(name)); map_to = menutrans_lookup(name, (int)STRLEN(name));
if (map_to != NULL) if (map_to != NULL)
{ {
en_name = name; en_name = name;

View File

@@ -787,7 +787,7 @@ check_str_len(char_u *str)
/* get length from str to end of page */ /* get length from str to end of page */
long_u pageLength = si.dwPageSize - (dwStr - strPage); long_u pageLength = si.dwPageSize - (dwStr - strPage);
for (p = str; !IsBadReadPtr(p, pageLength); for (p = str; !IsBadReadPtr(p, (UINT)pageLength);
p += pageLength, pageLength = si.dwPageSize) p += pageLength, pageLength = si.dwPageSize)
for (i = 0; i < pageLength; ++i, ++length) for (i = 0; i < pageLength; ++i, ++length)
if (p[i] == NUL) if (p[i] == NUL)
@@ -1779,7 +1779,7 @@ swap_me(COLORREF colorref)
} }
/* Attempt to make this work for old and new compilers */ /* Attempt to make this work for old and new compilers */
#if _MSC_VER < 1300 #if !defined(_MSC_VER) || (_MSC_VER < 1300) || !defined(INT_PTR)
# define PDP_RETVAL BOOL # define PDP_RETVAL BOOL
#else #else
# define PDP_RETVAL INT_PTR # define PDP_RETVAL INT_PTR

View File

@@ -307,7 +307,7 @@ sha256_key(buf)
if (buf == NULL || *buf == NUL) if (buf == NULL || *buf == NUL)
return (char_u *)""; return (char_u *)"";
return sha256_bytes(buf, STRLEN(buf)); return sha256_bytes(buf, (int)STRLEN(buf));
} }
/* /*
@@ -354,7 +354,7 @@ sha256_self_test()
if (i < 2) if (i < 2)
{ {
hexit = sha256_bytes((char_u *)sha_self_test_msg[i], hexit = sha256_bytes((char_u *)sha_self_test_msg[i],
STRLEN(sha_self_test_msg[i])); (int)STRLEN(sha_self_test_msg[i]));
STRCPY(output, hexit); STRCPY(output, hexit);
} }
else else

View File

@@ -82,6 +82,10 @@
#define UH_MAGIC 0x18dade /* value for uh_magic when in use */ #define UH_MAGIC 0x18dade /* value for uh_magic when in use */
#define UE_MAGIC 0xabc123 /* value for ue_magic when in use */ #define UE_MAGIC 0xabc123 /* value for ue_magic when in use */
#if defined(MSDOS) || defined(WIN16) || defined(WIN32) || defined(_WIN64)
# include "vimio.h" /* for vim_read(), must be before vim.h */
#endif
#include "vim.h" #include "vim.h"
/* See below: use malloc()/free() for memory management. */ /* See below: use malloc()/free() for memory management. */
@@ -685,7 +689,7 @@ u_compute_hash(hash)
for (lnum = 1; lnum < curbuf->b_ml.ml_line_count; ++lnum) for (lnum = 1; lnum < curbuf->b_ml.ml_line_count; ++lnum)
{ {
p = ml_get(lnum); p = ml_get(lnum);
sha256_update(&ctx, p, STRLEN(p) + 1); sha256_update(&ctx, p, (UINT32_T)(STRLEN(p) + 1));
} }
sha256_finish(&ctx, hash); sha256_finish(&ctx, hash);
} }
@@ -764,7 +768,7 @@ u_get_undo_file_name(buf_ffname, reading)
{ {
/* Use same directory as the ffname, /* Use same directory as the ffname,
* "dir/name" -> "dir/.name.un~" */ * "dir/name" -> "dir/.name.un~" */
undo_file_name = vim_strnsave(ffname, STRLEN(ffname) + 5); undo_file_name = vim_strnsave(ffname, (int)(STRLEN(ffname) + 5));
if (undo_file_name == NULL) if (undo_file_name == NULL)
break; break;
p = gettail(undo_file_name); p = gettail(undo_file_name);
@@ -823,7 +827,7 @@ u_read_undo(name, hash)
linenr_T line_count; linenr_T line_count;
int uep_len; int uep_len;
int line_len; int line_len;
int num_head; int num_head = 0;
long old_header_seq, new_header_seq, cur_header_seq; long old_header_seq, new_header_seq, cur_header_seq;
long seq_last, seq_cur; long seq_last, seq_cur;
short old_idx = -1, new_idx = -1, cur_idx = -1; short old_idx = -1, new_idx = -1, cur_idx = -1;
@@ -929,10 +933,10 @@ u_read_undo(name, hash)
/* We're not actually trying to store pointers here. We're just storing /* We're not actually trying to store pointers here. We're just storing
* IDs so we can swizzle them into pointers later - hence the type * IDs so we can swizzle them into pointers later - hence the type
* cast. */ * cast. */
uhp->uh_next = (u_header_T *)(long)get4c(fp); uhp->uh_next = (u_header_T *)get4c(fp);
uhp->uh_prev = (u_header_T *)(long)get4c(fp); uhp->uh_prev = (u_header_T *)get4c(fp);
uhp->uh_alt_next = (u_header_T *)(long)get4c(fp); uhp->uh_alt_next = (u_header_T *)get4c(fp);
uhp->uh_alt_prev = (u_header_T *)(long)get4c(fp); uhp->uh_alt_prev = (u_header_T *)get4c(fp);
uhp->uh_seq = get4c(fp); uhp->uh_seq = get4c(fp);
if (uhp->uh_seq <= 0) if (uhp->uh_seq <= 0)
{ {
@@ -1139,6 +1143,8 @@ serialize_uep(uep, fp)
if (uep->ue_size > 0) if (uep->ue_size > 0)
entry_lens = (int *)alloc(uep->ue_size * sizeof(int)); entry_lens = (int *)alloc(uep->ue_size * sizeof(int));
else
entry_lens = NULL;
/* Define uep_len to be the size of the entire uep minus the size of its /* Define uep_len to be the size of the entire uep minus the size of its
* component strings, in bytes. The sizes of the component strings * component strings, in bytes. The sizes of the component strings
@@ -1335,7 +1341,7 @@ u_write_undo(name, forceit, buf, hash)
put_bytes(fp, (long_u)buf->b_ml.ml_line_count, 4); put_bytes(fp, (long_u)buf->b_ml.ml_line_count, 4);
/* Begin undo data for U */ /* Begin undo data for U */
str_len = buf->b_u_line_ptr != NULL ? STRLEN(buf->b_u_line_ptr) : 0; str_len = buf->b_u_line_ptr != NULL ? (int)STRLEN(buf->b_u_line_ptr) : 0;
put_bytes(fp, (long_u)str_len, 4); put_bytes(fp, (long_u)str_len, 4);
if (str_len > 0 && fwrite(buf->b_u_line_ptr, (size_t)str_len, if (str_len > 0 && fwrite(buf->b_u_line_ptr, (size_t)str_len,
(size_t)1, fp) != 1) (size_t)1, fp) != 1)

View File

@@ -354,8 +354,9 @@ main(int argc, char *argv[])
{ {
printf(" - the \"Edit with Vim\" entry in the popup menu\n"); printf(" - the \"Edit with Vim\" entry in the popup menu\n");
printf(" which uses \"%s\"\n", popup_path); printf(" which uses \"%s\"\n", popup_path);
printf("\nRemove it (y/n)? "); if (interactive)
if (confirm()) printf("\nRemove it (y/n)? ");
if (!interactive || confirm())
{ {
remove_popup(); remove_popup();
/* Assume the "Open With" entry can be removed as well, don't /* Assume the "Open With" entry can be removed as well, don't
@@ -430,9 +431,14 @@ main(int argc, char *argv[])
printf("(They are still where you unpacked them.)\n"); printf("(They are still where you unpacked them.)\n");
} }
rewind(stdin); if (interactive)
printf("\nPress Enter to exit..."); {
(void)getchar(); rewind(stdin);
printf("\nPress Enter to exit...");
(void)getchar();
}
else
Sleep(3000);
return 0; return 0;
} }

View File

@@ -1943,6 +1943,11 @@ typedef int VimClipboard; /* This is required for the prototypes. */
#pragma option -p. #pragma option -p.
#endif #endif
#ifdef _MSC_VER
/* Avoid useless warning "conversion from X to Y of greater size". */
#pragma warning(disable : 4312)
#endif
#if defined(MEM_PROFILE) #if defined(MEM_PROFILE)
# define vim_realloc(ptr, size) mem_realloc((ptr), (size)) # define vim_realloc(ptr, size) mem_realloc((ptr), (size))
#else #else