home *** CD-ROM | disk | FTP | other *** search
- To: vim-dev@vim.org
- Subject: Patch 6.2.177 (extra)
- 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 6.2.177 (extra)
- Problem: VisVim: Opening a file with a space in the name doesn't work. (Rob
- Retter) Arbitrary commands are being executed. (Neil Bird)
- Solution: Put a backslash in front of every space in the file name.
- (Gerard Blais) Terminate the CTRL-\ CTRL-N command with a NUL.
- Files: src/VisVim/Commands.cpp, src/VisVim/VisVim.rc
-
-
- *** ../vim-6.2.176/src/VisVim/Commands.cpp Sat Sep 7 17:03:06 2002
- --- src/VisVim/Commands.cpp Fri Jan 9 11:04:58 2004
- ***************
- *** 512,529 ****
- goto OleError;
-
- OLECHAR Buf[MAX_OLE_STR];
- char VimCmd[MAX_OLE_STR];
- ! char* VimCmdStart;
- ! char* s;
-
- // Prepend CTRL-\ CTRL-N to exit insert mode
- VimCmd[0] = 0x1c;
- VimCmd[1] = 0x0e;
- ! VimCmdStart = VimCmd + 2;
-
- #ifdef SINGLE_WINDOW
- ! // Update the current file in Vim if it has been modified
- ! sprintf (VimCmdStart, ":up\n");
- #endif
- if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
- goto OleError;
- --- 512,530 ----
- goto OleError;
-
- OLECHAR Buf[MAX_OLE_STR];
- + char FileNameTmp[MAX_OLE_STR];
- char VimCmd[MAX_OLE_STR];
- ! char *s, *p;
-
- // Prepend CTRL-\ CTRL-N to exit insert mode
- VimCmd[0] = 0x1c;
- VimCmd[1] = 0x0e;
- ! VimCmd[2] = 0;
-
- #ifdef SINGLE_WINDOW
- ! // Update the current file in Vim if it has been modified.
- ! // Disabled, because it could write the file when you don't want to.
- ! sprintf (VimCmd + 2, ":up\n");
- #endif
- if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
- goto OleError;
- ***************
- *** 532,543 ****
- if (g_ChangeDir != CD_NONE)
- VimChangeDir (VimOle, DispatchId, FileName);
-
- ! // Make Vim open the file
- ! sprintf (VimCmd, ":drop %S\n", (char*) FileName);
- ! // Convert all \ to /
- ! for (s = VimCmd; *s; ++s)
- ! if (*s == '\\')
- ! *s = '/';
- if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
- goto OleError;
-
- --- 533,556 ----
- if (g_ChangeDir != CD_NONE)
- VimChangeDir (VimOle, DispatchId, FileName);
-
- ! // Make Vim open the file.
- ! // In the filename convert all \ to /, put a \ before a space.
- ! sprintf(VimCmd, ":drop ");
- ! sprintf(FileNameTmp, "%S", (char *)FileName);
- ! s = VimCmd + 6;
- ! for (p = FileNameTmp; *p != '\0' && s < FileNameTmp + MAX_OLE_STR - 4;
- ! ++p)
- ! if (*p == '\\')
- ! *s++ = '/';
- ! else
- ! {
- ! if (*p == ' ')
- ! *s++ = '\\';
- ! *s++ = *p;
- ! }
- ! *s++ = '\n';
- ! *s = '\0';
- !
- if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
- goto OleError;
-
- ***************
- *** 638,656 ****
- CString StrFileName = FileName;
- char Drive[_MAX_DRIVE];
- char Dir[_MAX_DIR];
- _splitpath (StrFileName, Drive, Dir, NULL, NULL);
- ! // Convert to unix path name format
- ! for (char* s = Dir; *s; ++s)
- if (*s == '\\')
- ! *s = '/';
-
- // Construct the cd command; append /.. if cd to parent
- // directory and not in root directory
- OLECHAR Buf[MAX_OLE_STR];
- char VimCmd[MAX_OLE_STR];
-
- ! sprintf (VimCmd, ":cd %s%s%s\n", Drive, Dir,
- ! g_ChangeDir == CD_SOURCE_PARENT && Dir[1] ? ".." : "");
- VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf));
- }
-
- --- 651,682 ----
- CString StrFileName = FileName;
- char Drive[_MAX_DRIVE];
- char Dir[_MAX_DIR];
- + char DirUnix[_MAX_DIR * 2];
- + char *s, *t;
- +
- _splitpath (StrFileName, Drive, Dir, NULL, NULL);
- !
- ! // Convert to Unix path name format, escape spaces.
- ! t = DirUnix;
- ! for (s = Dir; *s; ++s)
- if (*s == '\\')
- ! *t++ = '/';
- ! else
- ! {
- ! if (*s == ' ')
- ! *t++ = '\\';
- ! *t++ = *s;
- ! }
- ! *t = '\0';
- !
-
- // Construct the cd command; append /.. if cd to parent
- // directory and not in root directory
- OLECHAR Buf[MAX_OLE_STR];
- char VimCmd[MAX_OLE_STR];
-
- ! sprintf (VimCmd, ":cd %s%s%s\n", Drive, DirUnix,
- ! g_ChangeDir == CD_SOURCE_PARENT && DirUnix[1] ? ".." : "");
- VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf));
- }
-
- *** ../vim-6.2.176/src/VisVim/VisVim.rc Sat Mar 9 19:45:58 2002
- --- src/VisVim/VisVim.rc Thu Jan 8 21:40:29 2004
- ***************
- *** 116,122 ****
-
- IDD_ADDINMAIN DIALOG DISCARDABLE 0, 0, 178, 124
- STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
- ! CAPTION "Vim Add-In 1.3a"
- FONT 8, "MS Sans Serif"
- BEGIN
- CONTROL "&Open file in DevStudio editor simultaneously",
- --- 116,122 ----
-
- IDD_ADDINMAIN DIALOG DISCARDABLE 0, 0, 178, 124
- STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
- ! CAPTION "Vim Add-In 1.4"
- FONT 8, "MS Sans Serif"
- BEGIN
- CONTROL "&Open file in DevStudio editor simultaneously",
- *** ../vim-6.2.176/src/version.c Fri Jan 9 15:02:40 2004
- --- src/version.c Fri Jan 9 15:06:32 2004
- ***************
- *** 639,640 ****
- --- 639,642 ----
- { /* Add new patch number below this line */
- + /**/
- + 177,
- /**/
-
- --
- hundred-and-one symptoms of being an internet addict:
- 208. Your goals for the future are obtaining an T1 connection and
- a 130 gig hard drive.
-
- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
- /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
- \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
- \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
-