aboutsummaryrefslogtreecommitdiffstats
path: root/heimdall/source/SendFilePartPacket.h
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-04-30 10:00:29 +0200
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-04-30 10:00:29 +0200
commitd9c6729c9df44fcaf894cc966e4e2a8ae7109bc3 (patch)
tree24f0e6518939f38330ea51095c88e7f08fdb8bcf /heimdall/source/SendFilePartPacket.h
parent61f67d4dd3f81560417c7b8d1bd5b2611eb7a001 (diff)
parentb6fe7f8535355eb8025f4872efef6cd7d3993db6 (diff)
downloadexternal_heimdall-d9c6729c9df44fcaf894cc966e4e2a8ae7109bc3.zip
external_heimdall-d9c6729c9df44fcaf894cc966e4e2a8ae7109bc3.tar.gz
external_heimdall-d9c6729c9df44fcaf894cc966e4e2a8ae7109bc3.tar.bz2
Merge branch 'master' of https://github.com/Benjamin-Dobell/Heimdall into cm-12.1
Diffstat (limited to 'heimdall/source/SendFilePartPacket.h')
-rw-r--r--heimdall/source/SendFilePartPacket.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/heimdall/source/SendFilePartPacket.h b/heimdall/source/SendFilePartPacket.h
index a553a65..561bf58 100644
--- a/heimdall/source/SendFilePartPacket.h
+++ b/heimdall/source/SendFilePartPacket.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2013 Benjamin Dobell, Glass Echidna
+/* Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -34,24 +34,22 @@ namespace Heimdall
{
public:
- SendFilePartPacket(FILE *file, int size) : OutboundPacket(size)
+ SendFilePartPacket(FILE *file, unsigned int size) : OutboundPacket(size)
{
memset(data, 0, size);
- long position = ftell(file);
+ unsigned int position = (unsigned int)FileTell(file);
- fseek(file, 0, SEEK_END);
- long fileSize = ftell(file);
- fseek(file, position, SEEK_SET);
+ FileSeek(file, 0, SEEK_END);
+ unsigned int fileSize = (unsigned int)FileTell(file);
+ FileSeek(file, position, SEEK_SET);
// min(fileSize, size)
- int bytesToRead = (fileSize < size) ? fileSize - position : size;
-
- // bytesRead is discarded (it's just there to stop GCC warnings)
- int bytesRead = fread(data, 1, bytesToRead, file);
+ unsigned int bytesToRead = (fileSize < size) ? fileSize - position : size;
+ (void)fread(data, 1, bytesToRead, file);
}
- SendFilePartPacket(unsigned char *buffer, int size) : OutboundPacket(size)
+ SendFilePartPacket(unsigned char *buffer, unsigned int size) : OutboundPacket(size)
{
memcpy(data, buffer, size);
}