Author: rfm
Date: Sun Mar 20 12:53:01 2016
New Revision: 39568

URL: http://svn.gna.org/viewcvs/gnustep?rev=39568&view=rev
Log:
light tidying

Modified:
    libs/base/trunk/Source/NSLocale.m
    libs/base/trunk/Source/NSNumberFormatter.m

Modified: libs/base/trunk/Source/NSLocale.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSLocale.m?rev=39568&r1=39567&r2=39568&view=diff
==============================================================================
--- libs/base/trunk/Source/NSLocale.m   (original)
+++ libs/base/trunk/Source/NSLocale.m   Sun Mar 20 12:53:01 2016
@@ -853,11 +853,12 @@
   return _localeId;
 }
 
-- (BOOL) isEqual: (id) obj
+- (BOOL) isEqual: (id)obj
 {
   if ([obj isKindOfClass: [self class]])
-    return [_localeId isEqual: [obj localeIdentifier]];
-  
+    {
+      return [_localeId isEqual: [obj localeIdentifier]];
+    }
   return NO;
 }
 
@@ -1050,28 +1051,26 @@
 
 - (NSString *) _getDecimalSeparator
 {
-  NSNumberFormatter *nFor;
-  NSString *result;
+  NSNumberFormatter    *nFor;
+  NSString              *result;
   
   nFor = [[NSNumberFormatter alloc] init];
   [nFor setLocale: self];
   [nFor setNumberStyle: NSNumberFormatterDecimalStyle];
   result = [nFor decimalSeparator];
-  
   RELEASE(nFor);
   return result;
 }
 
 - (NSString *) _getGroupingSeparator
 {
-  NSNumberFormatter *nFor;
-  NSString *result;
+  NSNumberFormatter     *nFor;
+  NSString              *result;
   
   nFor = [[NSNumberFormatter alloc] init];
   [nFor setLocale: self];
   [nFor setNumberStyle: NSNumberFormatterDecimalStyle];
   result = [nFor groupingSeparator];
-  
   RELEASE(nFor);
   return result;
 }

Modified: libs/base/trunk/Source/NSNumberFormatter.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSNumberFormatter.m?rev=39568&r1=39567&r2=39568&view=diff
==============================================================================
--- libs/base/trunk/Source/NSNumberFormatter.m  (original)
+++ libs/base/trunk/Source/NSNumberFormatter.m  Sun Mar 20 12:53:01 2016
@@ -1523,16 +1523,17 @@
   return internal->_genDecimal; // FIXME
 }
 
-
-- (void) setLocale: (NSLocale *) locale
-{
-  RELEASE(internal->_locale);
-  
-  if (locale == nil)
-    locale = [NSLocale currentLocale];
-  internal->_locale = RETAIN(locale);
-  
-  [self _resetUNumberFormat];
+- (void) setLocale: (NSLocale *)locale
+{
+  if (nil == locale)
+    {
+      locale = [NSLocale currentLocale];
+    }
+  if (NO == [locale isEqual: internal->_locale])
+    {
+      ASSIGN(internal->_locale, locale);
+      [self _resetUNumberFormat];
+    }
 }
 
 - (NSLocale *) locale
@@ -2135,23 +2136,24 @@
 - (void) _resetUNumberFormat
 {
 #if GS_USE_ICU == 1
-  unichar buffer[BUFFER_SIZE];
-  NSUInteger length;
-  UNumberFormatStyle style;
-  UErrorCode err = U_ZERO_ERROR;
-  const char *cLocaleId;
-  int32_t idx;
+  unichar               buffer[BUFFER_SIZE];
+  NSUInteger            length;
+  UNumberFormatStyle    style;
+  UErrorCode            err = U_ZERO_ERROR;
+  const char            *cLocaleId;
+  int32_t               idx;
   
   if (internal->_formatter)
-    unum_close(internal->_formatter);
-  
+    {
+      unum_close(internal->_formatter);
+    } 
   cLocaleId = [[internal->_locale localeIdentifier] UTF8String];
   style = NSToICUFormatStyle (internal->_style);
-  
   internal->_formatter = unum_open (style, NULL, 0, cLocaleId, NULL, &err);
   if (U_FAILURE(err))
-    internal->_formatter = NULL;
-  
+    {
+      internal->_formatter = NULL;
+     } 
   // Reset all properties
   for (idx = 0; idx < MAX_SYMBOLS; ++idx)
     {
@@ -2159,7 +2161,9 @@
        {
          length = [internal->_symbols[idx] length];
          if (length > BUFFER_SIZE)
-           length = BUFFER_SIZE;
+            {
+              length = BUFFER_SIZE;
+            }
          [internal->_symbols[idx] getCharacters: buffer
                                           range: NSMakeRange (0, length)];
          unum_setSymbol (internal->_formatter, idx, buffer, length, &err);
@@ -2172,9 +2176,11 @@
        {
          length = [internal->_textAttributes[idx] length];
          if (length > BUFFER_SIZE)
-           length = BUFFER_SIZE;
+            {
+              length = BUFFER_SIZE;
+            }
          [internal->_textAttributes[idx] getCharacters: buffer
-                                          range: NSMakeRange (0, length)];
+            range: NSMakeRange (0, length)];
          unum_setTextAttribute
            (internal->_formatter, idx, buffer, length, &err);
        }


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to