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

Re: Minor vim-mingw bug

Expand Messages
  • Mike Steed
    ... the ... out ... and ... that ... I ... is. Currently, toupper() and tolower() always use the tables under Windows -- regardless of the compiler (see
    Message 1 of 4 , Jun 17, 1905
    • 0 Attachment
      Bram Moolenaar <Bram@...> wrote:
      >
      > Mike Steed wrote:
      >
      > > Here is an interesting bug in gvim built with the mingw32 tools.
      > >
      > > The symptom is that if I run "gvim -" to capture stdin, I get a dialog
      > > that says
      > >
      > > Argument not supported: "-register"; Use the OLE version.
      > >
      > > (And in fact, any cmdline args that start with '-' will produce this
      > > behavior, which disables most of the useful ones!)
      >
      > [useful explanation removed]
      >
      > Good point. This way of implementing toupper() and tolower() was to avoid
      the
      > very slow variants of them in MS Visual C. They need to be fast for Vim.
      >
      > A simple and reliable solution is to move the initialization of the tables
      out
      > of mch_check_win() into a separate function, which is called early from
      > main(). I'll make a patch for that.
      >
      > > This happens with the mingw32 tools because in os_win32.h, HAVE_STRICMP
      and
      > > HAVE_STRNICMP are not defined if __GNUC__ is defined.
      >
      > This looks strange, perhaps it was meant to be the other way around, so
      that
      > the tables are used for MS VC? Anyway, it's a bit risky to change this now,
      I
      > rather make a safe change. Unless someone knows why this was made as it
      is.

      Currently, toupper() and tolower() always use the tables under Windows --
      regardless of the compiler (see globals.h line ~612 and mch_check_win() in
      os_win32.c).

      The #ifndef __GNUC__ affects only the implementation of stricmp() and
      strnicmp() (Vim's implementation or the C lib implementation). Perhaps this
      reduces the risk sufficiently? An added bonus is that it reduces the size of
      the executable by 500 bytes. :-)

      Mike.


      ____________________________________________________________________
      Get free email and a permanent address at http://www.netaddress.com/?N=1
    Your message has been successfully submitted and would be delivered to recipients shortly.