From: Uwe Hermann Date: Fri, 4 Feb 2011 22:52:16 +0000 (+0100) Subject: MinGW: Use "b" in all fopen() calls. X-Git-Tag: libsigrok-0.1.0~346 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=45fdfa307de68cc5209142cc6bae13a3be274949;p=libsigrok.git MinGW: Use "b" in all fopen() calls. This is required for proper operation on Windows/MinGW, and doesn't affect other OSes, most POSIX systems simply ignore the "b". --- diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 427d7905..c89ed31f 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -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; } diff --git a/hardware/common/ezusb.c b/hardware/common/ezusb.c index 884ceafd..587abe7f 100644 --- a/hardware/common/ezusb.c +++ b/hardware/common/ezusb.c @@ -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;