diff --git a/src/benchmarks/eina/evas_stringshare.c b/src/benchmarks/eina/evas_stringshare.c index 6e8797ca01..ce0e6ebebe 100644 --- a/src/benchmarks/eina/evas_stringshare.c +++ b/src/benchmarks/eina/evas_stringshare.c @@ -196,7 +196,7 @@ evas_stringshare_add(const char *str) // { // char bf[256]; // snprintf(bf, sizeof(bf), "strlog-%i", getpid()); -// f = fopen(bf, "w"); +// f = fopen(bf, "wb"); // } hash_num = _evas_stringshare_hash_gen(str, &slen); for (el = share.buckets[hash_num]; el; pel = el, el = el->next) diff --git a/src/bin/edje/edje_codegen.c b/src/bin/edje/edje_codegen.c index f2ddc7f08b..0b2412fa37 100644 --- a/src/bin/edje/edje_codegen.c +++ b/src/bin/edje/edje_codegen.c @@ -387,11 +387,11 @@ _standardizes_header(const char *filename) static Eina_Bool _open_file_descriptors(const char *source, const char *header) { - header_fd = fopen(header, "w"); + header_fd = fopen(header, "wb"); if (!header_fd) return EINA_FALSE; - source_fd = fopen(source, "w"); + source_fd = fopen(source, "wb"); if (!source_fd) goto err; diff --git a/src/bin/edje/epp/cpplib.c b/src/bin/edje/epp/cpplib.c index b8e0ff2d64..0d2b5035c9 100644 --- a/src/bin/edje/epp/cpplib.c +++ b/src/bin/edje/epp/cpplib.c @@ -7492,7 +7492,7 @@ using_file(const char *filename, const char type) FILE *f = NULL; if (!options.watchfile) return; - f = fopen(options.watchfile, "a"); + f = fopen(options.watchfile, "ab"); if (!f) return; if (annotate) { diff --git a/src/bin/edje/epp/cpplib.h b/src/bin/edje/epp/cpplib.h index c040ebddcc..18b66700e8 100644 --- a/src/bin/edje/epp/cpplib.h +++ b/src/bin/edje/epp/cpplib.h @@ -345,7 +345,7 @@ struct cpp_options { char print_deps_missing_files; - /* If true, fopen (deps_file, "a") else fopen (deps_file, "w"). */ + /* If true, fopen (deps_file, "ab") else fopen (deps_file, "wb"). */ char print_deps_append; /* Nonzero means print names of header files (-H). */ diff --git a/src/bin/edje/epp/cppmain.c b/src/bin/edje/epp/cppmain.c index 2e8059bf09..be04bac777 100644 --- a/src/bin/edje/epp/cppmain.c +++ b/src/bin/edje/epp/cppmain.c @@ -74,7 +74,7 @@ main(int argc, char **argv) if (!opts->out_fname || !strcmp(opts->out_fname, "")) opts->out_fname = "stdout"; - else if (!freopen(opts->out_fname, "w", stdout)) + else if (!freopen(opts->out_fname, "wb", stdout)) cpp_pfatal_with_name(&parse_in, opts->out_fname); for (i = 0;; i++) diff --git a/src/bin/efl/efl_debugd.c b/src/bin/efl/efl_debugd.c index a1025fbb4e..a07fe3fcee 100644 --- a/src/bin/efl/efl_debugd.c +++ b/src/bin/efl/efl_debugd.c @@ -129,7 +129,7 @@ _do(Client *c, char *op, unsigned char *d, int size) c2->evlog_fetch_timer = ecore_timer_add(0.2, _cb_evlog, c2); snprintf(buf, sizeof(buf), "%s/efl_debug_evlog-%ld.log", getenv("HOME"), (long)c2->pid); - c2->evlog_file = fopen(buf, "w"); + c2->evlog_file = fopen(buf, "wb"); } } } diff --git a/src/examples/eina/eina_model_03.c b/src/examples/eina/eina_model_03.c index a5e2562f15..61498da47c 100644 --- a/src/examples/eina/eina_model_03.c +++ b/src/examples/eina/eina_model_03.c @@ -106,7 +106,7 @@ _address_book_load(Eina_Model *model) EINA_SAFETY_ON_NULL_RETURN_VAL(filename, EINA_FALSE); - f = fopen(filename, "r"); + f = fopen(filename, "rb"); // Now that we have used filename, we must free its memory holder: eina_value_flush(&val); diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c index f1212581a3..d9fc9d9845 100644 --- a/src/lib/ecore/ecore.c +++ b/src/lib/ecore/ecore.c @@ -271,7 +271,7 @@ ecore_init(void) char tmp[1024]; snprintf(tmp, sizeof(tmp), "ecore_mem_stat.%i", getpid()); - _ecore_memory_statistic_file = fopen(tmp, "w"); + _ecore_memory_statistic_file = fopen(tmp, "wb"); #endif _ecore_memory_pid = getpid(); ecore_animator_add(_ecore_memory_statistic, NULL); diff --git a/src/lib/ecore_con/ecore_con_ssl.c b/src/lib/ecore_con/ecore_con_ssl.c index f16dd69d76..3c24afba43 100644 --- a/src/lib/ecore_con/ecore_con_ssl.c +++ b/src/lib/ecore_con/ecore_con_ssl.c @@ -1589,7 +1589,7 @@ _ecore_con_ssl_server_privkey_add_openssl(Ecore_Con_Server *obj, FILE *fp = NULL; EVP_PKEY *privkey = NULL; - if (!(fp = fopen(key_file, "r"))) + if (!(fp = fopen(key_file, "rb"))) goto error; SSL_ERROR_CHECK_GOTO_ERROR(!(privkey = PEM_read_PrivateKey(fp, NULL, NULL, NULL))); @@ -1616,7 +1616,7 @@ _ecore_con_ssl_server_cert_add_openssl(Ecore_Con_Server *obj, FILE *fp = NULL; X509 *cert = NULL; - if (!(fp = fopen(cert_file, "r"))) + if (!(fp = fopen(cert_file, "rb"))) goto error; SSL_ERROR_CHECK_GOTO_ERROR(!(cert = PEM_read_X509(fp, NULL, NULL, NULL))); diff --git a/src/lib/ecore_x/xlib/ecore_x_vsync.c b/src/lib/ecore_x/xlib/ecore_x_vsync.c index ea35b5a4ff..bdf832c97b 100644 --- a/src/lib/ecore_x/xlib/ecore_x_vsync.c +++ b/src/lib/ecore_x/xlib/ecore_x_vsync.c @@ -443,7 +443,7 @@ _drm_init(int *flags) if (stat("/sys/module/vboxvideo", &st) == 0) { /* - FILE *fp = fopen("/sys/module/vboxvideo/version", "r"); + FILE *fp = fopen("/sys/module/vboxvideo/version", "rb"); if (fp) { if (fgets(buf, sizeof(buf), fp)) @@ -462,7 +462,7 @@ _drm_init(int *flags) // only do this on new kernels = let's say 3.14 and up. 3.16 definitely // works { - FILE *fp = fopen("/proc/sys/kernel/osrelease", "r"); + FILE *fp = fopen("/proc/sys/kernel/osrelease", "rb"); if (fp) { if (fgets(buf, sizeof(buf), fp)) diff --git a/src/lib/eet/Eet.h b/src/lib/eet/Eet.h index 62074fd40d..c861165c09 100644 --- a/src/lib/eet/Eet.h +++ b/src/lib/eet/Eet.h @@ -3224,7 +3224,7 @@ typedef void (*Eet_Dump_Callback)(void *data, const char *str); * int len; * void *data; * - * f = fopen(file, "r"); + * f = fopen(file, "rb"); * fseek(f, 0, SEEK_END); * len = ftell(f); * rewind(f); @@ -4030,7 +4030,7 @@ eet_data_xattr_cipher_set(const char *filename, * int len; * void *data; * - * f = fopen(file, "r"); + * f = fopen(file, "rb"); * fseek(f, 0, SEEK_END); * len = ftell(f); * rewind(f); diff --git a/src/lib/eet/eet_cipher.c b/src/lib/eet/eet_cipher.c index aa57e5caab..a34fdfff4b 100644 --- a/src/lib/eet/eet_cipher.c +++ b/src/lib/eet/eet_cipher.c @@ -192,7 +192,7 @@ on_error: if (!emile_cipher_init()) return NULL; /* Load the X509 certificate in memory. */ - fp = fopen(certificate_file, "r"); + fp = fopen(certificate_file, "rb"); if (!fp) return NULL; @@ -207,7 +207,7 @@ on_error: goto on_error; /* Load the private key in memory. */ - fp = fopen(private_key_file, "r"); + fp = fopen(private_key_file, "rb"); if (!fp) goto on_error; diff --git a/src/lib/efreet/efreet_menu.c b/src/lib/efreet/efreet_menu.c index ada789b7e0..b774460c98 100644 --- a/src/lib/efreet/efreet_menu.c +++ b/src/lib/efreet/efreet_menu.c @@ -687,7 +687,7 @@ efreet_menu_save(Efreet_Menu *menu, const char *path) EINA_SAFETY_ON_NULL_RETURN_VAL(menu, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(path, 0); - f = fopen(path, "w"); + f = fopen(path, "wb"); if (!f) return 0; fprintf(f, "\n"); fprintf(f, "name, bench->run); - main_script = fopen(buffer, "w"); + main_script = fopen(buffer, "wb"); if (!main_script) return NULL; @@ -293,7 +293,7 @@ eina_benchmark_run(Eina_Benchmark *bench) bench->run, run->name); - current_data = fopen(buffer, "w"); + current_data = fopen(buffer, "wb"); if (!current_data) continue; diff --git a/src/lib/elua/elua.c b/src/lib/elua/elua.c index 602e5d1825..47bcd3fb76 100644 --- a/src/lib/elua/elua.c +++ b/src/lib/elua/elua.c @@ -617,7 +617,7 @@ elua_util_script_run(Elua_State *es, int argc, char **argv, int n, int *quit) if (fname) { /* check if there is a file of that name */ - FILE *f = fopen(fname, "r"); + FILE *f = fopen(fname, "rb"); if (f) { fclose(f); diff --git a/src/lib/elua/io.c b/src/lib/elua/io.c index d5b8a0c7d1..6835e9936f 100644 --- a/src/lib/elua/io.c +++ b/src/lib/elua/io.c @@ -10,7 +10,7 @@ get_cmdline_from_argv(const char *fname, const char **argv) char pbuf[PATH_MAX]; const char *arg = NULL; - FILE *testf = fopen(fname, "r"); + FILE *testf = fopen(fname, "rb"); if (!testf) return NULL; diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c index 63749e8284..1645ebcf4c 100644 --- a/src/lib/evas/canvas/evas_render.c +++ b/src/lib/evas/canvas/evas_render.c @@ -29,7 +29,7 @@ rend_dbg(const char *txt) #ifdef STDOUT_DBG dbf = stdout; #else - dbf = fopen("EVAS-RENDER-DEBUG.log", "w"); + dbf = fopen("EVAS-RENDER-DEBUG.log", "wb"); #endif if (!dbf) return; } diff --git a/src/modules/evas/engines/fb/evas_fb_main.c b/src/modules/evas/engines/fb/evas_fb_main.c index 3b8b23b5da..aab4147b4b 100644 --- a/src/modules/evas/engines/fb/evas_fb_main.c +++ b/src/modules/evas/engines/fb/evas_fb_main.c @@ -345,7 +345,7 @@ fb_list_modes(unsigned int *num_return) int num; num = 0; - f = fopen("/etc/fb.modes","r"); + f = fopen("/etc/fb.modes","rb"); if (!f) { *num_return = 0; diff --git a/src/modules/evas/image_savers/tgv/evas_image_save_tgv.c b/src/modules/evas/image_savers/tgv/evas_image_save_tgv.c index 44b38e0b39..aa0a82b943 100644 --- a/src/modules/evas/image_savers/tgv/evas_image_save_tgv.c +++ b/src/modules/evas/image_savers/tgv/evas_image_save_tgv.c @@ -111,7 +111,7 @@ _save_direct_tgv(RGBA_Image *im, const char *file, int compress) // header[7]: options (unused) header[7] = 0; - f = fopen(file, "w"); + f = fopen(file, "wb"); if (!f) return 0; // Write header @@ -300,7 +300,7 @@ evas_image_save_file_tgv(RGBA_Image *im, // Note: consider extending the header instead of filling all the bits here header[7] = 0; - f = fopen(file, "w"); + f = fopen(file, "wb"); if (!f) return 0; // Write header diff --git a/src/modules/evas/model_savers/obj/evas_model_save_obj.c b/src/modules/evas/model_savers/obj/evas_model_save_obj.c index 09e5c723c6..8789ce44eb 100644 --- a/src/modules/evas/model_savers/obj/evas_model_save_obj.c +++ b/src/modules/evas/model_savers/obj/evas_model_save_obj.c @@ -163,7 +163,7 @@ _save_mesh(Evas_Canvas3D_Mesh_Data *pd, evas_model_save_data_from_mesh(pd, f, header, &data); - FILE * _obj_file = fopen(_obj_file_name, "w+"); + FILE * _obj_file = fopen(_obj_file_name, "wb+"); if (!_obj_file) { ERR("File open '%s' for save failed", _obj_file_name); @@ -191,7 +191,7 @@ _save_material(Evas_Canvas3D_Mesh_Data *pd EINA_UNUSED, const char *_mtl_file_name, Evas_Canvas3D_Material_Data *mat) { - FILE * _mtl_file = fopen(_mtl_file_name, "w+"); + FILE * _mtl_file = fopen(_mtl_file_name, "wb+"); if (!_mtl_file) { ERR("File open '%s' for save failed", _mtl_file_name); diff --git a/src/modules/evas/model_savers/ply/evas_model_save_ply.c b/src/modules/evas/model_savers/ply/evas_model_save_ply.c index 8da8f741ea..805f267bc0 100644 --- a/src/modules/evas/model_savers/ply/evas_model_save_ply.c +++ b/src/modules/evas/model_savers/ply/evas_model_save_ply.c @@ -75,7 +75,7 @@ evas_model_save_file_ply(const Evas_Canvas3D_Mesh *mesh, if (!evas_model_save_header_from_mesh(pd, f, &header)) return; evas_model_save_data_from_mesh(pd, f, header, &data); - FILE *_ply_file = fopen(file, "w+"); + FILE *_ply_file = fopen(file, "wb+"); if (!_ply_file) { ERR("File open '%s' for save failed", file); diff --git a/src/static_libs/dns/dns.c b/src/static_libs/dns/dns.c index 0100550680..a426a53476 100644 --- a/src/static_libs/dns/dns.c +++ b/src/static_libs/dns/dns.c @@ -3516,7 +3516,7 @@ int dns_hosts_loadpath(struct dns_hosts *hosts, const char *path) { FILE *fp; int error; - if (!(fp = fopen(path, "r"))) + if (!(fp = fopen(path, "rb"))) return dns_syerr(); error = dns_hosts_loadfile(hosts, fp); @@ -4073,7 +4073,7 @@ int dns_resconf_loadpath(struct dns_resolv_conf *resconf, const char *path) { FILE *fp; int error; - if (!(fp = fopen(path, "r"))) + if (!(fp = fopen(path, "rb"))) return dns_syerr(); error = dns_resconf_loadfile(resconf, fp); @@ -4456,7 +4456,7 @@ int dns_nssconf_loadpath(struct dns_resolv_conf *resconf, const char *path) { FILE *fp; int error; - if (!(fp = fopen(path, "r"))) + if (!(fp = fopen(path, "rb"))) return dns_syerr(); error = dns_nssconf_loadfile(resconf, fp); diff --git a/src/static_libs/http-parser/contrib/parsertrace.c b/src/static_libs/http-parser/contrib/parsertrace.c index c9bc71ec01..ed35f8638b 100644 --- a/src/static_libs/http-parser/contrib/parsertrace.c +++ b/src/static_libs/http-parser/contrib/parsertrace.c @@ -108,7 +108,7 @@ int main(int argc, char* argv[]) { } char* filename = argv[2]; - FILE* file = fopen(filename, "r"); + FILE* file = fopen(filename, "rb"); if (file == NULL) { perror("fopen"); return EXIT_FAILURE; diff --git a/src/tests/ecore/ecore_test_ecore_file.c b/src/tests/ecore/ecore_test_ecore_file.c index 93689ac4ec..1e2d801039 100644 --- a/src/tests/ecore/ecore_test_ecore_file.c +++ b/src/tests/ecore/ecore_test_ecore_file.c @@ -20,9 +20,9 @@ void _writeToFile(const char *filePath, char *text) { - FILE *f = fopen(filePath, "r+"); + FILE *f = fopen(filePath, "rb+"); if (f == NULL) - f = fopen(filePath, "w"); + f = fopen(filePath, "wb"); fail_if(f == NULL); fprintf(f, "%s\n", text); fclose(f); diff --git a/src/tests/eet/eet_suite.c b/src/tests/eet/eet_suite.c index 9db0e9ce93..673294bbb9 100644 --- a/src/tests/eet/eet_suite.c +++ b/src/tests/eet/eet_suite.c @@ -1734,7 +1734,7 @@ START_TEST(eet_identity_simple) fail_if(-1 == (fd = mkstemp(file))); fail_if(!!close(fd)); - fail_if(!(noread = fopen("/dev/null", "w"))); + fail_if(!(noread = fopen("/dev/null", "wb"))); /* Sign an eet file. */ ef = eet_open(file, EET_FILE_MODE_WRITE); diff --git a/src/tests/eio/eio_test_monitor.c b/src/tests/eio/eio_test_monitor.c index 7b93928ff3..daf2a3fd0d 100644 --- a/src/tests/eio/eio_test_monitor.c +++ b/src/tests/eio/eio_test_monitor.c @@ -72,7 +72,7 @@ static Eina_Bool _create_directory(void *data) static Eina_Bool _create_file(void *data) { - FILE *fd = fopen((const char*)data, "w+"); + FILE *fd = fopen((const char*)data, "wb+"); ck_assert_ptr_ne(fd, NULL); fprintf(fd, "test test"); fclose(fd); @@ -88,7 +88,7 @@ static Eina_Bool _delete_file(void *data) static Eina_Bool _modify_file(void *data) { - FILE *fd = fopen((const char*)data, "a"); + FILE *fd = fopen((const char*)data, "ab"); ck_assert_ptr_ne(fd, NULL); fprintf(fd, "appened"); fclose(fd); diff --git a/src/tests/elua/elua_lib.c b/src/tests/elua/elua_lib.c index 43df108113..aecc26a022 100644 --- a/src/tests/elua/elua_lib.c +++ b/src/tests/elua/elua_lib.c @@ -116,7 +116,7 @@ START_TEST(elua_api) fail_if(!elua_util_script_run(st, 2, cargv, 1, &quit)); fail_if(quit != 1); - f = fopen(buf, "w"); + f = fopen(buf, "wb"); fail_if(!f); fprintf(f, "return false"); fclose(f); diff --git a/src/utils/ecore/makekeys.c b/src/utils/ecore/makekeys.c index 69383af416..87b76c6e54 100644 --- a/src/utils/ecore/makekeys.c +++ b/src/utils/ecore/makekeys.c @@ -66,7 +66,7 @@ main(int argc, char **argv) for (l = 1; l < argc; l++) { - if (!(fptr = fopen(argv[l], "r"))) + if (!(fptr = fopen(argv[l], "rb"))) { fprintf(stderr, "Could not open %s\n", argv[l]); continue;