Update of /cvsroot/audacity/audacity-src/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv8209
Modified Files:
Dependencies.cpp Track.h Dependencies.h BlockFile.cpp
Track.cpp BlockFile.h UndoManager.cpp
Log Message:
Use wxLongLong for file and disk space usage calcs (at least I think I got them
all)
Index: BlockFile.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/BlockFile.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- BlockFile.cpp 23 Sep 2006 02:28:03 -0000 1.39
+++ BlockFile.cpp 4 Nov 2006 19:55:20 -0000 1.40
@@ -620,7 +620,7 @@
mAliasedFileName = newAliasedFile;
}
-int AliasBlockFile::GetSpaceUsage()
+wxLongLong AliasBlockFile::GetSpaceUsage()
{
wxFFile summaryFile(mFileName.GetFullPath());
return summaryFile.Length();
Index: BlockFile.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/BlockFile.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- BlockFile.h 23 Sep 2006 02:28:03 -0000 1.19
+++ BlockFile.h 4 Nov 2006 19:55:20 -0000 1.20
@@ -85,7 +85,7 @@
/// Create a new BlockFile identical to this, using the given filename
virtual BlockFile *Copy(wxFileName newFileName) = 0;
- virtual int GetSpaceUsage() = 0;
+ virtual wxLongLong GetSpaceUsage() = 0;
/// if the on-disk state disappeared, either recover it (if it was
//summary only), write out a placeholder of silence data (missing
@@ -160,7 +160,7 @@
virtual int ReadData(samplePtr data, sampleFormat format,
sampleCount start, sampleCount len) = 0;
- virtual int GetSpaceUsage();
+ virtual wxLongLong GetSpaceUsage();
/// as SilentLog (which would affect Summary data access), but
// applying to Alias file access
Index: Track.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Track.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- Track.cpp 20 Jul 2006 09:09:24 -0000 1.34
+++ Track.cpp 4 Nov 2006 19:55:20 -0000 1.35
@@ -569,10 +569,10 @@
// get the sum of the sizes of all blocks this track list
// references. However, if a block is referred to multiple
// times it is only counted once. Return value is in bytes
-unsigned int TrackList::GetSpaceUsage()
+wxLongLong TrackList::GetSpaceUsage()
{
// the map guarantees that I only count each block once
- std::map<BlockFile*,unsigned int> blockFiles;
+ std::map<BlockFile*,wxLongLong> blockFiles;
for (TrackListNode *p = head; p; p = p->next) {
if (p->t->GetKind() == Track::Wave) {
WaveTrack* track = ((WaveTrack*)p->t);
@@ -586,8 +586,8 @@
}
}
- std::map<BlockFile*,unsigned int>::const_iterator bfIter;
- unsigned int bytes = 0;
+ std::map<BlockFile*,wxLongLong>::const_iterator bfIter;
+ wxLongLong bytes = 0;
for (bfIter = blockFiles.begin(); bfIter != blockFiles.end(); bfIter++)
bytes += bfIter->second;
@@ -602,11 +602,11 @@
// Computed by getting a list of all blocks referenced by
// *this* TrackList and removing all blocks referenced by
// any previous TrackList.
-unsigned int TrackList::GetAdditionalSpaceUsage(UndoStack *stack)
+wxLongLong TrackList::GetAdditionalSpaceUsage(UndoStack *stack)
{
TrackListNode *p;
// get a map of all blocks referenced in this TrackList
- std::map<BlockFile*,unsigned int> curBlockFiles;
+ std::map<BlockFile*,wxLongLong> curBlockFiles;
for (p = head; p; p = p->next) {
if (p->t->GetKind() == Track::Wave) {
WaveTrack* track = ((WaveTrack*)p->t);
@@ -647,9 +647,9 @@
curBlockFiles.erase(*prevIter);
// sum the sizes of the blocks remaining in curBlockFiles;
- std::map<BlockFile*,unsigned int>::const_iterator curBfIter =
+ std::map<BlockFile*,wxLongLong>::const_iterator curBfIter =
curBlockFiles.begin();
- unsigned int bytes = 0;
+ wxLongLong bytes = 0;
for (;curBfIter != curBlockFiles.end(); curBfIter++)
bytes += curBfIter->second;
Index: Track.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Track.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- Track.h 23 Sep 2006 02:28:05 -0000 1.34
+++ Track.h 4 Nov 2006 19:55:20 -0000 1.35
@@ -13,6 +13,7 @@
#include <wx/string.h>
#include <wx/dynarray.h>
+#include <wx/longlong.h>
#include "SampleFormat.h"
#include "xml/XMLTagHandler.h"
@@ -238,8 +239,8 @@
virtual bool Save(wxTextFile * out, bool overwrite);
#endif
- unsigned int GetSpaceUsage();
- unsigned int GetAdditionalSpaceUsage(UndoStack *stack);
+ wxLongLong GetSpaceUsage();
+ wxLongLong GetAdditionalSpaceUsage(UndoStack *stack);
private:
void Swap(TrackListNode * s1, TrackListNode * s2);
Index: UndoManager.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/UndoManager.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- UndoManager.cpp 1 Oct 2006 07:23:49 -0000 1.20
+++ UndoManager.cpp 4 Nov 2006 19:55:20 -0000 1.21
@@ -50,7 +50,7 @@
n -= 1; // 1 based to zero based
wxASSERT(n < stack.Count());
- double bytes;
+ wxLongLong bytes;
*desc = stack[n]->description;
Index: Dependencies.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Dependencies.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Dependencies.cpp 30 Sep 2006 03:25:09 -0000 1.5
+++ Dependencies.cpp 4 Nov 2006 19:55:20 -0000 1.6
@@ -142,11 +142,11 @@
AliasedFileHash aliasedFileHash;
ReplacedBlockFileHash blockFileHash;
- double totalBytesToProcess = 0.0;
- double completedBytes = 0.0;
+ wxLongLong totalBytesToProcess = 0;
+ wxLongLong completedBytes = 0;
unsigned int i;
- for(i=0; i<aliasedFiles->GetCount(); i++) {
- totalBytesToProcess += (double)aliasedFiles->Item(i).bytes;
+ for(i=0; i<aliasedFiles->GetCount(); i++) {
+ totalBytesToProcess += aliasedFiles->Item(i).bytes;
wxString fileNameStr = aliasedFiles->Item(i).fileName.GetFullPath();
aliasedFileHash[fileNameStr] = &aliasedFiles->Item(i);
}
@@ -178,9 +178,9 @@
blockFileHash[f] = newBlockFile;
// Update the progress bar
- completedBytes += (double)SAMPLE_SIZE(format) * len;
+ completedBytes += SAMPLE_SIZE(format) * len;
int progressValue =
- (int)(completedBytes * 1000.0 / totalBytesToProcess);
+ (completedBytes * 1000 / totalBytesToProcess).GetValue();
GetActiveProject()->ProgressUpdate(progressValue);
}
}
@@ -344,11 +344,10 @@
unsigned int i;
for(i=0; i<mAliasedFiles->GetCount(); i++) {
wxFileName fileName = mAliasedFiles->Item(i).fileName;
- double bytes = mAliasedFiles->Item(i).bytes;
- double overhead = 1.24;
+ wxLongLong bytes = (mAliasedFiles->Item(i).bytes * 124) / 100;
mFileList->InsertItem(i, fileName.GetFullPath());
- mFileList->SetItem(i, 1, Internat::FormatSize(bytes * overhead));
+ mFileList->SetItem(i, 1, Internat::FormatSize(bytes));
mFileList->SetItemState(i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
}
Index: Dependencies.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/Dependencies.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Dependencies.h 30 Sep 2006 03:25:09 -0000 1.2
+++ Dependencies.h 4 Nov 2006 19:55:20 -0000 1.3
@@ -24,12 +24,12 @@
class AliasedFile {
public:
- AliasedFile(wxFileName fileName, double bytes) {
+ AliasedFile(wxFileName fileName, wxLongLong bytes) {
this->fileName = fileName;
this->bytes = bytes;
}
wxFileName fileName;
- double bytes; // if stored as current default sample format
+ wxLongLong bytes; // if stored as current default sample format
};
class AudacityProject;
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs