From 9fcd50e031d2d970899961d6ac7afa5456c31c6a Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Wed, 15 Apr 2015 12:51:33 +0200 Subject: [PATCH] Utils.m: rename logger helper functions to LOGx instead of Linphone_x --- Classes/ContactDetailsTableViewController.m | 4 ++-- Classes/DialerViewController.m | 4 ++-- Classes/LinphoneAppDelegate.m | 24 +++++++++---------- .../LinphoneUI/UICompositeViewController.m | 4 ++-- Classes/PhoneMainView.m | 2 +- Classes/Utils/FastAddressBook.m | 2 +- Classes/Utils/Utils.h | 11 ++++----- Classes/Utils/Utils.m | 10 ++++---- 8 files changed, 30 insertions(+), 31 deletions(-) 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/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); }