use wxDiskspaceSize_t which is long and not wxLongLong if wxUSE_LONGLONG==0 (part of patch 1203970)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37494 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -449,10 +449,16 @@ WXDLLIMPEXP_BASE const wxMB2WXbuf wxGetUserHome(const wxString& user = wxEmptySt
|
|||||||
WXDLLIMPEXP_BASE wxChar* wxGetUserHome(const wxString& user = wxEmptyString);
|
WXDLLIMPEXP_BASE wxChar* wxGetUserHome(const wxString& user = wxEmptyString);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_LONGLONG
|
||||||
|
typedef wxLongLong wxDiskspaceSize_t;
|
||||||
|
#else
|
||||||
|
typedef long wxDiskspaceSize_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
// get number of total/free bytes on the disk where path belongs
|
// get number of total/free bytes on the disk where path belongs
|
||||||
WXDLLIMPEXP_BASE bool wxGetDiskSpace(const wxString& path,
|
WXDLLIMPEXP_BASE bool wxGetDiskSpace(const wxString& path,
|
||||||
wxLongLong *pTotal = NULL,
|
wxDiskspaceSize_t *pTotal = NULL,
|
||||||
wxLongLong *pFree = NULL);
|
wxDiskspaceSize_t *pFree = NULL);
|
||||||
|
|
||||||
#if wxUSE_GUI // GUI only things from now on
|
#if wxUSE_GUI // GUI only things from now on
|
||||||
|
|
||||||
|
@@ -644,7 +644,7 @@ wxChar *wxGetUserHome (const wxString& user)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
|
bool wxGetDiskSpace(const wxString& path, wxDiskspaceSize_t *pTotal, wxDiskspaceSize_t *pFree)
|
||||||
{
|
{
|
||||||
if ( path.empty() )
|
if ( path.empty() )
|
||||||
return false;
|
return false;
|
||||||
@@ -674,9 +674,9 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
|
|||||||
if ( noErr == err )
|
if ( noErr == err )
|
||||||
{
|
{
|
||||||
if ( pTotal )
|
if ( pTotal )
|
||||||
*pTotal = wxLongLong( totalBytes ) ;
|
*pTotal = wxDiskspaceSize_t( totalBytes ) ;
|
||||||
if ( pFree )
|
if ( pFree )
|
||||||
*pFree = wxLongLong( freeBytes ) ;
|
*pFree = wxDiskspaceSize_t( freeBytes ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -529,7 +529,7 @@ wxChar *wxGetUserHome (const wxString& user)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
|
bool wxGetDiskSpace(const wxString& path, wxDiskspaceSize_t *pTotal, wxDiskspaceSize_t *pFree)
|
||||||
{
|
{
|
||||||
if ( path.empty() )
|
if ( path.empty() )
|
||||||
return false;
|
return false;
|
||||||
@@ -553,10 +553,10 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
|
|||||||
OSErr err = XGetVolumeInfoNoName( volumeName , 0 , &pb ) ;
|
OSErr err = XGetVolumeInfoNoName( volumeName , 0 , &pb ) ;
|
||||||
if ( err == noErr ) {
|
if ( err == noErr ) {
|
||||||
if ( pTotal ) {
|
if ( pTotal ) {
|
||||||
(*pTotal) = wxLongLong( pb.ioVTotalBytes ) ;
|
(*pTotal) = wxDiskspaceSize_t( pb.ioVTotalBytes ) ;
|
||||||
}
|
}
|
||||||
if ( pFree ) {
|
if ( pFree ) {
|
||||||
(*pFree) = wxLongLong( pb.ioVFreeBytes ) ;
|
(*pFree) = wxDiskspaceSize_t( pb.ioVFreeBytes ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -480,8 +480,8 @@ wxChar *wxGetUserHome(const wxString& WXUNUSED(user))
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool wxGetDiskSpace(const wxString& WXUNUSED_IN_WINCE(path),
|
bool wxGetDiskSpace(const wxString& WXUNUSED_IN_WINCE(path),
|
||||||
wxLongLong *WXUNUSED_IN_WINCE(pTotal),
|
wxDiskspaceSize_t *WXUNUSED_IN_WINCE(pTotal),
|
||||||
wxLongLong *WXUNUSED_IN_WINCE(pFree))
|
wxDiskspaceSize_t *WXUNUSED_IN_WINCE(pFree))
|
||||||
{
|
{
|
||||||
#ifdef __WXWINCE__
|
#ifdef __WXWINCE__
|
||||||
// TODO-CE
|
// TODO-CE
|
||||||
@@ -536,12 +536,20 @@ bool wxGetDiskSpace(const wxString& WXUNUSED_IN_WINCE(path),
|
|||||||
#endif
|
#endif
|
||||||
if ( pTotal )
|
if ( pTotal )
|
||||||
{
|
{
|
||||||
*pTotal = wxLongLong(UL(bytesTotal).HighPart, UL(bytesTotal).LowPart);
|
#if wxUSE_LONGLONG
|
||||||
|
*pTotal = wxDiskspaceSize_t(UL(bytesTotal).HighPart, UL(bytesTotal).LowPart);
|
||||||
|
#else
|
||||||
|
*pTotal = wxDiskspaceSize_t(UL(bytesTotal).LowPart);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pFree )
|
if ( pFree )
|
||||||
{
|
{
|
||||||
|
#if wxUSE_LONGLONG
|
||||||
*pFree = wxLongLong(UL(bytesFree).HighPart, UL(bytesFree).LowPart);
|
*pFree = wxLongLong(UL(bytesFree).HighPart, UL(bytesFree).LowPart);
|
||||||
|
#else
|
||||||
|
*pFree = wxDiskspaceSize_t(UL(bytesFree).LowPart);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -569,7 +577,7 @@ bool wxGetDiskSpace(const wxString& WXUNUSED_IN_WINCE(path),
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLongLong lBytesPerCluster = lSectorsPerCluster;
|
wxDiskspaceSize_t lBytesPerCluster = (wxDiskspaceSize_t) lSectorsPerCluster;
|
||||||
lBytesPerCluster *= lBytesPerSector;
|
lBytesPerCluster *= lBytesPerSector;
|
||||||
|
|
||||||
if ( pTotal )
|
if ( pTotal )
|
||||||
|
@@ -107,7 +107,7 @@ wxChar *wxGetUserHome(const wxString& WXUNUSED(user))
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
|
bool wxGetDiskSpace(const wxString& path, wxDiskspaceSize_t *pTotal, wxDiskspaceSize_t *pFree)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -927,7 +927,7 @@ wxMemorySize wxGetFreeMemory()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
|
bool wxGetDiskSpace(const wxString& path, wxDiskspaceSize_t *pTotal, wxDiskspaceSize_t *pFree)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_STATFS) || defined(HAVE_STATVFS)
|
#if defined(HAVE_STATFS) || defined(HAVE_STATVFS)
|
||||||
// the case to "char *" is needed for AIX 4.3
|
// the case to "char *" is needed for AIX 4.3
|
||||||
@@ -942,19 +942,19 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
|
|||||||
// under Solaris we also have to use f_frsize field instead of f_bsize
|
// under Solaris we also have to use f_frsize field instead of f_bsize
|
||||||
// which is in general a multiple of f_frsize
|
// which is in general a multiple of f_frsize
|
||||||
#ifdef HAVE_STATVFS
|
#ifdef HAVE_STATVFS
|
||||||
wxLongLong blockSize = fs.f_frsize;
|
wxDiskspaceSize_t blockSize = fs.f_frsize;
|
||||||
#else // HAVE_STATFS
|
#else // HAVE_STATFS
|
||||||
wxLongLong blockSize = fs.f_bsize;
|
wxDiskspaceSize_t blockSize = fs.f_bsize;
|
||||||
#endif // HAVE_STATVFS/HAVE_STATFS
|
#endif // HAVE_STATVFS/HAVE_STATFS
|
||||||
|
|
||||||
if ( pTotal )
|
if ( pTotal )
|
||||||
{
|
{
|
||||||
*pTotal = wxLongLong(fs.f_blocks) * blockSize;
|
*pTotal = wxDiskspaceSize_t(fs.f_blocks) * blockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pFree )
|
if ( pFree )
|
||||||
{
|
{
|
||||||
*pFree = wxLongLong(fs.f_bavail) * blockSize;
|
*pFree = wxDiskspaceSize_t(fs.f_bavail) * blockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user