Skip to content

Commit

Permalink
Merge pull request #20 from jonreid/master
Browse files Browse the repository at this point in the history
Increase warning level, and fix those warnings
  • Loading branch information
honcheng committed Nov 10, 2012
2 parents 86590f8 + 43ebd25 commit 77a6582
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 11 deletions.
2 changes: 1 addition & 1 deletion RTLabelProject/Classes/DemoTableViewCell.m
Expand Up @@ -21,7 +21,7 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
[self.contentView addSubview:_rtLabel];
[_rtLabel setBackgroundColor:[UIColor clearColor]];

[self setSelectionStyle:UITableViewCellEditingStyleNone];
[self setSelectionStyle:UITableViewCellSelectionStyleNone];
}
return self;
}
Expand Down
6 changes: 3 additions & 3 deletions RTLabelProject/Classes/DemoTableViewController.m
Expand Up @@ -109,15 +109,15 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
NSMutableDictionary *rowInfo = [self.dataArray objectAtIndex:indexPath.row];
if ([rowInfo objectForKey:@"cell_height"])
{
return [[rowInfo objectForKey:@"cell_height"] intValue];
return [[rowInfo objectForKey:@"cell_height"] floatValue];
}
else
{
RTLabel *rtLabel = [DemoTableViewCell textLabel];
[rtLabel setText:[rowInfo objectForKey:@"text"]];
CGSize optimumSize = [rtLabel optimumSize];
[rowInfo setObject:[NSNumber numberWithInt:optimumSize.height+20] forKey:@"cell_height"];
return [[rowInfo objectForKey:@"cell_height"] intValue];
[rowInfo setObject:[NSNumber numberWithFloat:optimumSize.height+20] forKey:@"cell_height"];
return [[rowInfo objectForKey:@"cell_height"] floatValue];
}

}
Expand Down
12 changes: 6 additions & 6 deletions RTLabelProject/Classes/RTLabel.m
Expand Up @@ -336,10 +336,10 @@ - (void)render
if ( (linkableComponents.position<lineRange.location && linkableComponents.position+linkableComponents.text.length>(u_int16_t)(lineRange.location)) || (linkableComponents.position>=lineRange.location && linkableComponents.position<lineRange.location+lineRange.length))
{
CGFloat secondaryOffset;
double primaryOffset = CTLineGetOffsetForStringIndex(CFArrayGetValueAtIndex(frameLines,i), linkableComponents.position, &secondaryOffset);
double primaryOffset2 = CTLineGetOffsetForStringIndex(CFArrayGetValueAtIndex(frameLines,i), linkableComponents.position+linkableComponents.text.length, NULL);
CGFloat primaryOffset = CTLineGetOffsetForStringIndex(CFArrayGetValueAtIndex(frameLines,i), linkableComponents.position, &secondaryOffset);
CGFloat primaryOffset2 = CTLineGetOffsetForStringIndex(CFArrayGetValueAtIndex(frameLines,i), linkableComponents.position+linkableComponents.text.length, NULL);

float button_width = primaryOffset2 - primaryOffset;
CGFloat button_width = primaryOffset2 - primaryOffset;

RTLabelButton *button = [[RTLabelButton alloc] initWithFrame:CGRectMake(primaryOffset, height, button_width, ascent+descent)];

Expand Down Expand Up @@ -391,7 +391,7 @@ - (void)applyParagraphStyleToText:(CFMutableAttributedStringRef)text attributes:
CGFloat paragraphSpacingBefore = 0.0;
int textAlignment = _textAlignment;
int lineBreakMode = _lineBreakMode;
int lineSpacing = _lineSpacing;
int lineSpacing = (int)_lineSpacing;

for (NSUInteger i=0; i<[[attributes allKeys] count]; i++)
{
Expand Down Expand Up @@ -491,7 +491,7 @@ - (void)applyCenterStyleToText:(CFMutableAttributedStringRef)text attributes:(NS
CGFloat paragraphSpacingBefore = 0.0;
int textAlignment = _textAlignment;
int lineBreakMode = _lineBreakMode;
int lineSpacing = _lineSpacing;
int lineSpacing = (int)_lineSpacing;

textAlignment = kCTCenterTextAlignment;

Expand Down Expand Up @@ -785,7 +785,7 @@ - (CGFloat)frameHeight:(CTFrameRef)theFrame
CTLineGetTypographicBounds(line, &ascent, &descent, &leading);
height += (ascent + fabsf(descent) + leading);
}
return ceil(height);
return ceilf(height);
}

- (void)dealloc
Expand Down
30 changes: 30 additions & 0 deletions RTLabelProject/RTLabelProject.xcodeproj/project.pbxproj
Expand Up @@ -235,10 +235,25 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES;
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_SIGN_COMPARE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos;
WARNING_CFLAGS = (
"-Wmost",
Expand All @@ -252,11 +267,26 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES;
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_SIGN_COMPARE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos;
WARNING_CFLAGS = (
"-Wmost",
Expand Down
2 changes: 1 addition & 1 deletion RTLabelProject/RTLabelProject_Prefix.pch
Expand Up @@ -5,4 +5,4 @@
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif
#endif

0 comments on commit 77a6582

Please sign in to comment.