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:
Vadim Zeitlin 2006-02-11 16:21:14 +00:00
parent 34af0de434
commit 7ba7c4e62f
6 changed files with 32 additions and 18 deletions

View File

@ -449,10 +449,16 @@ WXDLLIMPEXP_BASE const wxMB2WXbuf wxGetUserHome(const wxString& user = wxEmptySt
WXDLLIMPEXP_BASE wxChar* wxGetUserHome(const wxString& user = wxEmptyString);
#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
WXDLLIMPEXP_BASE bool wxGetDiskSpace(const wxString& path,
wxLongLong *pTotal = NULL,
wxLongLong *pFree = NULL);
wxDiskspaceSize_t *pTotal = NULL,
wxDiskspaceSize_t *pFree = NULL);
#if wxUSE_GUI // GUI only things from now on

View File

@ -644,7 +644,7 @@ wxChar *wxGetUserHome (const wxString& user)
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() )
return false;
@ -674,9 +674,9 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
if ( noErr == err )
{
if ( pTotal )
*pTotal = wxLongLong( totalBytes ) ;
*pTotal = wxDiskspaceSize_t( totalBytes ) ;
if ( pFree )
*pFree = wxLongLong( freeBytes ) ;
*pFree = wxDiskspaceSize_t( freeBytes ) ;
}
}
}

View File

@ -529,7 +529,7 @@ wxChar *wxGetUserHome (const wxString& user)
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() )
return false;
@ -553,10 +553,10 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
OSErr err = XGetVolumeInfoNoName( volumeName , 0 , &pb ) ;
if ( err == noErr ) {
if ( pTotal ) {
(*pTotal) = wxLongLong( pb.ioVTotalBytes ) ;
(*pTotal) = wxDiskspaceSize_t( pb.ioVTotalBytes ) ;
}
if ( pFree ) {
(*pFree) = wxLongLong( pb.ioVFreeBytes ) ;
(*pFree) = wxDiskspaceSize_t( pb.ioVFreeBytes ) ;
}
}

View File

@ -480,8 +480,8 @@ wxChar *wxGetUserHome(const wxString& WXUNUSED(user))
}
bool wxGetDiskSpace(const wxString& WXUNUSED_IN_WINCE(path),
wxLongLong *WXUNUSED_IN_WINCE(pTotal),
wxLongLong *WXUNUSED_IN_WINCE(pFree))
wxDiskspaceSize_t *WXUNUSED_IN_WINCE(pTotal),
wxDiskspaceSize_t *WXUNUSED_IN_WINCE(pFree))
{
#ifdef __WXWINCE__
// TODO-CE
@ -536,12 +536,20 @@ bool wxGetDiskSpace(const wxString& WXUNUSED_IN_WINCE(path),
#endif
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 wxUSE_LONGLONG
*pFree = wxLongLong(UL(bytesFree).HighPart, UL(bytesFree).LowPart);
#else
*pFree = wxDiskspaceSize_t(UL(bytesFree).LowPart);
#endif
}
}
else
@ -569,7 +577,7 @@ bool wxGetDiskSpace(const wxString& WXUNUSED_IN_WINCE(path),
return false;
}
wxLongLong lBytesPerCluster = lSectorsPerCluster;
wxDiskspaceSize_t lBytesPerCluster = (wxDiskspaceSize_t) lSectorsPerCluster;
lBytesPerCluster *= lBytesPerSector;
if ( pTotal )

View File

@ -107,7 +107,7 @@ wxChar *wxGetUserHome(const wxString& WXUNUSED(user))
return NULL;
}
bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
bool wxGetDiskSpace(const wxString& path, wxDiskspaceSize_t *pTotal, wxDiskspaceSize_t *pFree)
{
return false;
}

View File

@ -927,7 +927,7 @@ wxMemorySize wxGetFreeMemory()
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)
// 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
// which is in general a multiple of f_frsize
#ifdef HAVE_STATVFS
wxLongLong blockSize = fs.f_frsize;
wxDiskspaceSize_t blockSize = fs.f_frsize;
#else // HAVE_STATFS
wxLongLong blockSize = fs.f_bsize;
wxDiskspaceSize_t blockSize = fs.f_bsize;
#endif // HAVE_STATVFS/HAVE_STATFS
if ( pTotal )
{
*pTotal = wxLongLong(fs.f_blocks) * blockSize;
*pTotal = wxDiskspaceSize_t(fs.f_blocks) * blockSize;
}
if ( pFree )
{
*pFree = wxLongLong(fs.f_bavail) * blockSize;
*pFree = wxDiskspaceSize_t(fs.f_bavail) * blockSize;
}
return true;