home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / old / 5.4.36 < prev    next >
Encoding:
Internet Message Format  |  1999-08-18  |  4.6 KB

  1. To: Mike Steed <mrsteed@usa.net>
  2. In-Reply-To: <19990818231828.6484.qmail@www0j.netaddress.usa.net>
  3. Cc: vim-dev@vim.org
  4. Subject: patch 5.4.36 (was: [Comparing strings?])
  5. Fcc: outbox
  6. From: Bram Moolenaar <Bram@moolenaar.net>
  7. ------------
  8.  
  9. Mike Steed wrote:
  10.  
  11. > Okay, I think I found the problem.  My build of Vim had
  12. >    #define STRICMP(d, s)   vim_stricmp((char *)(d), (char *)(s))
  13. > And it turns out that vim_stricmp() returns 0 when d == s, and 1 when d != s. 
  14. > Shouldn't this routine be fixed to behave like strcasecmp() -- to return -1,
  15. > 0, or 1, telling whether d < s, d == s, or d > s?
  16.  
  17. Yes, this needs to be fixed.  But I don't understand why your build was using
  18. vim_stricmp().  On Win32 the library stricmp() should have been used.  In
  19. fact, most machines would not use this.
  20.  
  21.  
  22. Patch 5.4.36
  23. Problem:    Comparing strings while ignoring case didn't work correctly for
  24.         some machines. (Mide Steed)
  25. Solution:   vim_stricmp() and vim_strnicmp() only returned 0 or 1.  Changed
  26.         them to return -1 when the first argument is smaller.
  27. Files:        src/misc2.c
  28.  
  29.  
  30. *** ../vim-5.4.35/src/misc2.c    Fri Jul  2 21:59:18 1999
  31. --- src/misc2.c    Thu Aug 19 12:03:13 1999
  32. ***************
  33. *** 954,970 ****
  34.   #if (!defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP)) || defined(PROTO)
  35.   /*
  36.    * Compare two strings, ignoring case.
  37. !  * return 0 for match, 1 for difference
  38.    */
  39.       int
  40.   vim_stricmp(s1, s2)
  41. !     char    *s1;
  42. !     char    *s2;
  43.   {
  44.       for (;;)
  45.       {
  46. !     if (TO_LOWER(*s1) != TO_LOWER(*s2))
  47. !         return 1;                /* this character different */
  48.       if (*s1 == NUL)
  49.           break;                /* strings match until NUL */
  50.       ++s1;
  51. --- 954,973 ----
  52.   #if (!defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP)) || defined(PROTO)
  53.   /*
  54.    * Compare two strings, ignoring case.
  55. !  * return 0 for match, < 0 for smaller, > 0 for bigger
  56.    */
  57.       int
  58.   vim_stricmp(s1, s2)
  59. !     char    *s1;
  60. !     char    *s2;
  61.   {
  62. +     int        i;
  63.       for (;;)
  64.       {
  65. !     i = (int)TO_LOWER(*s1) - (int)TO_LOWER(*s2);
  66. !     if (i != 0)
  67. !         return i;                /* this character different */
  68.       if (*s1 == NUL)
  69.           break;                /* strings match until NUL */
  70.       ++s1;
  71. ***************
  72. *** 977,994 ****
  73.   #if (!defined(HAVE_STRNCASECMP) && !defined(HAVE_STRNICMP)) || defined(PROTO)
  74.   /*
  75.    * Compare two strings, for length "len", ignoring case.
  76. !  * return 0 for match, 1 for difference
  77.    */
  78.       int
  79.   vim_strnicmp(s1, s2, len)
  80. !     char    *s1;
  81. !     char    *s2;
  82. !     size_t  len;
  83.   {
  84. !     while (len)
  85.       {
  86. !     if (TO_LOWER(*s1) != TO_LOWER(*s2))
  87. !         return 1;                /* this character different */
  88.       if (*s1 == NUL)
  89.           break;                /* strings match until NUL */
  90.       ++s1;
  91. --- 980,1000 ----
  92.   #if (!defined(HAVE_STRNCASECMP) && !defined(HAVE_STRNICMP)) || defined(PROTO)
  93.   /*
  94.    * Compare two strings, for length "len", ignoring case.
  95. !  * return 0 for match, < 0 for smaller, > 0 for bigger
  96.    */
  97.       int
  98.   vim_strnicmp(s1, s2, len)
  99. !     char    *s1;
  100. !     char    *s2;
  101. !     size_t    len;
  102.   {
  103. !     int        i;
  104. !     while (len > 0)
  105.       {
  106. !     i = (int)TO_LOWER(*s1) - (int)TO_LOWER(*s2);
  107. !     if (i != 0)
  108. !         return i;                /* this character different */
  109.       if (*s1 == NUL)
  110.           break;                /* strings match until NUL */
  111.       ++s1;
  112. *** ../vim-5.4.35/src/version.h    Wed Aug 18 13:05:54 1999
  113. --- src/version.h    Thu Aug 19 11:51:10 1999
  114. ***************
  115. *** 19,26 ****
  116.   #define VIM_VERSION_MINOR_STR        "4"
  117.   #define VIM_VERSION_BUILD         57
  118.   #define VIM_VERSION_BUILD_STR        "57"
  119. ! #define VIM_VERSION_PATCHLEVEL         35
  120. ! #define VIM_VERSION_PATCHLEVEL_STR    "35"
  121.   
  122.   /*
  123.    * VIM_VERSION_NODOT is used for the runtime directory name.
  124. --- 19,26 ----
  125.   #define VIM_VERSION_MINOR_STR        "4"
  126.   #define VIM_VERSION_BUILD         57
  127.   #define VIM_VERSION_BUILD_STR        "57"
  128. ! #define VIM_VERSION_PATCHLEVEL         36
  129. ! #define VIM_VERSION_PATCHLEVEL_STR    "36"
  130.   
  131.   /*
  132.    * VIM_VERSION_NODOT is used for the runtime directory name.
  133. ***************
  134. *** 30,35 ****
  135.    */
  136.   #define VIM_VERSION_NODOT    "vim54"
  137.   #define VIM_VERSION_SHORT    "5.4"
  138. ! #define VIM_VERSION_MEDIUM    "5.4.35"
  139. ! #define VIM_VERSION_LONG    "VIM - Vi IMproved 5.4.35 (1999 Aug 18)"
  140. ! #define VIM_VERSION_LONG_DATE    "VIM - Vi IMproved 5.4.35 (1999 Aug 18, compiled "
  141. --- 30,35 ----
  142.    */
  143.   #define VIM_VERSION_NODOT    "vim54"
  144.   #define VIM_VERSION_SHORT    "5.4"
  145. ! #define VIM_VERSION_MEDIUM    "5.4.36"
  146. ! #define VIM_VERSION_LONG    "VIM - Vi IMproved 5.4.36 (1999 Aug 19)"
  147. ! #define VIM_VERSION_LONG_DATE    "VIM - Vi IMproved 5.4.36 (1999 Aug 19, compiled "
  148.  
  149. --
  150. hundred-and-one symptoms of being an internet addict:
  151. 147. You finally give up smoking...because it made the monitor dirty.
  152.  
  153. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\--
  154.   \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /
  155.