From 082fb091f1a0cab9d00e82de54fee32b6a1c0c7b Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Sun, 1 Jun 2014 14:09:56 +1000 Subject: Fixed support for large files (up to 2^32 - 1 bytes) The Loke protocol supports 32-bit unsigned for the size of files being flashed. However, POSIX file commands only support 32-bit (signed). As such we now have platform specific support for larger files. --- heimdall/source/PrintPitAction.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'heimdall/source/PrintPitAction.cpp') diff --git a/heimdall/source/PrintPitAction.cpp b/heimdall/source/PrintPitAction.cpp index 781973d..12c28d1 100644 --- a/heimdall/source/PrintPitAction.cpp +++ b/heimdall/source/PrintPitAction.cpp @@ -115,7 +115,7 @@ int PrintPitAction::Execute(int argc, char **argv) { const char *filename = fileArgument->GetValue().c_str(); - localPitFile = fopen(filename, "rb"); + localPitFile = FileOpen(filename, "rb"); if (!localPitFile) { @@ -133,14 +133,14 @@ int PrintPitAction::Execute(int argc, char **argv) { // Print PIT from file; there's no need for a BridgeManager. - fseek(localPitFile, 0, SEEK_END); - long localPitFileSize = ftell(localPitFile); - rewind(localPitFile); + FileSeek(localPitFile, 0, SEEK_END); + unsigned int localPitFileSize = (unsigned int)FileTell(localPitFile); + FileRewind(localPitFile); // Load the local pit file into memory. unsigned char *pitFileBuffer = new unsigned char[localPitFileSize]; size_t dataRead = fread(pitFileBuffer, 1, localPitFileSize, localPitFile); // dataRead is discarded, it's here to remove warnings. - fclose(localPitFile); + FileClose(localPitFile); PitData *pitData = new PitData(); pitData->Unpack(pitFileBuffer); -- cgit v1.1