From 4bcf96c3eaec5af04028732e79ac0f59577f45c7 Mon Sep 17 00:00:00 2001 From: ponchio Date: Thu, 2 Dec 2004 17:07:34 +0000 Subject: [PATCH] in64 related bug. --- apps/nexus/mfile.cpp | 6 ++++-- apps/nexus/patchserver.cpp | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/nexus/mfile.cpp b/apps/nexus/mfile.cpp index a4513a72..17bc4515 100644 --- a/apps/nexus/mfile.cpp +++ b/apps/nexus/mfile.cpp @@ -97,6 +97,7 @@ void MFile::ReadBuffer(void *data, unsigned int sz) { data = ((char *)data) + n; sz -= n; curr_fp++; + assert(curr_fp < files.size()); curr_pos = 0; files[curr_fp]->SetPosition(curr_pos); } @@ -111,6 +112,7 @@ void MFile::WriteBuffer(void *data, unsigned int sz) { data = ((char *)data) + n; sz -= n; curr_fp++; + assert(curr_fp < files.size()); curr_pos = 0; files[curr_fp]->SetPosition(curr_pos); } @@ -144,9 +146,9 @@ void MFile::WriteBuffer(void *data, unsigned int sz) { void MFile::RedimLast(unsigned int sz) { assert(sz <= max_size); File &file = *files.back(); - unsigned int last_size = file.Length(); + unsigned int last_size = (int64)file.Length(); file.Redim(sz); - size += sz - last_size; + size += sz - (int64)last_size; } std::string MFile::Name(unsigned int n) { diff --git a/apps/nexus/patchserver.cpp b/apps/nexus/patchserver.cpp index c52acce5..ddc9b2c3 100644 --- a/apps/nexus/patchserver.cpp +++ b/apps/nexus/patchserver.cpp @@ -116,7 +116,7 @@ Patch &PatchServer::GetPatch(unsigned int idx, if(entry.patch_start != 0xffffffff) { //was allocated. assert(entry.disk_size != 0xffff); - SetPosition(entry.patch_start * chunk_size); + SetPosition((int64)entry.patch_start * (int64)chunk_size); if((signature & NXS_COMPRESSED) == 0) { //not compressed ReadBuffer(ram, entry.disk_size * chunk_size); @@ -254,7 +254,7 @@ void PatchServer::Flush(PTime &ptime) { cerr << "OOOOPSPPPS not supported!" << endl; exit(-1); } - SetPosition(entry.patch_start * chunk_size); + SetPosition((int64)entry.patch_start * (int64)chunk_size); WriteBuffer(compressed, entry.disk_size * chunk_size); delete []compressed; } else { @@ -263,7 +263,7 @@ void PatchServer::Flush(PTime &ptime) { entry.patch_start = (unsigned int)(Length()/chunk_size); Redim(Length() + entry.disk_size * chunk_size); } - SetPosition(entry.patch_start * chunk_size); + SetPosition((int64)entry.patch_start * (int64)chunk_size); WriteBuffer(ptime.patch->start, entry.disk_size * chunk_size); } /* FILE *fo = fopen("tmp", "wb+");