Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix file tests on windows #1663

Merged
merged 1 commit into from
Nov 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions auto_tests/file_saving_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static void save_data_encrypted(void)

tox_self_set_name(t, (const uint8_t *)name, strlen(name), nullptr);

FILE *f = fopen(savefile, "w");
FILE *f = fopen(savefile, "wb");

size_t size = tox_get_savedata_size(t);
uint8_t *clear = (uint8_t *)malloc(size);
Expand Down Expand Up @@ -63,7 +63,7 @@ static void save_data_encrypted(void)

static void load_data_decrypted(void)
{
FILE *f = fopen(savefile, "r");
FILE *f = fopen(savefile, "rb");
ck_assert(f != nullptr);
fseek(f, 0, SEEK_END);
int64_t size = ftell(f);
Expand Down
4 changes: 2 additions & 2 deletions auto_tests/save_compatibility_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

static size_t get_file_size(const char *save_path)
{
FILE *const fp = fopen(save_path, "r");
FILE *const fp = fopen(save_path, "rb");

if (fp == nullptr) {
return 0;
Expand All @@ -42,7 +42,7 @@ static uint8_t *read_save(const char *save_path, size_t *length)
return nullptr;
}

FILE *const fp = fopen(save_path, "r");
FILE *const fp = fopen(save_path, "rb");

if (!fp) {
return nullptr;
Expand Down