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

Patch 6.2.060 (extra)

Expand Messages
  • Bram Moolenaar
    Patch 6.2.060 (extra) Problem: Win32: When encoding is set to iso-8859-7 copy/paste to/from the clipboard gives a lalloc(0) error. (Kriton Kyrimis)
    Message 1 of 1 , Aug 4, 2003
    • 0 Attachment
      Patch 6.2.060 (extra)
      Problem: Win32: When 'encoding' is set to "iso-8859-7" copy/paste to/from
      the clipboard gives a lalloc(0) error. (Kriton Kyrimis)
      Solution: When the string length is zero allocate one byte. Also fix that
      when the length of the Unicode text is zero (conversion from
      'encoding' to UCS-2 was not possible) the normal text is used.
      Files: src/os_mswin.c


      *** ../vim-6.2.059/src/os_mswin.c Sat Jul 26 19:49:46 2003
      --- src/os_mswin.c Mon Aug 4 21:58:37 2003
      ***************
      *** 944,950 ****
      char_u *ret;
      char_u *retp;

      ! ret = lalloc((long_u)str_len, TRUE);
      if (ret != NULL)
      {
      retp = ret;
      --- 944,951 ----
      char_u *ret;
      char_u *retp;

      ! /* Avoid allocating zero bytes, it generates an error message. */
      ! ret = lalloc((long_u)(str_len == 0 ? 1 : str_len), TRUE);
      if (ret != NULL)
      {
      retp = ret;
      ***************
      *** 1014,1020 ****
      convert_setup(&conv, NULL, NULL);

      length = utf8_to_ucs2(str, *lenp, NULL);
      ! ret = (WCHAR *)alloc((unsigned)(length * sizeof(WCHAR)));
      if (ret != NULL)
      utf8_to_ucs2(str, *lenp, (short_u *)ret);

      --- 1015,1022 ----
      convert_setup(&conv, NULL, NULL);

      length = utf8_to_ucs2(str, *lenp, NULL);
      ! ret = (WCHAR *)alloc((unsigned)((length == 0 ? 1 : length)
      ! * sizeof(WCHAR)));
      if (ret != NULL)
      utf8_to_ucs2(str, *lenp, (short_u *)ret);

      ***************
      *** 1057,1063 ****
      return enc_str;
      }

      ! utf8_str = alloc(ucs2_to_utf8(str, *lenp, NULL));
      if (utf8_str != NULL)
      {
      *lenp = ucs2_to_utf8(str, *lenp, utf8_str);
      --- 1059,1066 ----
      return enc_str;
      }

      ! /* Avoid allocating zero bytes, it generates an error message. */
      ! utf8_str = alloc(ucs2_to_utf8(str, *lenp == 0 ? 1 : *lenp, NULL));
      if (utf8_str != NULL)
      {
      *lenp = ucs2_to_utf8(str, *lenp, utf8_str);
      ***************
      *** 1133,1140 ****
      }

      #if defined(FEAT_MBYTE) && defined(WIN3264)
      ! /* Try to get the clipboard in Unicode. */
      ! if (IsClipboardFormatAvailable(CF_UNICODETEXT))
      {
      HGLOBAL hMemW;

      --- 1136,1143 ----
      }

      #if defined(FEAT_MBYTE) && defined(WIN3264)
      ! /* Try to get the clipboard in Unicode if it's not an empty string. */
      ! if (IsClipboardFormatAvailable(CF_UNICODETEXT) && metadata.ucslen != 0)
      {
      HGLOBAL hMemW;

      ***************
      *** 1277,1283 ****
      metadata.txtlen = WideCharToMultiByte(GetACP(), 0, out, len,
      NULL, 0, 0, 0);
      vim_free(str);
      ! str = (char_u *)alloc((unsigned)metadata.txtlen);
      if (str == NULL)
      {
      vim_free(out);
      --- 1280,1287 ----
      metadata.txtlen = WideCharToMultiByte(GetACP(), 0, out, len,
      NULL, 0, 0, 0);
      vim_free(str);
      ! str = (char_u *)alloc((unsigned)(metadata.txtlen == 0 ? 1
      ! : metadata.txtlen));
      if (str == NULL)
      {
      vim_free(out);
      *** ../vim-6.2.059/src/version.c Mon Aug 4 20:55:46 2003
      --- src/version.c Mon Aug 4 22:02:57 2003
      ***************
      *** 632,633 ****
      --- 632,635 ----
      { /* Add new patch number below this line */
      + /**/
      + 60,
      /**/

      --
      I wonder how much deeper the ocean would be without sponges.

      /// 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 here: http://ICCF-Holland.org/click1.html ///
    Your message has been successfully submitted and would be delivered to recipients shortly.