comparison src/os_win32.c @ 3634:286ba0251c0a v7.3.577

updated for version 7.3.577 Problem: Size of memory does not fit in 32 bit unsigned. Solution: Use Kbyte instead of byte. Call GlobalMemoryStatusEx() instead of GlobalMemoryStatus() when available.
author Bram Moolenaar <bram@vim.org>
date Fri, 29 Jun 2012 15:51:30 +0200
parents 43fd3896fab7
children 4873d9c4ad3b
comparison
equal deleted inserted replaced
3633:79053041fb31 3634:286ba0251c0a
4990 #endif 4990 #endif
4991 } 4991 }
4992 4992
4993 4993
4994 /* 4994 /*
4995 * How much memory is available? 4995 * How much memory is available in Kbyte?
4996 * Return sum of available physical and page file memory. 4996 * Return sum of available physical and page file memory.
4997 */ 4997 */
4998 /*ARGSUSED*/ 4998 /*ARGSUSED*/
4999 long_u 4999 long_u
5000 mch_avail_mem(int special) 5000 mch_avail_mem(int special)
5001 { 5001 {
5002 MEMORYSTATUS ms; 5002 if (g_PlatformId != VER_PLATFORM_WIN32_NT)
5003 5003 {
5004 ms.dwLength = sizeof(MEMORYSTATUS); 5004 MEMORYSTATUS ms;
5005 GlobalMemoryStatus(&ms); 5005
5006 return (long_u) (ms.dwAvailPhys + ms.dwAvailPageFile); 5006 ms.dwLength = sizeof(MEMORYSTATUS);
5007 GlobalMemoryStatus(&ms);
5008 return (long_u)((ms.dwAvailPhys + ms.dwAvailPageFile) >> 10);
5009 }
5010 else
5011 {
5012 MEMORYSTATUSEX ms;
5013
5014 ms.dwLength = sizeof(MEMORYSTATUSEX);
5015 GlobalMemoryStatusEx(&ms);
5016 return (long_u)((ms.ullAvailPhys + ms.ullAvailPageFile) >> 10);
5017 }
5007 } 5018 }
5008 5019
5009 #ifdef FEAT_MBYTE 5020 #ifdef FEAT_MBYTE
5010 /* 5021 /*
5011 * Same code as below, but with wide functions and no comments. 5022 * Same code as below, but with wide functions and no comments.