summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2011-11-26 15:31:46 +0100
committerGravatar Martin Szulecki2012-03-19 01:45:43 +0100
commit055fabdeaa8afcbe905aeb30d5c945f286aecb6a (patch)
treeedf19d52bb974af429c0f815b0d80b6ac91bae87
parentd9051baf2e8f4672e6fab3b185a1ec7ce1a8c864 (diff)
downloadlibimobiledevice-055fabdeaa8afcbe905aeb30d5c945f286aecb6a.tar.gz
libimobiledevice-055fabdeaa8afcbe905aeb30d5c945f286aecb6a.tar.bz2
use binary mode for fopen to make it work with win32
-rw-r--r--dev/filerelaytest.c2
-rw-r--r--src/debug.c2
-rw-r--r--tools/ideviceimagemounter.c4
-rw-r--r--tools/idevicescreenshot.c2
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)
80 uint32_t cnt = 0; 80 uint32_t cnt = 0;
81 uint32_t len = 0; 81 uint32_t len = 0;
82 char buf[4096]; 82 char buf[4096];
83 FILE *f = fopen("dump.cpio.gz", "w"); 83 FILE *f = fopen("dump.cpio.gz", "wb");
84 setbuf(stdout, NULL); 84 setbuf(stdout, NULL);
85 printf("receiving "); 85 printf("receiving ");
86 while (idevice_connection_receive(dump, buf, 4096, &len) == IDEVICE_E_SUCCESS) { 86 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
140{ 140{
141#ifndef STRIP_DEBUG_CODE 141#ifndef STRIP_DEBUG_CODE
142 if (debug_level) { 142 if (debug_level) {
143 FILE *f = fopen(file, "w+"); 143 FILE *f = fopen(file, "wb");
144 fwrite(data, 1, length, f); 144 fwrite(data, 1, length, f);
145 fflush(f); 145 fflush(f);
146 fclose(f); 146 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)
365 } else { 365 } else {
366 char sig[8192]; 366 char sig[8192];
367 size_t sig_length = 0; 367 size_t sig_length = 0;
368 FILE *f = fopen(image_sig_path, "r"); 368 FILE *f = fopen(image_sig_path, "rb");
369 if (!f) { 369 if (!f) {
370 fprintf(stderr, "Error opening signature file '%s': %s\n", image_sig_path, strerror(errno)); 370 fprintf(stderr, "Error opening signature file '%s': %s\n", image_sig_path, strerror(errno));
371 goto leave; 371 goto leave;
@@ -377,7 +377,7 @@ int main(int argc, char **argv)
377 goto leave; 377 goto leave;
378 } 378 }
379 379
380 f = fopen(image_path, "r"); 380 f = fopen(image_path, "rb");
381 if (!f) { 381 if (!f) {
382 fprintf(stderr, "Error opening image file '%s': %s\n", image_path, strerror(errno)); 382 fprintf(stderr, "Error opening image file '%s': %s\n", image_path, strerror(errno));
383 goto leave; 383 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)
97 time_t now = time(NULL); 97 time_t now = time(NULL);
98 strftime(filename, 36, "screenshot-%Y-%m-%d-%H-%M-%S.tiff", gmtime(&now)); 98 strftime(filename, 36, "screenshot-%Y-%m-%d-%H-%M-%S.tiff", gmtime(&now));
99 if (screenshotr_take_screenshot(shotr, &imgdata, &imgsize) == SCREENSHOTR_E_SUCCESS) { 99 if (screenshotr_take_screenshot(shotr, &imgdata, &imgsize) == SCREENSHOTR_E_SUCCESS) {
100 FILE *f = fopen(filename, "w"); 100 FILE *f = fopen(filename, "wb");
101 if (f) { 101 if (f) {
102 if (fwrite(imgdata, 1, (size_t)imgsize, f) == (size_t)imgsize) { 102 if (fwrite(imgdata, 1, (size_t)imgsize, f) == (size_t)imgsize) {
103 printf("Screenshot saved to %s\n", filename); 103 printf("Screenshot saved to %s\n", filename);