aboutsummaryrefslogtreecommitdiffstats
path: root/heimdall/source/SendFilePartPacket.h
diff options
context:
space:
mode:
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);
}