From 055fabdeaa8afcbe905aeb30d5c945f286aecb6a Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sat, 26 Nov 2011 15:31:46 +0100 Subject: use binary mode for fopen to make it work with win32 --- dev/filerelaytest.c | 2 +- src/debug.c | 2 +- tools/ideviceimagemounter.c | 4 ++-- tools/idevicescreenshot.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/filerelaytest.c b/dev/filerelaytest.c index 6e611c0..8c9514b 100644 --- a/dev/filerelaytest.c +++ b/dev/filerelaytest.c @@ -80,7 +80,7 @@ int main(int argc, char **argv) uint32_t cnt = 0; uint32_t len = 0; char buf[4096]; - FILE *f = fopen("dump.cpio.gz", "w"); + FILE *f = fopen("dump.cpio.gz", "wb"); setbuf(stdout, NULL); printf("receiving "); while (idevice_connection_receive(dump, buf, 4096, &len) == IDEVICE_E_SUCCESS) { diff --git a/src/debug.c b/src/debug.c index b1c528d..0bb87a2 100644 --- a/src/debug.c +++ b/src/debug.c @@ -140,7 +140,7 @@ inline void debug_buffer_to_file(const char *file, const char *data, const int l { #ifndef STRIP_DEBUG_CODE if (debug_level) { - FILE *f = fopen(file, "w+"); + FILE *f = fopen(file, "wb"); fwrite(data, 1, length, f); fflush(f); fclose(f); diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c index ce690de..4a650ee 100644 --- a/tools/ideviceimagemounter.c +++ b/tools/ideviceimagemounter.c @@ -365,7 +365,7 @@ int main(int argc, char **argv) } else { char sig[8192]; size_t sig_length = 0; - FILE *f = fopen(image_sig_path, "r"); + FILE *f = fopen(image_sig_path, "rb"); if (!f) { fprintf(stderr, "Error opening signature file '%s': %s\n", image_sig_path, strerror(errno)); goto leave; @@ -377,7 +377,7 @@ int main(int argc, char **argv) goto leave; } - f = fopen(image_path, "r"); + f = fopen(image_path, "rb"); if (!f) { fprintf(stderr, "Error opening image file '%s': %s\n", image_path, strerror(errno)); goto leave; diff --git a/tools/idevicescreenshot.c b/tools/idevicescreenshot.c index 8567f77..31717dd 100644 --- a/tools/idevicescreenshot.c +++ b/tools/idevicescreenshot.c @@ -97,7 +97,7 @@ int main(int argc, char **argv) time_t now = time(NULL); strftime(filename, 36, "screenshot-%Y-%m-%d-%H-%M-%S.tiff", gmtime(&now)); if (screenshotr_take_screenshot(shotr, &imgdata, &imgsize) == SCREENSHOTR_E_SUCCESS) { - FILE *f = fopen(filename, "w"); + FILE *f = fopen(filename, "wb"); if (f) { if (fwrite(imgdata, 1, (size_t)imgsize, f) == (size_t)imgsize) { printf("Screenshot saved to %s\n", filename); -- cgit v1.1-32-gdbae