Loading ...
Sorry, an error occurred while loading the content.

Patch 6.2f.033

Expand Messages
  • Bram Moolenaar
    Patch 6.2f.033 Problem: Cscope: re-entrance problem for :cscope command. Checking for duplicate database didn t work well for Win95. Didn t check for
    Message 1 of 1 , May 30 2:39 PM
    • 0 Attachment
      Patch 6.2f.033
      Problem: Cscope: re-entrance problem for ":cscope" command. Checking for
      duplicate database didn't work well for Win95. Didn't check for
      duplicate databases after an empty entry.
      Solution: Don't set postponed_split too early. Remember first empty
      database entry. (Sergey Khorev)
      Files: src/if_cscope.c


      *** ../vim-6.2f.032/src/if_cscope.c Fri May 30 12:13:02 2003
      --- src/if_cscope.c Fri May 30 23:16:45 2003
      ***************
      *** 43,48 ****
      --- 43,49 ----
      static int cs_cnt_matches __ARGS((int idx));
      static char * cs_create_cmd __ARGS((char *csoption, char *pattern));
      static int cs_create_connection __ARGS((int i));
      + static void do_cscope_general __ARGS((exarg_T *eap, int make_split));
      static void cs_file_results __ARGS((FILE *, int *));
      static void cs_fill_results __ARGS((char *, int , int *, char ***,
      char ***, int *));
      ***************
      *** 95,112 ****
      }

      /*
      ! * PUBLIC functions
      ! ****************************************************************************/
      !
      ! /*
      ! * PUBLIC: do_cscope
      *
      * find the command, print help if invalid, and the then call the
      ! * corresponding command function
      */
      ! void
      ! do_cscope(eap)
      ! exarg_T *eap;
      {
      cscmd_T *cmdp;

      --- 96,111 ----
      }

      /*
      ! * PRIVATE: do_cscope_general
      *
      * find the command, print help if invalid, and the then call the
      ! * corresponding command function,
      ! * called from do_cscope and do_scscope
      */
      ! static void
      ! do_cscope_general(eap, make_split)
      ! exarg_T *eap;
      ! int make_split; /* whether to split window */
      {
      cscmd_T *cmdp;

      ***************
      *** 114,139 ****
      if ((cmdp = cs_lookup_cmd(eap)) == NULL)
      {
      cs_help(eap);
      - #ifdef FEAT_WINDOWS
      - postponed_split = 0;
      - #endif
      return;
      }

      #ifdef FEAT_WINDOWS
      ! if (postponed_split && !cmdp->cansplit)
      {
      ! (void)MSG_PUTS(_("This cscope command does not support splitting the window.\n"));
      ! postponed_split = 0;
      ! return;
      }
      #endif

      cmdp->func(eap);
      ! #ifdef FEAT_WINDOWS
      ! postponed_split = 0; /* restore state */
      ! #endif
      ! } /* do_cscope */

      /*
      * PUBLIC: do_scscope
      --- 113,145 ----
      if ((cmdp = cs_lookup_cmd(eap)) == NULL)
      {
      cs_help(eap);
      return;
      }

      #ifdef FEAT_WINDOWS
      ! if (make_split)
      {
      ! if (!cmdp->cansplit)
      ! {
      ! (void)MSG_PUTS(_("This cscope command does not support splitting the window.\n"));
      ! return;
      ! }
      ! postponed_split = -1;
      }
      #endif

      cmdp->func(eap);
      ! }
      !
      ! /*
      ! * PUBLIC: do_cscope
      ! */
      ! void
      ! do_cscope(eap)
      ! exarg_T *eap;
      ! {
      ! do_cscope_general(eap, FALSE);
      ! }

      /*
      * PUBLIC: do_scscope
      ***************
      *** 144,153 ****
      do_scscope(eap)
      exarg_T *eap;
      {
      ! #ifdef FEAT_WINDOWS
      ! postponed_split = -1;
      ! #endif
      ! do_cscope(eap);
      }

      /*
      --- 150,156 ----
      do_scscope(eap)
      exarg_T *eap;
      {
      ! do_cscope_general(eap, TRUE);
      }

      /*
      ***************
      *** 1211,1259 ****
      char *flags;
      struct stat *sb;
      {
      ! short i;
      #ifndef UNIX
      ! HANDLE hFile;
      BY_HANDLE_FILE_INFORMATION bhfi;
      ! hFile = CreateFile (fname, GENERIC_READ, 0, NULL, OPEN_EXISTING,
      ! FILE_ATTRIBUTE_NORMAL, NULL);
      ! if (hFile == INVALID_HANDLE_VALUE)
      ! {
      ! if (p_csverbose)
      {
      ! char *cant_msg = _("E625: cannot open cscope database: %s");
      ! char *winmsg = GetWin32Error();
      ! if (winmsg != NULL)
      {
      ! (void)EMSG2(cant_msg, winmsg);
      ! LocalFree(winmsg);
      }
      ! else
      ! /* subst filename if can't get error text */
      ! (void)EMSG2(cant_msg, fname);
      }
      - return -1;
      - }
      - if (!GetFileInformationByHandle(hFile, &bhfi))
      - {
      CloseHandle(hFile);
      - if (p_csverbose)
      - (void)EMSG(_("E626: cannot get cscope database information"));
      - return -1;
      }
      - else
      - CloseHandle(hFile);
      #endif

      ! for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
      {
      ! if (csinfo[i].fname
      #if defined(UNIX)
      ! && csinfo[i].st_dev == sb->st_dev && csinfo[i].st_ino == sb->st_ino
      #else
      ! && csinfo[i].nVolume == bhfi.dwVolumeSerialNumber
      ! && csinfo[i].nIndexHigh == bhfi.nFileIndexHigh
      ! && csinfo[i].nIndexLow == bhfi.nFileIndexLow
      #endif
      )
      {
      --- 1214,1273 ----
      char *flags;
      struct stat *sb;
      {
      ! short i, j;
      #ifndef UNIX
      ! HANDLE hFile;
      BY_HANDLE_FILE_INFORMATION bhfi;
      !
      ! vim_memset(&bhfi, 0, sizeof(bhfi));
      ! /* On windows 9x GetFileInformationByHandle doesn't work, so skip it */
      ! if (!mch_windows95())
      ! {
      ! hFile = CreateFile(fname, FILE_READ_ATTRIBUTES, 0, NULL, OPEN_EXISTING,
      ! FILE_ATTRIBUTE_NORMAL, NULL);
      ! if (hFile == INVALID_HANDLE_VALUE)
      {
      ! if (p_csverbose)
      {
      ! char *cant_msg = _("E625: cannot open cscope database: %s");
      ! char *winmsg = GetWin32Error();
      !
      ! if (winmsg != NULL)
      ! {
      ! (void)EMSG2(cant_msg, winmsg);
      ! LocalFree(winmsg);
      ! }
      ! else
      ! /* subst filename if can't get error text */
      ! (void)EMSG2(cant_msg, fname);
      }
      ! return -1;
      ! }
      ! if (!GetFileInformationByHandle(hFile, &bhfi))
      ! {
      ! CloseHandle(hFile);
      ! if (p_csverbose)
      ! (void)EMSG(_("E626: cannot get cscope database information"));
      ! return -1;
      }
      CloseHandle(hFile);
      }
      #endif

      ! i = -1; /* can be set to the index of an empty item in csinfo */
      ! for (j = 0; j < CSCOPE_MAX_CONNECTIONS; j++)
      {
      ! if (csinfo[j].fname != NULL
      #if defined(UNIX)
      ! && csinfo[j].st_dev == sb->st_dev && csinfo[j].st_ino == sb->st_ino
      #else
      ! /* compare pathnames first */
      ! && ((fullpathcmp(csinfo[j].fname, fname, FALSE) & FPC_SAME)
      ! /* if not Windows 9x, test index file atributes too */
      ! || (!mch_windows95()
      ! && csinfo[j].nVolume == bhfi.dwVolumeSerialNumber
      ! && csinfo[j].nIndexHigh == bhfi.nFileIndexHigh
      ! && csinfo[j].nIndexLow == bhfi.nFileIndexLow))
      #endif
      )
      {
      ***************
      *** 1262,1272 ****
      return -1;
      }

      ! if (csinfo[i].fname == NULL)
      ! break;
      }

      ! if (i == CSCOPE_MAX_CONNECTIONS)
      {
      if (p_csverbose)
      (void)EMSG(_("E569: maximum number of cscope connections reached"));
      --- 1276,1286 ----
      return -1;
      }

      ! if (csinfo[j].fname == NULL && i == -1)
      ! i = j; /* remember first empty entry */
      }

      ! if (i == -1)
      {
      if (p_csverbose)
      (void)EMSG(_("E569: maximum number of cscope connections reached"));
      *** ../vim-6.2f.032/src/version.c Fri May 30 21:54:48 2003
      --- src/version.c Fri May 30 23:21:28 2003
      ***************
      *** 632,633 ****
      --- 632,635 ----
      { /* Add new patch number below this line */
      + /**/
      + 33,
      /**/

      --
      Give a man a computer program and you give him a headache,
      but teach him to program computers and you give him the power
      to create headaches for others for the rest of his life...
      R. B. Forest

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
    Your message has been successfully submitted and would be delivered to recipients shortly.