1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-04 22:49:07 +02:00

BlockFile::GetSpaceUsage() returns an unsigned value

This commit is contained in:
Paul Licameli 2016-09-05 15:48:08 -04:00
parent 0b31690ace
commit c9bff2f0f4
14 changed files with 22 additions and 18 deletions

View File

@ -634,7 +634,7 @@ void AliasBlockFile::ChangeAliasedFileName(wxFileNameWrapper &&newAliasedFile)
mAliasedFileName = std::move(newAliasedFile); mAliasedFileName = std::move(newAliasedFile);
} }
wxLongLong AliasBlockFile::GetSpaceUsage() const auto AliasBlockFile::GetSpaceUsage() const -> DiskByteCount
{ {
wxFFile summaryFile(mFileName.GetFullPath()); wxFFile summaryFile(mFileName.GetFullPath());
return summaryFile.Length(); return summaryFile.Length();

View File

@ -140,7 +140,9 @@ class PROFILE_DLL_API BlockFile /* not final, abstract */ {
/// Create a NEW BlockFile identical to this, using the given filename /// Create a NEW BlockFile identical to this, using the given filename
virtual BlockFilePtr Copy(wxFileNameWrapper &&newFileName) = 0; virtual BlockFilePtr Copy(wxFileNameWrapper &&newFileName) = 0;
virtual wxLongLong GetSpaceUsage() const = 0; // Report disk space usage.
using DiskByteCount = unsigned long long;
virtual DiskByteCount GetSpaceUsage() const = 0;
/// if the on-disk state disappeared, either recover it (if it was /// if the on-disk state disappeared, either recover it (if it was
//summary only), write out a placeholder of silence data (missing //summary only), write out a placeholder of silence data (missing
@ -223,7 +225,7 @@ class AliasBlockFile /* not final */ : public BlockFile
// Reading // Reading
wxLongLong GetSpaceUsage() const override; DiskByteCount GetSpaceUsage() const override;
/// as SilentLog (which would affect Summary data access), but /// as SilentLog (which would affect Summary data access), but
// applying to Alias file access // applying to Alias file access

View File

@ -106,7 +106,7 @@ void UndoManager::CalculateSpaceUsage()
// in the previous level // in the previous level
if (prev->count( &*file ) == 0 && cur->count( &*file ) == 0) if (prev->count( &*file ) == 0 && cur->count( &*file ) == 0)
{ {
space[i] += file->GetSpaceUsage().GetValue(); space[i] += { file->GetSpaceUsage() };
} }
// Add file to current set // Add file to current set

View File

@ -73,7 +73,7 @@ struct UndoState {
using UndoStack = std::vector <movable_ptr<UndoStackElem>>; using UndoStack = std::vector <movable_ptr<UndoStackElem>>;
using SpaceArray = std::vector <wxLongLong_t> ; using SpaceArray = std::vector <unsigned long long> ;
// These flags control what extra to do on a PushState // These flags control what extra to do on a PushState
// Default is AUTOSAVE // Default is AUTOSAVE

View File

@ -344,7 +344,7 @@ BlockFilePtr LegacyBlockFile::Copy(wxFileNameWrapper &&newFileName)
mLen, mSummaryInfo.fields < 3); mLen, mSummaryInfo.fields < 3);
} }
wxLongLong LegacyBlockFile::GetSpaceUsage() const auto LegacyBlockFile::GetSpaceUsage() const -> DiskByteCount
{ {
wxFFile dataFile(mFileName.GetFullPath()); wxFFile dataFile(mFileName.GetFullPath());
return dataFile.Length(); return dataFile.Length();

View File

@ -57,7 +57,7 @@ class LegacyBlockFile final : public BlockFile {
BlockFilePtr Copy(wxFileNameWrapper &&newFileName) override; BlockFilePtr Copy(wxFileNameWrapper &&newFileName) override;
/// Write an XML representation of this file /// Write an XML representation of this file
void SaveXML(XMLWriter &xmlFile) override; void SaveXML(XMLWriter &xmlFile) override;
wxLongLong GetSpaceUsage() const override; DiskByteCount GetSpaceUsage() const override;
void Recover() override; void Recover() override;
static BlockFilePtr BuildFromXML(const wxString &dir, const wxChar **attrs, static BlockFilePtr BuildFromXML(const wxString &dir, const wxChar **attrs,

View File

@ -77,7 +77,7 @@ ODDecodeBlockFile::~ODDecodeBlockFile()
//Check to see if we have the file for these calls. //Check to see if we have the file for these calls.
wxLongLong ODDecodeBlockFile::GetSpaceUsage() const auto ODDecodeBlockFile::GetSpaceUsage() const -> DiskByteCount
{ {
if(IsSummaryAvailable()) if(IsSummaryAvailable())
{ {

View File

@ -60,7 +60,7 @@ class ODDecodeBlockFile final : public SimpleBlockFile
bool IsSummaryBeingComputed() override { return false; } bool IsSummaryBeingComputed() override { return false; }
//Calls that rely on summary files need to be overidden //Calls that rely on summary files need to be overidden
wxLongLong GetSpaceUsage() const override; DiskByteCount GetSpaceUsage() const override;
/// Gets extreme values for the specified region /// Gets extreme values for the specified region
void GetMinMax(sampleCount start, sampleCount len, void GetMinMax(sampleCount start, sampleCount len,
float *outMin, float *outMax, float *outRMS) const override; float *outMin, float *outMax, float *outRMS) const override;

View File

@ -77,11 +77,11 @@ ODPCMAliasBlockFile::~ODPCMAliasBlockFile()
//Check to see if we have the file for these calls. //Check to see if we have the file for these calls.
wxLongLong ODPCMAliasBlockFile::GetSpaceUsage() const auto ODPCMAliasBlockFile::GetSpaceUsage() const -> DiskByteCount
{ {
if(IsSummaryAvailable()) if(IsSummaryAvailable())
{ {
wxLongLong ret; DiskByteCount ret;
mFileNameMutex.Lock(); mFileNameMutex.Lock();
wxFFile summaryFile(mFileName.GetFullPath()); wxFFile summaryFile(mFileName.GetFullPath());
ret= summaryFile.Length(); ret= summaryFile.Length();

View File

@ -63,7 +63,7 @@ class ODPCMAliasBlockFile final : public PCMAliasBlockFile
bool IsSummaryBeingComputed() override { return mSummaryBeingComputed; } bool IsSummaryBeingComputed() override { return mSummaryBeingComputed; }
//Calls that rely on summary files need to be overidden //Calls that rely on summary files need to be overidden
wxLongLong GetSpaceUsage() const override; DiskByteCount GetSpaceUsage() const override;
/// Gets extreme values for the specified region /// Gets extreme values for the specified region
void GetMinMax(sampleCount start, sampleCount len, void GetMinMax(sampleCount start, sampleCount len,
float *outMin, float *outMax, float *outRMS) const override; float *outMin, float *outMax, float *outRMS) const override;

View File

@ -82,7 +82,7 @@ BlockFilePtr SilentBlockFile::Copy(wxFileNameWrapper &&)
return newBlockFile; return newBlockFile;
} }
wxLongLong SilentBlockFile::GetSpaceUsage() const auto SilentBlockFile::GetSpaceUsage() const -> DiskByteCount
{ {
return 0; return 0;
} }

View File

@ -42,7 +42,7 @@ class SilentBlockFile final : public BlockFile {
BlockFilePtr Copy(wxFileNameWrapper &&newFileName) override; BlockFilePtr Copy(wxFileNameWrapper &&newFileName) override;
/// Write an XML representation of this file /// Write an XML representation of this file
void SaveXML(XMLWriter &xmlFile) override; void SaveXML(XMLWriter &xmlFile) override;
wxLongLong GetSpaceUsage() const override; DiskByteCount GetSpaceUsage() const override;
void Recover() override { }; void Recover() override { };
static BlockFilePtr BuildFromXML(DirManager &dm, const wxChar **attrs); static BlockFilePtr BuildFromXML(DirManager &dm, const wxChar **attrs);

View File

@ -547,7 +547,7 @@ BlockFilePtr SimpleBlockFile::Copy(wxFileNameWrapper &&newFileName)
return newBlockFile; return newBlockFile;
} }
wxLongLong SimpleBlockFile::GetSpaceUsage() const auto SimpleBlockFile::GetSpaceUsage() const -> DiskByteCount
{ {
if (mCache.active && mCache.needWrite) if (mCache.active && mCache.needWrite)
{ {
@ -598,9 +598,11 @@ wxLongLong SimpleBlockFile::GetSpaceUsage() const
file.Close(); file.Close();
} }
return sizeof(auHeader) + return
sizeof(auHeader) +
mSummaryInfo.totalSummaryBytes + mSummaryInfo.totalSummaryBytes +
(GetLength() * SAMPLE_SIZE_DISK(mFormat)); (GetLength() * SAMPLE_SIZE_DISK(mFormat))
;
} }
void SimpleBlockFile::Recover(){ void SimpleBlockFile::Recover(){

View File

@ -72,7 +72,7 @@ class PROFILE_DLL_API SimpleBlockFile /* not final */ : public BlockFile {
/// Write an XML representation of this file /// Write an XML representation of this file
void SaveXML(XMLWriter &xmlFile) override; void SaveXML(XMLWriter &xmlFile) override;
wxLongLong GetSpaceUsage() const override; DiskByteCount GetSpaceUsage() const override;
void Recover() override; void Recover() override;
static BlockFilePtr BuildFromXML(DirManager &dm, const wxChar **attrs); static BlockFilePtr BuildFromXML(DirManager &dm, const wxChar **attrs);