From 9f957a193701788cac66292daea2c89ed94a033f Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Tue, 6 May 2014 22:52:10 +1000 Subject: Updated copyright notices to 2014 --- heimdall/source/SendFilePartPacket.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'heimdall/source/SendFilePartPacket.h') diff --git a/heimdall/source/SendFilePartPacket.h b/heimdall/source/SendFilePartPacket.h index a553a65..6bbc086 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 -- cgit v1.1 From 46d9a51e18d260e416479432fec50c6e601eb3ce Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Sun, 1 Jun 2014 13:12:07 +1000 Subject: Fixed file transfer sequence bug --- heimdall/source/SendFilePartPacket.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'heimdall/source/SendFilePartPacket.h') diff --git a/heimdall/source/SendFilePartPacket.h b/heimdall/source/SendFilePartPacket.h index 6bbc086..3ecaa89 100644 --- a/heimdall/source/SendFilePartPacket.h +++ b/heimdall/source/SendFilePartPacket.h @@ -34,7 +34,7 @@ namespace Heimdall { public: - SendFilePartPacket(FILE *file, int size) : OutboundPacket(size) + SendFilePartPacket(FILE *file, unsigned int size) : OutboundPacket(size) { memset(data, 0, size); @@ -45,13 +45,13 @@ namespace Heimdall fseek(file, position, SEEK_SET); // min(fileSize, size) - int bytesToRead = (fileSize < size) ? fileSize - position : size; + unsigned 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 bytesRead = 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); } -- cgit v1.1 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/SendFilePartPacket.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'heimdall/source/SendFilePartPacket.h') diff --git a/heimdall/source/SendFilePartPacket.h b/heimdall/source/SendFilePartPacket.h index 3ecaa89..38e9dbe 100644 --- a/heimdall/source/SendFilePartPacket.h +++ b/heimdall/source/SendFilePartPacket.h @@ -38,11 +38,11 @@ namespace Heimdall { 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) unsigned int bytesToRead = (fileSize < size) ? fileSize - position : size; -- cgit v1.1 From 05d4c747a97124dbf92af9f718fefe475074ce41 Mon Sep 17 00:00:00 2001 From: Steffen Pankratz Date: Sun, 6 Mar 2016 13:45:37 +0100 Subject: - fixed compiler warning: dead initialization (the values are never read) In order to not get compiler warnings about 'unused return values' a void cast is used, which also makes it clear the the returned values are ignored on purpose --- heimdall/source/SendFilePartPacket.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'heimdall/source/SendFilePartPacket.h') diff --git a/heimdall/source/SendFilePartPacket.h b/heimdall/source/SendFilePartPacket.h index 38e9dbe..561bf58 100644 --- a/heimdall/source/SendFilePartPacket.h +++ b/heimdall/source/SendFilePartPacket.h @@ -46,9 +46,7 @@ namespace Heimdall // min(fileSize, size) unsigned int bytesToRead = (fileSize < size) ? fileSize - position : size; - - // bytesRead is discarded (it's just there to stop GCC warnings) - unsigned int bytesRead = fread(data, 1, bytesToRead, file); + (void)fread(data, 1, bytesToRead, file); } SendFilePartPacket(unsigned char *buffer, unsigned int size) : OutboundPacket(size) -- cgit v1.1