]> sigrok.org Git - libsigrok.git/commitdiff
MinGW: Use "b" in all fopen() calls.
authorUwe Hermann <redacted>
Fri, 4 Feb 2011 22:52:16 +0000 (23:52 +0100)
committerUwe Hermann <redacted>
Fri, 4 Feb 2011 22:52:16 +0000 (23:52 +0100)
This is required for proper operation on Windows/MinGW, and doesn't
affect other OSes, most POSIX systems simply ignore the "b".

hardware/asix-sigma/asix-sigma.c
hardware/common/ezusb.c

index 427d7905982166c15b1e9a9b008a14f232808917..c89ed31f65cc2ee45943b105713715230db3b03d 100644 (file)
@@ -312,9 +312,9 @@ static int bin2bitbang(const char *filename,
        int c, ret, bit, v;
        uint32_t imm = 0x3f6df2ab;
 
-       f = fopen(filename, "r");
+       f = fopen(filename, "rb");
        if (!f) {
-               g_warning("fopen(\"%s\", \"r\")", filename);
+               g_warning("fopen(\"%s\", \"rb\")", filename);
                return -1;
        }
 
index 884ceafdccf9fa693a401aecd0ffa1a170d963e6..587abe7fffc4413199c987e4d41c98ba02d33780 100644 (file)
@@ -50,7 +50,7 @@ int ezusb_install_firmware(libusb_device_handle *hdl, const char *filename)
        unsigned char buf[4096];
 
        g_message("Uploading firmware at %s", filename);
-       if ((fw = fopen(filename, "r")) == NULL) {
+       if ((fw = fopen(filename, "rb")) == NULL) {
                g_warning("Unable to open firmware file %s for reading: %s",
                          filename, strerror(errno));
                return 1;