aboutsummaryrefslogtreecommitdiffstats
path: root/heimdall/source/BridgeManager.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/BridgeManager.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/BridgeManager.cpp')
-rw-r--r--heimdall/source/BridgeManager.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/heimdall/source/BridgeManager.cpp b/heimdall/source/BridgeManager.cpp
index 32807ca..dc2926a 100644
--- a/heimdall/source/BridgeManager.cpp
+++ b/heimdall/source/BridgeManager.cpp
@@ -1002,9 +1002,9 @@ bool BridgeManager::SendFile(FILE *file, unsigned int destination, unsigned int
return (false);
}
- fseek(file, 0, SEEK_END);
- long fileSize = ftell(file);
- rewind(file);
+ FileSeek(file, 0, SEEK_END);
+ unsigned int fileSize = (unsigned int)FileTell(file);
+ FileRewind(file);
ResponsePacket *fileTransferResponse = new ResponsePacket(ResponsePacket::kResponseTypeFileTransfer);
success = ReceivePacket(fileTransferResponse);
@@ -1031,7 +1031,7 @@ bool BridgeManager::SendFile(FILE *file, unsigned int destination, unsigned int
lastSequenceSize++;
}
- long bytesTransferred = 0;
+ unsigned int bytesTransferred = 0;
unsigned int currentPercent;
unsigned int previousPercent = 0;
Interface::Print("0%%");
@@ -1144,7 +1144,7 @@ bool BridgeManager::SendFile(FILE *file, unsigned int destination, unsigned int
if (bytesTransferred > fileSize)
bytesTransferred = fileSize;
- currentPercent = (int)(100.0f * ((float)bytesTransferred / (float)fileSize));
+ currentPercent = (unsigned int)(100.0 * ((double)bytesTransferred / (double)fileSize));
if (currentPercent != previousPercent)
{