aboutsummaryrefslogtreecommitdiffstats
path: root/heimdall/source/PrintPitAction.cpp
diff options
context:
space:
mode:
authorBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2014-06-01 14:09:56 +1000
committerBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2014-06-01 14:09:56 +1000
commit082fb091f1a0cab9d00e82de54fee32b6a1c0c7b (patch)
treea3e73e4d8b2279c3221a297ac770c96ef92175e2 /heimdall/source/PrintPitAction.cpp
parent46d9a51e18d260e416479432fec50c6e601eb3ce (diff)
downloadexternal_heimdall-082fb091f1a0cab9d00e82de54fee32b6a1c0c7b.zip
external_heimdall-082fb091f1a0cab9d00e82de54fee32b6a1c0c7b.tar.gz
external_heimdall-082fb091f1a0cab9d00e82de54fee32b6a1c0c7b.tar.bz2
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.
Diffstat (limited to 'heimdall/source/PrintPitAction.cpp')
-rw-r--r--heimdall/source/PrintPitAction.cpp10
1 files changed, 5 insertions, 5 deletions
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);