Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.3.605
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.605 (after 7.3.577)
Problem:    MS-Windows: Can't compile with older compilers. (Titov Anatoly)
Solution:   Add #ifdef for MEMORYSTATUSEX.
Files:	    src/os_win32.c


*** ../vim-7.3.604/src/os_win32.c	2012-06-29 15:51:26.000000000 +0200
--- src/os_win32.c	2012-07-19 11:35:00.000000000 +0200
***************
*** 4999,5020 ****
      long_u
  mch_avail_mem(int special)
  {
!     if (g_PlatformId != VER_PLATFORM_WIN32_NT)
!     {
! 	MEMORYSTATUS	ms;
! 
! 	ms.dwLength = sizeof(MEMORYSTATUS);
! 	GlobalMemoryStatus(&ms);
! 	return (long_u)((ms.dwAvailPhys + ms.dwAvailPageFile) >> 10);
!     }
!     else
      {
  	MEMORYSTATUSEX	ms;
  
  	ms.dwLength = sizeof(MEMORYSTATUSEX);
  	GlobalMemoryStatusEx(&ms);
  	return (long_u)((ms.ullAvailPhys + ms.ullAvailPageFile) >> 10);
      }
  }
  
  #ifdef FEAT_MBYTE
--- 4999,5025 ----
      long_u
  mch_avail_mem(int special)
  {
! #ifdef MEMORYSTATUSEX
!     PlatformId();
!     if (g_PlatformId == VER_PLATFORM_WIN32_NT)
      {
  	MEMORYSTATUSEX	ms;
  
+ 	/* Need to use GlobalMemoryStatusEx() when there is more memory than
+ 	 * what fits in 32 bits. But it's not always available. */
  	ms.dwLength = sizeof(MEMORYSTATUSEX);
  	GlobalMemoryStatusEx(&ms);
  	return (long_u)((ms.ullAvailPhys + ms.ullAvailPageFile) >> 10);
      }
+     else
+ #endif
+     {
+ 	MEMORYSTATUS	ms;
+ 
+ 	ms.dwLength = sizeof(MEMORYSTATUS);
+ 	GlobalMemoryStatus(&ms);
+ 	return (long_u)((ms.dwAvailPhys + ms.dwAvailPageFile) >> 10);
+     }
  }
  
  #ifdef FEAT_MBYTE
*** ../vim-7.3.604/src/version.c	2012-07-16 19:27:25.000000000 +0200
--- src/version.c	2012-07-19 11:36:12.000000000 +0200
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     605,
  /**/

-- 
Fingers not found - Pound head on keyboard to continue.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///