Fix build for Windows 10.

This commit is contained in:
Ghislain MARY 2016-08-05 16:27:03 +02:00
parent 97c8f0d0d8
commit a70b12c892

View file

@ -34,12 +34,12 @@ static void linphone_vcard_import_export_friends_test(void) {
char *import_filepath = bc_tester_res("vcards/vcards.vcf");
char *export_filepath = bc_tester_file("export_vcards.vcf");
int count = 0;
BC_ASSERT_EQUAL(bctbx_list_size(friends), 0, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends), 0, unsigned int, "%u");
count = linphone_friend_list_import_friends_from_vcard4_file(lfl, import_filepath);
BC_ASSERT_EQUAL(count, 3, int, "%d");
friends = linphone_friend_list_get_friends(lfl);
BC_ASSERT_EQUAL(bctbx_list_size(friends), 3, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends), 3, unsigned int, "%u");
linphone_friend_list_export_friends_as_vcard4_file(lfl, export_filepath);
@ -47,7 +47,7 @@ static void linphone_vcard_import_export_friends_test(void) {
count = linphone_friend_list_import_friends_from_vcard4_file(lfl, export_filepath);
BC_ASSERT_EQUAL(count, 3, int, "%d");
friends = linphone_friend_list_get_friends(lfl);
BC_ASSERT_EQUAL(bctbx_list_size(friends), 3, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends), 3, unsigned int, "%u");
linphone_friend_list_unref(lfl);
remove(export_filepath);
@ -66,13 +66,14 @@ static void linphone_vcard_import_a_lot_of_friends_test(void) {
FILE *infile = NULL;
char *buffer = NULL;
long numbytes = 0;
size_t readbytes;
start = clock();
linphone_friend_list_import_friends_from_vcard4_file(lfl, import_filepath);
end = clock();
friends = linphone_friend_list_get_friends(lfl);
BC_ASSERT_EQUAL(bctbx_list_size(friends), 1000, int, "%i"); // Now that we accept Friends without a SIP URI, the result must be equal to 1000
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends), 1000, unsigned int, "%u"); // Now that we accept Friends without a SIP URI, the result must be equal to 1000
elapsed = (double)(end - start);
ms_message("Imported a thousand of vCards from file in %f seconds", elapsed / CLOCKS_PER_SEC);
@ -85,9 +86,9 @@ static void linphone_vcard_import_a_lot_of_friends_test(void) {
numbytes = ftell(infile);
fseek(infile, 0L, SEEK_SET);
buffer = (char*)ms_malloc((numbytes + 1) * sizeof(char));
numbytes = fread(buffer, sizeof(char), numbytes, infile);
readbytes = fread(buffer, sizeof(char), numbytes, infile);
fclose(infile);
buffer[numbytes] = '\0';
buffer[readbytes] = '\0';
start = clock();
linphone_friend_list_import_friends_from_vcard4_buffer(lfl, buffer);
@ -96,7 +97,7 @@ static void linphone_vcard_import_a_lot_of_friends_test(void) {
}
friends = linphone_friend_list_get_friends(lfl);
BC_ASSERT_EQUAL(bctbx_list_size(friends), 1000, int, "%i"); // Now that we accept Friends without a SIP URI, the result must be equal to 1000
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends), 1000, unsigned int, "%u"); // Now that we accept Friends without a SIP URI, the result must be equal to 1000
elapsed = (double)(end - start);
ms_message("Imported a thousand of vCards from buffer in %f seconds", elapsed / CLOCKS_PER_SEC);
@ -148,8 +149,8 @@ static void linphone_vcard_phone_numbers_and_sip_addresses(void) {
bctbx_list_t *phone_numbers = linphone_friend_get_phone_numbers(lf);
LinphoneAddress *addr = NULL;
BC_ASSERT_EQUAL(bctbx_list_size(sip_addresses), 2, int, "%i");
BC_ASSERT_EQUAL(bctbx_list_size(phone_numbers), 1, int, "%i");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(sip_addresses), 2, unsigned int, "%u");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(phone_numbers), 1, unsigned int, "%u");
if (sip_addresses) bctbx_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref);
if (phone_numbers) bctbx_list_free(phone_numbers);
linphone_friend_unref(lf);
@ -159,8 +160,8 @@ static void linphone_vcard_phone_numbers_and_sip_addresses(void) {
sip_addresses = linphone_friend_get_addresses(lf);
phone_numbers = linphone_friend_get_phone_numbers(lf);
BC_ASSERT_EQUAL(bctbx_list_size(sip_addresses), 0, int, "%i");
BC_ASSERT_EQUAL(bctbx_list_size(phone_numbers), 2, int, "%i");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(sip_addresses), 0, unsigned int, "%u");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(phone_numbers), 2, unsigned int, "%u");
if (sip_addresses) bctbx_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref);
if (phone_numbers) bctbx_list_free(phone_numbers);
@ -168,29 +169,29 @@ static void linphone_vcard_phone_numbers_and_sip_addresses(void) {
linphone_friend_add_address(lf, addr);
linphone_address_unref(addr);
sip_addresses = linphone_friend_get_addresses(lf);
BC_ASSERT_EQUAL(bctbx_list_size(sip_addresses), 1, int, "%i");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(sip_addresses), 1, unsigned int, "%u");
if (sip_addresses) bctbx_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref);
linphone_friend_remove_phone_number(lf, "0952636505");
phone_numbers = linphone_friend_get_phone_numbers(lf);
BC_ASSERT_EQUAL(bctbx_list_size(phone_numbers), 1, int, "%i");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(phone_numbers), 1, unsigned int, "%u");
if (phone_numbers) bctbx_list_free(phone_numbers);
linphone_friend_remove_phone_number(lf, "0476010203");
phone_numbers = linphone_friend_get_phone_numbers(lf);
BC_ASSERT_EQUAL(bctbx_list_size(phone_numbers), 0, int, "%i");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(phone_numbers), 0, unsigned int, "%u");
if (phone_numbers) bctbx_list_free(phone_numbers);
addr = linphone_address_new("sip:sylvain@sip.linphone.org");
linphone_friend_remove_address(lf, addr);
linphone_address_unref(addr);
sip_addresses = linphone_friend_get_addresses(lf);
BC_ASSERT_EQUAL(bctbx_list_size(sip_addresses), 0, int, "%i");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(sip_addresses), 0, unsigned int, "%u");
if (sip_addresses) bctbx_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref);
linphone_friend_add_phone_number(lf, "+33952636505");
phone_numbers = linphone_friend_get_phone_numbers(lf);
BC_ASSERT_EQUAL(bctbx_list_size(phone_numbers), 1, int, "%i");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(phone_numbers), 1, unsigned int, "%u");
if (phone_numbers) bctbx_list_free(phone_numbers);
linphone_friend_unref(lf);
@ -211,12 +212,12 @@ static void friends_if_no_db_set(void) {
linphone_friend_set_name(lf, "Sylvain");
linphone_friend_list_add_friend(lfl, lf);
friends = linphone_friend_list_get_friends(lfl);
BC_ASSERT_EQUAL(bctbx_list_size(friends), 1, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends), 1, unsigned int, "%u");
linphone_friend_list_remove_friend(lfl, lf);
linphone_friend_unref(lf);
friends = linphone_friend_list_get_friends(lfl);
BC_ASSERT_EQUAL(bctbx_list_size(friends), 0, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends), 0, unsigned int, "%u");
linphone_friend_list_unref(lfl);
linphone_address_unref(addr);
@ -230,16 +231,16 @@ static void friends_migration(void) {
const bctbx_list_t *friends = linphone_friend_list_get_friends(lfl);
bctbx_list_t *friends_from_db = NULL;
char *friends_db = bc_tester_file("friends.db");
BC_ASSERT_EQUAL(bctbx_list_size(friends), 3, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends), 3, unsigned int, "%u");
BC_ASSERT_EQUAL(lp_config_get_int(lpc, "misc", "friends_migration_done", 0), 0, int, "%i");
unlink(friends_db);
linphone_core_set_friends_database_path(manager->lc, friends_db);
lfl = linphone_core_get_default_friend_list(manager->lc);
friends = linphone_friend_list_get_friends(lfl);
BC_ASSERT_EQUAL(bctbx_list_size(friends), 3, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends), 3, unsigned int, "%u");
friends_from_db = linphone_core_fetch_friends_from_db(manager->lc, lfl);
BC_ASSERT_EQUAL(bctbx_list_size(friends_from_db), 3, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends_from_db), 3, unsigned int, "%u");
BC_ASSERT_EQUAL(lp_config_get_int(lpc, "misc", "friends_migration_done", 0), 1, int, "%i");
friends_from_db = bctbx_list_free_with_data(friends_from_db, (void (*)(void *))linphone_friend_unref);
@ -289,12 +290,12 @@ static void friends_sqlite_storage(void) {
friends = linphone_friend_list_get_friends(linphone_core_get_default_friend_list(lc));
lfl = linphone_core_create_friend_list(lc);
linphone_friend_list_set_user_data(lfl, stats);
BC_ASSERT_EQUAL(bctbx_list_size(friends), 0, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends), 0, unsigned int, "%u");
unlink(friends_db);
linphone_core_set_friends_database_path(lc, friends_db);
friends_from_db = linphone_core_fetch_friends_from_db(lc, linphone_core_get_default_friend_list(lc));
BC_ASSERT_EQUAL(bctbx_list_size(friends_from_db), 0, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends_from_db), 0, unsigned int, "%u");
linphone_vcard_set_etag(lvc, "\"123-456789\"");
linphone_vcard_set_url(lvc, "http://dav.somewhere.fr/addressbook/me/someone.vcf");
@ -313,19 +314,19 @@ static void friends_sqlite_storage(void) {
BC_ASSERT_EQUAL(lf->storage_id, 1, unsigned int, "%u");
friends = linphone_friend_list_get_friends(linphone_core_get_default_friend_list(lc));
BC_ASSERT_EQUAL(bctbx_list_size(friends), 0, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends), 0, unsigned int, "%u");
friends_lists_from_db = linphone_core_fetch_friends_lists_from_db(lc);
BC_ASSERT_EQUAL(bctbx_list_size(friends_lists_from_db), 1, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends_lists_from_db), 1, unsigned int, "%u");
friends_from_db = ((LinphoneFriendList *)friends_lists_from_db->data)->friends;
BC_ASSERT_EQUAL(bctbx_list_size(friends_from_db), 1, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends_from_db), 1, unsigned int, "%u");
lf2 = (LinphoneFriend *)friends_from_db->data;
BC_ASSERT_PTR_NOT_NULL(lf2->lc);
BC_ASSERT_PTR_NOT_NULL(lf2->friend_list);
friends_lists_from_db = bctbx_list_free_with_data(friends_lists_from_db, (void (*)(void *))linphone_friend_list_unref);
friends_from_db = linphone_core_fetch_friends_from_db(lc, lfl);
BC_ASSERT_EQUAL(bctbx_list_size(friends_from_db), 1, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends_from_db), 1, unsigned int, "%u");
if (bctbx_list_size(friends_from_db) < 1) {
goto end;
}
@ -349,7 +350,7 @@ static void friends_sqlite_storage(void) {
linphone_friend_done(lf);
friends_from_db = bctbx_list_free_with_data(friends_from_db, (void (*)(void *))linphone_friend_unref);
friends_from_db = linphone_core_fetch_friends_from_db(lc, lfl);
BC_ASSERT_EQUAL(bctbx_list_size(friends_from_db), 1, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends_from_db), 1, unsigned int, "%u");
if (bctbx_list_size(friends_from_db) < 1) {
goto end;
}
@ -359,9 +360,9 @@ static void friends_sqlite_storage(void) {
linphone_friend_list_remove_friend(lfl, lf);
friends = linphone_friend_list_get_friends(linphone_core_get_default_friend_list(lc));
BC_ASSERT_EQUAL(bctbx_list_size(friends), 0, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends), 0, unsigned int, "%u");
friends_from_db = linphone_core_fetch_friends_from_db(lc, lfl);
BC_ASSERT_EQUAL(bctbx_list_size(friends_from_db), 0, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(friends_from_db), 0, unsigned int, "%u");
linphone_core_remove_friend_list(lc, lfl);
wait_for_until(lc, NULL, &stats->removed_list_count, 1, 1000);
@ -604,15 +605,15 @@ static void carddav_integration(void) {
linphone_core_add_friend_list(manager->lc, lfl);
BC_ASSERT_PTR_NULL(linphone_vcard_get_uid(lvc));
BC_ASSERT_EQUAL(bctbx_list_size(lfl->dirty_friends_to_update), 0, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(lfl->dirty_friends_to_update), 0, unsigned int, "%u");
BC_ASSERT_EQUAL(linphone_friend_list_add_friend(lfl, lf), LinphoneFriendListOK, int, "%d");
BC_ASSERT_EQUAL(bctbx_list_size(lfl->dirty_friends_to_update), 1, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(lfl->dirty_friends_to_update), 1, unsigned int, "%u");
wait_for_until(manager->lc, NULL, &stats->sync_done_count, 1, 5000);
BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i");
BC_ASSERT_EQUAL(bctbx_list_size(lfl->dirty_friends_to_update), 0, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(lfl->dirty_friends_to_update), 0, unsigned int, "%u");
BC_ASSERT_PTR_NOT_NULL(linphone_vcard_get_uid(lvc));
linphone_friend_list_remove_friend(lfl, lf);
BC_ASSERT_EQUAL(bctbx_list_size(lfl->friends), 0, int, "%d");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(lfl->friends), 0, unsigned int, "%u");
wait_for_until(manager->lc, NULL, &stats->sync_done_count, 2, 5000);
BC_ASSERT_EQUAL(stats->sync_done_count, 2, int, "%i");
linphone_friend_unref(lf);
@ -641,7 +642,7 @@ static void carddav_integration(void) {
wait_for_until(manager->lc, NULL, &stats->sync_done_count, 3, 5000);
BC_ASSERT_EQUAL(stats->sync_done_count, 3, int, "%i");
BC_ASSERT_EQUAL(bctbx_list_size(lfl->friends), 1, int, "%i");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(lfl->friends), 1, unsigned int, "%u");
lf = (LinphoneFriend *)lfl->friends->data;
BC_ASSERT_STRING_EQUAL(lf->refkey, refkey);
BC_ASSERT_EQUAL(lf->storage_id, lf2->storage_id, unsigned int, "%u");
@ -654,13 +655,13 @@ static void carddav_integration(void) {
linphone_friend_edit(lf);
linphone_friend_done(lf);
BC_ASSERT_EQUAL(bctbx_list_size(lf->friend_list->dirty_friends_to_update), 0, int, "%i");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(lf->friend_list->dirty_friends_to_update), 0, unsigned int, "%u");
linphone_core_set_network_reachable(manager->lc, FALSE); //To prevent the CardDAV update
linphone_friend_edit(lf);
linphone_friend_set_name(lf, "François Grisez");
linphone_friend_done(lf);
BC_ASSERT_EQUAL(bctbx_list_size(lf->friend_list->dirty_friends_to_update), 1, int, "%i");
BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(lf->friend_list->dirty_friends_to_update), 1, unsigned int, "%u");
ms_free(stats);
linphone_friend_list_unref(lfl);