summaryrefslogtreecommitdiffstats
path: root/heimdall/source
diff options
context:
space:
mode:
authorBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2014-11-16 21:02:07 +0100
committerBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2014-11-16 21:02:39 +0100
commit1ddfdc1a880279ce07b2c43f60b7aa138d4ad315 (patch)
tree4ea142d9013a6dfdf84cab401f561d45ff8ccad4 /heimdall/source
parentMore empty transfer craziness, this time when receving packets (diff)
downloadHeimdall-1ddfdc1a880279ce07b2c43f60b7aa138d4ad315.tar
Heimdall-1ddfdc1a880279ce07b2c43f60b7aa138d4ad315.tar.gz
Heimdall-1ddfdc1a880279ce07b2c43f60b7aa138d4ad315.tar.bz2
Heimdall-1ddfdc1a880279ce07b2c43f60b7aa138d4ad315.tar.lz
Heimdall-1ddfdc1a880279ce07b2c43f60b7aa138d4ad315.tar.xz
Heimdall-1ddfdc1a880279ce07b2c43f60b7aa138d4ad315.tar.zst
Heimdall-1ddfdc1a880279ce07b2c43f60b7aa138d4ad315.zip
Diffstat (limited to 'heimdall/source')
-rw-r--r--heimdall/source/BridgeManager.cpp6
-rw-r--r--heimdall/source/Heimdall.h16
2 files changed, 9 insertions, 13 deletions
diff --git a/heimdall/source/BridgeManager.cpp b/heimdall/source/BridgeManager.cpp
index 9b8fdfa..8fb678c 100644
--- a/heimdall/source/BridgeManager.cpp
+++ b/heimdall/source/BridgeManager.cpp
@@ -19,7 +19,7 @@
THE SOFTWARE.*/
// C Standard Library
-#include <stdio.h>
+#include <cstdio>
// libusb
#include <libusb.h>
@@ -53,7 +53,9 @@
#include "SessionSetupResponse.h"
// Future versions of libusb will use usb_interface instead of interface.
+#ifndef usb_interface
#define usb_interface interface
+#endif
#define USB_CLASS_CDC_DATA 0x0A
@@ -1035,7 +1037,7 @@ bool BridgeManager::SendFile(FILE *file, unsigned int destination, unsigned int
{
sequenceCount++;
- int lastSequenceBytes = fileSize % (fileTransferSequenceMaxLength * fileTransferPacketSize);
+ unsigned int lastSequenceBytes = fileSize % (fileTransferSequenceMaxLength * fileTransferPacketSize);
lastSequenceSize = lastSequenceBytes / fileTransferPacketSize;
if (partialPacketByteCount != 0)
diff --git a/heimdall/source/Heimdall.h b/heimdall/source/Heimdall.h
index 3982dd4..c5c11ef 100644
--- a/heimdall/source/Heimdall.h
+++ b/heimdall/source/Heimdall.h
@@ -21,7 +21,7 @@
#ifndef HEIMDALL_H
#define HEIMDALL_H
-#ifdef OS_WINDOWS
+#ifdef _MSC_VER // Microsoft Visual C Standard Library
#include <Windows.h>
#undef GetBinaryType
@@ -36,24 +36,18 @@
#define FileTell(FILE) _ftelli64(FILE)
#define FileRewind(FILE) rewind(FILE)
-#else
+#else // POSIX Standard Library
-#include "../config.h"
-
-#if defined(OS_DARWIN) || defined(OS_LINUX)
#include <unistd.h>
+
#define Sleep(t) usleep(1000*t)
#define FileOpen(FILE, MODE) fopen(FILE, MODE)
#define FileClose(FILE) fclose(FILE)
-#define FileSeek(FILE, OFFSET, ORIGIN) fseeko(FILE, OFFSET, ORIGIN)
-#define FileTell(FILE) ftello(FILE)
+#define FileSeek(FILE, OFFSET, ORIGIN) fseeko64(FILE, OFFSET, ORIGIN)
+#define FileTell(FILE) ftello64(FILE)
#define FileRewind(FILE) rewind(FILE)
-#else
-#error operating system not supported
-#endif
-
#endif
#if (!(defined _MSC_VER) || (_MSC_VER < 1700))