CVS update: php3/functions

From: Date: Fri, 15 Jan 1999 12:06:39 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-3567@lists.php.net to get a copy of this message
Date: Friday January 15, 1999 @ 7:06 Author: thies Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv13822 Modified Files: filestat.c Log Message: added win32 support from MSDN: The GetDiskFreeSpaceEx function is available beginning with Windows 95 OEM Service Release 2 (OSR2). Index: php3/functions/filestat.c diff -c php3/functions/filestat.c:1.84 php3/functions/filestat.c:1.85 *** php3/functions/filestat.c:1.84 Fri Jan 15 05:55:17 1999 --- php3/functions/filestat.c Fri Jan 15 07:06:37 1999 *************** *** 27,33 **** +----------------------------------------------------------------------+ */ ! /* $Id: filestat.c,v 1.84 1999/01/15 10:55:17 thies Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif --- 27,33 ---- +----------------------------------------------------------------------+ */ ! /* $Id: filestat.c,v 1.85 1999/01/15 12:06:37 thies Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif *************** *** 125,131 **** --- 125,139 ---- return number of kilobytes free in path */ void php3_diskfreespace(INTERNAL_FUNCTION_PARAMETERS) { + #ifdef WINDOWS pval *path; + double bytesfree; + + ULARGE_INTEGER FreeBytesAvailableToCaller; + ULARGE_INTEGER TotalNumberOfBytes; + ULARGE_INTEGER TotalNumberOfFreeBytes; + #else /* not - WINDOWS */ + pval *path; #if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS) struct statvfs buf; #elif defined(HAVE_SYS_STATFS_H) && defined(HAVE_STATFS) *************** *** 133,138 **** --- 141,147 ---- #endif double bytesfree; TLS_VARS; + #endif /* WINDOWS */ if (ARG_COUNT(ht)!=1 || getParameters(ht,1,&path)==FAILURE) { WRONG_PARAM_COUNT; *************** *** 142,147 **** --- 151,167 ---- if (_php3_check_open_basedir(path->value.str.val)) RETURN_FALSE; + #ifdef WINDOWS + if (GetDiskFreeSpaceEx(path->value.str.val, + &FreeBytesAvailableToCaller, + &TotalNumberOfBytes, + &TotalNumberOfFreeBytes) == 0) RETURN_FALSE; + + /* i know - thies is ugly, but i works (thies@digicol.de) */ + bytesfree = FreeBytesAvailableToCaller.HighPart * + (double) (((unsigned long)1) << 31) * 2.0 + + FreeBytesAvailableToCaller.LowPart; + #else /* WINDOWS */ #if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS) if (statvfs(path->value.str.val,&buf)) RETURN_FALSE; bytesfree = (((double)buf.f_bavail) * ((double)buf.f_frsize)); *************** *** 149,154 **** --- 169,176 ---- if (statfs(path->value.str.val,&buf)) RETURN_FALSE; bytesfree = (((double)buf.f_bsize) * ((double)buf.f_bavail)); #endif + #endif /* WINDOWS */ + RETURN_DOUBLE(bytesfree); } -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#3567) next »