From 87350f843859d8e881767d7851ee5d561e3897cd Mon Sep 17 00:00:00 2001 From: Nat Weiss Date: Thu, 5 Jun 2014 01:03:27 -0700 Subject: [PATCH] Use auto for textSize `sizeWithAttributes` can return either `NSSize` or `CGSize`. Use `auto` to prevent any compilation errors. --- cocos/platform/mac/CCDevice.mm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cocos/platform/mac/CCDevice.mm b/cocos/platform/mac/CCDevice.mm index 0d13a3a58654..2e43ddcb651b 100644 --- a/cocos/platform/mac/CCDevice.mm +++ b/cocos/platform/mac/CCDevice.mm @@ -118,7 +118,6 @@ static bool _initWithString(const char * text, Device::TextAlign align, const ch NSMutableString *lineBreak = [[[NSMutableString alloc] init] autorelease]; NSUInteger length = [string length]; NSRange range = NSMakeRange(0, 1); - CGSize textSize; NSUInteger lastBreakLocation = 0; NSUInteger insertCount = 0; for (NSUInteger i = 0; i < length; i++) { @@ -128,7 +127,7 @@ static bool _initWithString(const char * text, Device::TextAlign align, const ch if ([@"!?.,-= " rangeOfString:character].location != NSNotFound) { lastBreakLocation = i + insertCount; } - textSize = [lineBreak sizeWithAttributes:tokenAttributesDict]; + auto textSize = [lineBreak sizeWithAttributes:tokenAttributesDict]; if(textSize.height > info->height) break; if (textSize.width > info->width) {