diff --git a/Classes/ContactDetailsTableViewController.m b/Classes/ContactDetailsTableViewController.m index a85bd9cad..be2b15b28 100644 --- a/Classes/ContactDetailsTableViewController.m +++ b/Classes/ContactDetailsTableViewController.m @@ -279,7 +279,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe CFTypeRef values[] = { [value copy], [LinphoneManager instance].contactSipField }; CFDictionaryRef lDict = CFDictionaryCreate(NULL, (const void **)&keys, (const void **)&values, 2, NULL, NULL); if (entry) { - index = ABMultiValueGetIndexForIdentifier(lMap, [entry identifier]); + index = (int)ABMultiValueGetIndexForIdentifier(lMap, [entry identifier]); ABMultiValueReplaceValueAtIndex(lMap, lDict, index); } else { CFStringRef label = (CFStringRef)[labelArray objectAtIndex:0]; @@ -300,7 +300,7 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe lcMap = ABRecordCopyValue(contact, kABPersonInstantMessageProperty); lMap = ABMultiValueCreateMutableCopy(lcMap); CFRelease(lcMap); - index = ABMultiValueGetIndexForIdentifier(lMap, [entry identifier]); + index = (int)ABMultiValueGetIndexForIdentifier(lMap, [entry identifier]); lDict = ABMultiValueCopyValueAtIndex(lMap,index); if(!CFDictionaryContainsKey(lDict, kABPersonInstantMessageServiceKey)) { /*too bad probably a gtalk number, storing uri*/ diff --git a/Classes/DialerViewController.m b/Classes/DialerViewController.m index c9480b922..4141ed3dd 100644 --- a/Classes/DialerViewController.m +++ b/Classes/DialerViewController.m @@ -289,7 +289,7 @@ static UICompositeViewDescription *compositeDescription = nil; if( attachLogs ){ char * filepath = linphone_core_compress_log_collection([LinphoneManager getLc]); if (filepath == NULL) { - Linphone_err(@"Cannot sent logs: file is NULL"); + LOGE(@"Cannot sent logs: file is NULL"); return; } NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]; @@ -300,7 +300,7 @@ static UICompositeViewDescription *compositeDescription = nil; mimeType = @"application/gzip"; filename = [appName stringByAppendingString:@".gz"]; } else { - Linphone_err(@"Unknown extension type: %@, cancelling email", filename); + LOGE(@"Unknown extension type: %@, cancelling email", filename); return; } [controller setMessageBody:NSLocalizedString(@"Application logs", nil) isHTML:NO]; diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 950bcb362..2f9c9c371 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -54,12 +54,12 @@ - (void)applicationDidEnterBackground:(UIApplication *)application{ - Linphone_log(@"%@", NSStringFromSelector(_cmd)); + LOGI(@"%@", NSStringFromSelector(_cmd)); [[LinphoneManager instance] enterBackgroundMode]; } - (void)applicationWillResignActive:(UIApplication *)application { - Linphone_log(@"%@", NSStringFromSelector(_cmd)); + LOGI(@"%@", NSStringFromSelector(_cmd)); LinphoneCore* lc = [LinphoneManager getLc]; LinphoneCall* call = linphone_core_get_current_call(lc); @@ -82,7 +82,7 @@ } - (void)applicationDidBecomeActive:(UIApplication *)application { - Linphone_log(@"%@", NSStringFromSelector(_cmd)); + LOGI(@"%@", NSStringFromSelector(_cmd)); if( startedInBackground ){ startedInBackground = FALSE; @@ -232,7 +232,7 @@ } - (void)applicationWillTerminate:(UIApplication *)application { - Linphone_log(@"%@", NSStringFromSelector(_cmd)); + LOGI(@"%@", NSStringFromSelector(_cmd)); } - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { @@ -311,7 +311,7 @@ } - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { - Linphone_log(@"%@ : %@", NSStringFromSelector(_cmd), userInfo); + LOGI(@"%@ : %@", NSStringFromSelector(_cmd), userInfo); [self processRemoteNotification:userInfo]; } @@ -331,7 +331,7 @@ } - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { - Linphone_log(@"%@ - state = %ld", NSStringFromSelector(_cmd), (long)application.applicationState); + LOGI(@"%@ - state = %ld", NSStringFromSelector(_cmd), (long)application.applicationState); [self fixRing]; @@ -370,7 +370,7 @@ // this method is implemented for iOS7. It is invoked when receiving a push notification for a call and it has "content-available" in the aps section. - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { - Linphone_log(@"%@ : %@", NSStringFromSelector(_cmd), userInfo); + LOGI(@"%@ : %@", NSStringFromSelector(_cmd), userInfo); LinphoneManager* lm = [LinphoneManager instance]; // save the completion handler for later execution. @@ -394,23 +394,23 @@ #pragma mark - PushNotification Functions - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken { - Linphone_log(@"%@ : %@", NSStringFromSelector(_cmd), deviceToken); + LOGI(@"%@ : %@", NSStringFromSelector(_cmd), deviceToken); [[LinphoneManager instance] setPushNotificationToken:deviceToken]; } - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error { - Linphone_log(@"%@ : %@", NSStringFromSelector(_cmd), [error localizedDescription]); + LOGI(@"%@ : %@", NSStringFromSelector(_cmd), [error localizedDescription]); [[LinphoneManager instance] setPushNotificationToken:nil]; } #pragma mark - User notifications - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings { - Linphone_log(@"%@", NSStringFromSelector(_cmd)); + LOGI(@"%@", NSStringFromSelector(_cmd)); } - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)notification completionHandler:(void (^)())completionHandler { - Linphone_log(@"%@", NSStringFromSelector(_cmd)); + LOGI(@"%@", NSStringFromSelector(_cmd)); if( [[UIDevice currentDevice].systemVersion floatValue] >= 8){ LinphoneCore* lc = [LinphoneManager getLc]; @@ -441,7 +441,7 @@ } - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler { - Linphone_log(@"%@", NSStringFromSelector(_cmd)); + LOGI(@"%@", NSStringFromSelector(_cmd)); completionHandler(); } diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 2f5606027..d1068d40a 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -276,7 +276,7 @@ struct codec_name_pref_table codec_pref_table[]={ self.messagePlayer = [[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL URLWithString:path] error:nil] autorelease]; sounds.vibrate = kSystemSoundID_Vibrate; - + logs = [[NSMutableArray alloc] init]; database = NULL; speakerEnabled = FALSE; @@ -466,7 +466,7 @@ exit_dbmigration: if( configDb == nil ) return; if( lp_config_get_int(configDb, LINPHONERC_APPLICATION_KEY, migration_flag, 0) ){ - Linphone_log(@"UserPrefs migration already performed, skip"); + LOGI(@"UserPrefs migration already performed, skip"); return; } @@ -477,11 +477,11 @@ exit_dbmigration: @"start_at_boot_preference" :@YES}; BOOL shouldSync = FALSE; - Linphone_log(@"%lu user prefs", (unsigned long)[defaults_keys count]); + LOGI(@"%lu user prefs", (unsigned long)[defaults_keys count]); for( NSString* userpref in values ){ if( [defaults_keys containsObject:userpref] ){ - Linphone_log(@"Migrating %@ from user preferences: %d", userpref, [[defaults objectForKey:userpref] boolValue]); + LOGI(@"Migrating %@ from user preferences: %d", userpref, [[defaults objectForKey:userpref] boolValue]); lp_config_set_int(configDb, LINPHONERC_APPLICATION_KEY, [userpref UTF8String], [[defaults objectForKey:userpref] boolValue]); [[NSUserDefaults standardUserDefaults] removeObjectForKey:userpref]; shouldSync = TRUE; @@ -492,7 +492,7 @@ exit_dbmigration: } if( shouldSync ){ - Linphone_log(@"Synchronizing..."); + LOGI(@"Synchronizing..."); [[NSUserDefaults standardUserDefaults] synchronize]; } // don't get back here in the future @@ -985,7 +985,7 @@ static void linphone_iphone_is_composing_received(LinphoneCore *lc, LinphoneChat + (void)kickOffNetworkConnection { static BOOL in_progress = FALSE; if( in_progress ){ - Linphone_warn(@"Connection kickoff already in progress"); + LOGW(@"Connection kickoff already in progress"); return; } in_progress = TRUE; @@ -1003,7 +1003,7 @@ static void linphone_iphone_is_composing_received(LinphoneCore *lc, LinphoneChat time_t loop_time; if( res == FALSE ){ - Linphone_log(@"Could not open write stream, backing off"); + LOGI(@"Could not open write stream, backing off"); CFRelease(writeStream); in_progress = FALSE; return; @@ -1027,10 +1027,10 @@ static void linphone_iphone_is_composing_received(LinphoneCore *lc, LinphoneChat CFWriteStreamWrite (writeStream,(const UInt8*)buff,strlen(buff)); } else if( !timeout_reached ){ CFErrorRef error = CFWriteStreamCopyError(writeStream); - Linphone_dbg(@"CFStreamError: %@", error); + LOGD(@"CFStreamError: %@", error); CFRelease(error); } else if( timeout_reached ){ - Linphone_log(@"CFStream timeout reached"); + LOGI(@"CFStream timeout reached"); } CFWriteStreamClose (writeStream); CFRelease(writeStream); @@ -1196,7 +1196,7 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach [LinphoneLogger logc:LinphoneLoggerError format:"Cannot register schedule reachability cb: %s", SCErrorString(SCError())]; return; } - + // this check is to know network connectivity right now without waiting for a change. Don'nt remove it unless you have good reason. Jehan SCNetworkReachabilityFlags flags; if (SCNetworkReachabilityGetFlags(proxyReachability, &flags)) { @@ -1313,7 +1313,7 @@ static LinphoneCoreVTable linphonec_vtable = { const char* addr = linphone_proxy_config_get_addr(proxy); // we want to enable AVPF for the proxies if( addr && strstr(addr, "sip.linphone.org") != 0 ){ - Linphone_log(@"Migrating proxy config to use AVPF"); + LOGI(@"Migrating proxy config to use AVPF"); linphone_proxy_config_enable_avpf(proxy, TRUE); } proxies = proxies->next; @@ -1328,7 +1328,7 @@ static LinphoneCoreVTable linphonec_vtable = { const char* addr = linphone_proxy_config_get_addr(proxy); // we want to enable quality reporting for the proxies that are on linphone.org if( addr && strstr(addr, "sip.linphone.org") != 0 ){ - Linphone_log(@"Migrating proxy config to send quality report"); + LOGI(@"Migrating proxy config to send quality report"); linphone_proxy_config_set_quality_reporting_collector(proxy, "sip:voip-metrics@sip.linphone.org"); linphone_proxy_config_set_quality_reporting_interval(proxy, 180); linphone_proxy_config_enable_quality_reporting(proxy, TRUE); @@ -1473,7 +1473,7 @@ static BOOL libStarted = FALSE; const char* lRootCa = [[LinphoneManager bundleFile:@"rootca.pem"] cStringUsingEncoding:[NSString defaultCStringEncoding]]; linphone_core_set_root_ca(theLinphoneCore, lRootCa); linphone_core_set_user_certificates_path(theLinphoneCore,[[LinphoneManager cacheDirectory] UTF8String]); - + /* The core will call the linphone_iphone_configuring_status_changed callback when the remote provisioning is loaded (or skipped). Wait for this to finish the code configuration */ @@ -1560,7 +1560,7 @@ static int comp_call_id(const LinphoneCall* call , const char *callid) { //first, make sure this callid is not already involved in a call MSList* calls = (MSList*)linphone_core_get_calls(theLinphoneCore); if (ms_list_find_custom(calls, (MSCompareFunc)comp_call_id, [callid UTF8String])) { - Linphone_warn(@"Call id [%@] already handled",callid); + LOGW(@"Call id [%@] already handled",callid); return; }; if ([pushCallIDs count] > 10 /*max number of pending notif*/) @@ -1588,7 +1588,7 @@ static int comp_call_id(const LinphoneCall* call , const char *callid) { - (void)playMessageSound { BOOL success = [self.messagePlayer play]; if( !success ){ - Linphone_err(@"Could not play the message sound"); + LOGE(@"Could not play the message sound"); } AudioServicesPlaySystemSound([LinphoneManager instance].sounds.vibrate); } @@ -1929,7 +1929,7 @@ static void audioRouteChangeListenerCallback ( if (call) { // The LinphoneCallAppData object should be set on call creation with callback // - (void)onCall:StateChanged:withMessage:. If not, we are in big trouble and expect it to crash - // We are NOT responsible for creating the AppData. + // We are NOT responsible for creating the AppData. LinphoneCallAppData* data=(LinphoneCallAppData*)linphone_call_get_user_pointer(call); if (data==nil) [LinphoneLogger log:LinphoneLoggerError format:@"New call instanciated but app data was not set. Expect it to crash."]; diff --git a/Classes/LinphoneUI/UICompositeViewController.m b/Classes/LinphoneUI/UICompositeViewController.m index f5e4126f5..0cdafc3b1 100644 --- a/Classes/LinphoneUI/UICompositeViewController.m +++ b/Classes/LinphoneUI/UICompositeViewController.m @@ -178,12 +178,12 @@ // if we start in portrait, the landscape view must get the opposite height and width if( portrait || [[UIDevice currentDevice].systemVersion floatValue] < 8 ){ - Linphone_log(@"landscape get opposite: %@", NSStringFromCGSize(oppositeFrame.size)); + LOGI(@"landscape get opposite: %@", NSStringFromCGSize(oppositeFrame.size)); [landscapeView setFrame:oppositeFrame]; } else { // if we start in landscape, the landscape view has to get the current size, // whereas the portrait has to get the opposite - Linphone_log(@"landscape get frame: %@ and portrait gets opposite: %@", NSStringFromCGSize(frame.size), NSStringFromCGSize(oppositeFrame.size)); + LOGI(@"landscape get frame: %@ and portrait gets opposite: %@", NSStringFromCGSize(frame.size), NSStringFromCGSize(oppositeFrame.size)); [landscapeView setFrame:frame]; [portraitView setFrame:oppositeFrame]; } diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index b4c070454..f7840cc9a 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -75,7 +75,7 @@ static RootViewManager* rootViewManagerInstance = nil; UIInterfaceOrientation nextViewOrientation = newMainView.interfaceOrientation; UIInterfaceOrientation previousOrientation = currentViewController.interfaceOrientation; - Linphone_log(@"Changing rootViewController: %@ -> %@", currentViewController.name, newMainView.name); + LOGI(@"Changing rootViewController: %@ -> %@", currentViewController.name, newMainView.name); currentViewController = newMainView; LinphoneAppDelegate* delegate = (LinphoneAppDelegate*)[UIApplication sharedApplication].delegate; diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index c876a277b..612b0b8c4 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -165,7 +165,7 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf if( addressBook != nil ){ NSError* err = nil; if( !ABAddressBookSave(addressBook, (CFErrorRef*)err) ){ - Linphone_warn(@"Couldn't save Address Book"); + LOGW(@"Couldn't save Address Book"); } } } diff --git a/Classes/Utils/Utils.h b/Classes/Utils/Utils.h index 28b950d5d..b4fb93b37 100644 --- a/Classes/Utils/Utils.h +++ b/Classes/Utils/Utils.h @@ -62,12 +62,11 @@ typedef enum _LinphoneLoggerSeverity { @end -void Linphone_log(NSString* format, ...) NS_FORMAT_FUNCTION(1,2); -void Linphone_dbg(NSString* format, ...) NS_FORMAT_FUNCTION(1,2); -void Linphone_warn(NSString* format, ...) NS_FORMAT_FUNCTION(1,2); -void Linphone_err(NSString* format, ...) NS_FORMAT_FUNCTION(1,2); -void Linphone_fatal(NSString* format, ...) NS_FORMAT_FUNCTION(1,2); - +void LOGI(NSString* format, ...) NS_FORMAT_FUNCTION(1,2); +void LOGD(NSString* format, ...) NS_FORMAT_FUNCTION(1,2); +void LOGW(NSString* format, ...) NS_FORMAT_FUNCTION(1,2); +void LOGE(NSString* format, ...) NS_FORMAT_FUNCTION(1,2); +void LOGF(NSString* format, ...) NS_FORMAT_FUNCTION(1,2); #endif diff --git a/Classes/Utils/Utils.m b/Classes/Utils/Utils.m index 31581e8cf..58a353adf 100644 --- a/Classes/Utils/Utils.m +++ b/Classes/Utils/Utils.m @@ -253,22 +253,22 @@ [LinphoneLogger logv:level format:argstart args:args]; \ va_end(args); -void Linphone_log(NSString* format, ...){ +void LOGI(NSString* format, ...){ LOGV(LinphoneLoggerLog, format); } -void Linphone_dbg(NSString* format, ...){ +void LOGD(NSString* format, ...){ LOGV(LinphoneLoggerDebug, format); } -void Linphone_warn(NSString* format, ...){ +void LOGW(NSString* format, ...){ LOGV(LinphoneLoggerWarning, format); } -void Linphone_err(NSString* format, ...){ +void LOGE(NSString* format, ...){ LOGV(LinphoneLoggerError, format); } -void Linphone_fatal(NSString* format, ...){ +void LOGF(NSString* format, ...){ LOGV(LinphoneLoggerFatal, format); }