fix a silly overflow error in DiscScrubber.cpp
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4587 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
93f2440f30
commit
1a374ad62c
|
@ -32,12 +32,12 @@ namespace DiscScrubber
|
||||||
|
|
||||||
#define CLUSTER_SIZE 0x8000
|
#define CLUSTER_SIZE 0x8000
|
||||||
|
|
||||||
u8* m_Sector1;
|
static u8* m_Sector1;
|
||||||
u8* m_FreeTable;
|
static u8* m_FreeTable;
|
||||||
u64 m_FileSize;
|
static u64 m_FileSize;
|
||||||
|
|
||||||
std::string m_Filename;
|
static std::string m_Filename;
|
||||||
IVolume* m_Disc = NULL;
|
static IVolume* m_Disc = NULL;
|
||||||
|
|
||||||
struct SPartitionHeader
|
struct SPartitionHeader
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,7 @@ struct SPartitionGroup
|
||||||
u64 PartitionsOffset;
|
u64 PartitionsOffset;
|
||||||
std::vector<SPartition> PartitionsVec;
|
std::vector<SPartition> PartitionsVec;
|
||||||
};
|
};
|
||||||
SPartitionGroup PartitionGroup[4];
|
static SPartitionGroup PartitionGroup[4];
|
||||||
|
|
||||||
|
|
||||||
void MarkAsUsed(u64 _Offset, u64 _Size);
|
void MarkAsUsed(u64 _Offset, u64 _Size);
|
||||||
|
@ -138,8 +138,7 @@ bool Scrub(const char* filename, CompressCB callback, void* arg)
|
||||||
|
|
||||||
// Fill out table of free blocks
|
// Fill out table of free blocks
|
||||||
callback("DiscScrubber: Parsing...", 0, arg);
|
callback("DiscScrubber: Parsing...", 0, arg);
|
||||||
if (!ParseDisc())
|
success = ParseDisc();
|
||||||
success = false;
|
|
||||||
// Done with it; need it closed for the next part
|
// Done with it; need it closed for the next part
|
||||||
delete m_Disc;
|
delete m_Disc;
|
||||||
m_Disc = NULL;
|
m_Disc = NULL;
|
||||||
|
@ -160,7 +159,7 @@ bool Scrub(const char* filename, CompressCB callback, void* arg)
|
||||||
NOTICE_LOG(DISCIO, "Removing garbage data...go get some coffee :)");
|
NOTICE_LOG(DISCIO, "Removing garbage data...go get some coffee :)");
|
||||||
for (u32 i = 0; i < numClusters; i++)
|
for (u32 i = 0; i < numClusters; i++)
|
||||||
{
|
{
|
||||||
u64 CurrentOffset = i * CLUSTER_SIZE;
|
u64 CurrentOffset = (u64)i * CLUSTER_SIZE;
|
||||||
|
|
||||||
if (m_FreeTable[i])
|
if (m_FreeTable[i])
|
||||||
{
|
{
|
||||||
|
@ -184,7 +183,7 @@ bool Scrub(const char* filename, CompressCB callback, void* arg)
|
||||||
if (i % (numClusters / 1000) == 0)
|
if (i % (numClusters / 1000) == 0)
|
||||||
{
|
{
|
||||||
char temp[512];
|
char temp[512];
|
||||||
sprintf(temp, "DiscScrubber: %u/%u (%s)", i, numClusters, m_FreeTable[i] ? "Free" : "Used");
|
sprintf(temp, "DiscScrubber: %x/%x (%s)", i, numClusters, m_FreeTable[i] ? "Free" : "Used");
|
||||||
callback(temp, (float)i / (float)numClusters, arg);
|
callback(temp, (float)i / (float)numClusters, arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,7 +379,7 @@ bool ParsePartitionData(SPartition& _rPartition)
|
||||||
// Go through the filesystem and mark entries as used
|
// Go through the filesystem and mark entries as used
|
||||||
for (size_t currentFile = 0; currentFile < numFiles; currentFile++)
|
for (size_t currentFile = 0; currentFile < numFiles; currentFile++)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(DISCIO, "%s", (*Files.at(currentFile)).m_FullPath);
|
DEBUG_LOG(DISCIO, "%s", currentFile ? (*Files.at(currentFile)).m_FullPath : "/");
|
||||||
// Just 1byte for directory? - it will end up reserving a cluster this way
|
// Just 1byte for directory? - it will end up reserving a cluster this way
|
||||||
if ((*Files.at(currentFile)).m_NameOffset & 0x1000000)
|
if ((*Files.at(currentFile)).m_NameOffset & 0x1000000)
|
||||||
MarkAsUsedE(_rPartition.Offset
|
MarkAsUsedE(_rPartition.Offset
|
||||||
|
|
Loading…
Reference in New Issue