Skip to content
Browse files

Activated more warnings, fixed some warned stuff.

git-svn-id: svn://witness.is-a-geek.org/svn@6 378c4bed-2673-4746-83ae-d22ddc8c5b7c
  • Loading branch information...
1 parent f926899 commit 2dd20498be348c9fe741a83ac3726e8bac098b44 uli committed Jul 5, 2009
Showing with 71 additions and 29 deletions.
  1. +24 −0 AngelDiff.xcodeproj/project.pbxproj
  2. +3 −0 AppDelegate.m
  3. +3 −3 UKDiffParser.m
  4. +8 −0 UKDiffView.h
  5. +33 −26 UKDiffView.m
View
24 AngelDiff.xcodeproj/project.pbxproj
@@ -246,6 +246,18 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = AngelDiff_Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
+ GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES;
+ GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
+ GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
+ GCC_WARN_MISSING_PARENTHESES = YES;
+ GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
+ GCC_WARN_SHADOW = YES;
+ GCC_WARN_SIGN_COMPARE = YES;
+ GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES;
+ GCC_WARN_UNUSED_PARAMETER = YES;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = AngelDiff;
@@ -260,6 +272,18 @@
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = AngelDiff_Prefix.pch;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
+ GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES;
+ GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
+ GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
+ GCC_WARN_MISSING_PARENTHESES = YES;
+ GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
+ GCC_WARN_SHADOW = YES;
+ GCC_WARN_SIGN_COMPARE = YES;
+ GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES;
+ GCC_WARN_UNUSED_PARAMETER = YES;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = AngelDiff;
View
3 AppDelegate.m
@@ -25,6 +25,7 @@ -(void) dealloc
- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename
{
+#pragma unused(sender)
self.currPath = [[filename stringByDeletingPathExtension] stringByAppendingPathExtension: @"txt"];
NSString* stringOne = [NSString stringWithContentsOfFile: self.currPath];
NSString* diffPath = [[filename stringByDeletingPathExtension] stringByAppendingPathExtension: @"udiff"];
@@ -55,6 +56,8 @@ - (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename
-(void) exportMerged: (id)sender
{
+#pragma unused(sender)
+
NSString* merged = [[diffView diffParser] mergedString];
[merged writeToFile: [[currPath stringByDeletingPathExtension] stringByAppendingPathExtension: @"merged.txt"] atomically: NO encoding: NSUTF8StringEncoding error: nil];
}
View
6 UKDiffParser.m
@@ -513,14 +513,14 @@ -(void) applyOriginalText: (NSString*)origText
else // Change or delete:
{
// Capture old text and add it to this diff item:
- NSMutableString* currStr = [NSMutableString string];
+ NSMutableString* replicatedString = [NSMutableString string];
while( (originalRange.location +originalRange.length) > currOriginalLine )
{
NSString* theLine = [originalLines objectAtIndex: currOriginalLine++];
- [currStr appendString: theLine];
+ [replicatedString appendString: theLine];
}
- [currDiff setOldText: currStr];
+ [currDiff setOldText: replicatedString];
[newDifferences addObject: currDiff];
}
}
View
8 UKDiffView.h
@@ -56,3 +56,11 @@
-(void) updateDrawingCacheCompletely: (BOOL)recreate;
@end
+
+// Layout utility functions
+NSRect UKBoxAroundPoint( NSPoint pos, CGFloat dist );
+NSPoint UKTopLeft( NSRect box );
+NSPoint UKTopRight( NSRect box );
+NSPoint UKBottomLeft( NSRect box );
+NSPoint UKBottomRight( NSRect box );
+NSPoint UKOffsetPoint( NSPoint pos, CGFloat x, CGFloat y );
View
59 UKDiffView.m
@@ -19,11 +19,11 @@
// Constants:
// -----------------------------------------------------------------------------
-#define ROUNDING_SIZE 2.0
-#define SIDE_MARGIN 3.0
-#define HORZ_MARGIN 8.0
-#define VERT_MARGIN 4.0
-#define DIVIDER_WIDTH 16.0
+#define ROUNDING_SIZE (2.0f)
+#define SIDE_MARGIN (3.0f)
+#define HORZ_MARGIN (8.0f)
+#define VERT_MARGIN (4.0f)
+#define DIVIDER_WIDTH (16.0f)
// -----------------------------------------------------------------------------
@@ -180,9 +180,8 @@ -(NSBezierPath*) pathWithConnectedBox: (NSRect)leftBox toBox: (NSRect)rightBox
NSBezierPath* thePath = [NSBezierPath bezierPath];
NSRect topLeft, topRight, botRight, botLeft;
- CGFloat leftRounding = (leftBox.size.height >= ROUNDING_SIZE) ? ROUNDING_SIZE : 0.0,
- rightRounding = (rightBox.size.height >= ROUNDING_SIZE) ? ROUNDING_SIZE : 0.0;
-
+ CGFloat leftRounding = (leftBox.size.height >= ROUNDING_SIZE) ? ROUNDING_SIZE : 0.0f,
+ rightRounding = (rightBox.size.height >= ROUNDING_SIZE) ? ROUNDING_SIZE : 0.0f;
topLeft = UKBoxAroundPoint(UKTopLeft(leftBox), leftRounding );
topRight = UKBoxAroundPoint(UKTopRight(rightBox), rightRounding );
@@ -192,35 +191,35 @@ -(NSBezierPath*) pathWithConnectedBox: (NSRect)leftBox toBox: (NSRect)rightBox
[thePath moveToPoint: UKBottomLeft(topLeft)];
[thePath appendBezierPathWithArcWithCenter: UKBottomRight(topLeft)
radius: topLeft.size.height
- startAngle: 180.0
- endAngle: 270.0
+ startAngle: 180.0f
+ endAngle: 270.0f
clockwise: NO];
[thePath lineToPoint: UKOffsetPoint(UKTopRight(leftBox), 0, -leftRounding)];
[thePath lineToPoint: UKOffsetPoint(UKTopLeft(rightBox), 0, -rightRounding)];
[thePath lineToPoint: UKTopLeft(topRight)];
[thePath appendBezierPathWithArcWithCenter: UKBottomLeft(topRight)
radius: topRight.size.height
- startAngle: 270.0
- endAngle: 0.0
+ startAngle: 270.0f
+ endAngle: 0.0f
clockwise: NO];
[thePath lineToPoint: UKOffsetPoint(UKTopRight(botRight), 0, rightRounding)];
[thePath appendBezierPathWithArcWithCenter: UKTopLeft(botRight)
radius: botRight.size.height
- startAngle: 0.0
- endAngle: 90.0
+ startAngle: 0.0f
+ endAngle: 90.0f
clockwise: NO];
[thePath lineToPoint: UKOffsetPoint(UKBottomLeft(rightBox), 0, rightRounding)];
[thePath lineToPoint: UKOffsetPoint(UKBottomRight(leftBox), 0, leftRounding)];
[thePath lineToPoint: UKBottomRight(botLeft)];
[thePath appendBezierPathWithArcWithCenter: UKTopRight(botLeft)
radius: botLeft.size.height
- startAngle: 90.0
- endAngle: 180.0
+ startAngle: 90.0f
+ endAngle: 180.0f
clockwise: NO];
[thePath closePath];
NSAffineTransform* trans = [NSAffineTransform transform];
- [trans translateXBy: 0.5 yBy: 0.5];
+ [trans translateXBy: 0.5f yBy: 0.5f];
[thePath transformUsingAffineTransform: trans];
return thePath;
@@ -246,7 +245,7 @@ -(void) drawSelected: (BOOL)selState
mainColor = [NSColor greenColor];
leftDrawBox.size.height = 0;
}
- fillColor = [mainColor colorWithAlphaComponent: 0.1];
+ fillColor = [mainColor colorWithAlphaComponent: 0.1f];
NSBezierPath* thePath = [self pathWithConnectedBox: leftDrawBox toBox: rightDrawBox];
@@ -255,12 +254,12 @@ -(void) drawSelected: (BOOL)selState
if( selState )
{
[mainColor setStroke];
- [thePath setLineWidth: 2.0];
+ [thePath setLineWidth: 2.0f];
}
else
{
[fillColor setStroke];
- [thePath setLineWidth: 1.0];
+ [thePath setLineWidth: 1.0f];
}
[thePath stroke];
@@ -273,7 +272,7 @@ -(void) drawSelected: (BOOL)selState
if( !sChooseRightImg )
sChooseRightImg = [NSImage imageNamed: @"UKDiffViewChooseRight"];
NSImage* img = apply ? sChooseRightImg : sChooseLeftImg;
- [img drawAtPoint: UKTopRight(leftDrawBox) fromRect: NSZeroRect operation: NSCompositeSourceAtop fraction: 1.0];
+ [img drawAtPoint: UKTopRight(leftDrawBox) fromRect: NSZeroRect operation: NSCompositeSourceAtop fraction: 1.0f];
}
NSLayoutManager* layoutManager = [[leftTextStorage layoutManagers] objectAtIndex: 0];
@@ -378,8 +377,10 @@ -(void) keyDown: (NSEvent*)evt
}
-- (void)moveRight:(id)sender
+-(void) moveRight: (id)sender
{
+#pragma unused(sender)
+
if( selectedRow >= 0 )
{
UKDiffEntry* currEntry = [diffParser entryAtIndex: selectedRow];
@@ -391,8 +392,10 @@ - (void)moveRight:(id)sender
}
-- (void)moveLeft:(id)sender
+-(void) moveLeft: (id)sender
{
+#pragma unused(sender)
+
if( selectedRow >= 0 )
{
UKDiffEntry* currEntry = [diffParser entryAtIndex: selectedRow];
@@ -404,8 +407,10 @@ - (void)moveLeft:(id)sender
}
-- (void)moveUp:(id)sender
+-(void) moveUp: (id)sender
{
+#pragma unused(sender)
+
NSInteger x = selectedRow -1;
for( ; x >= 0; x-- )
@@ -423,8 +428,10 @@ - (void)moveUp:(id)sender
}
--(void) moveDown:(id)sender
+-(void) moveDown: (id)sender
{
+#pragma unused(sender)
+
NSInteger x = selectedRow +1,
count = [cachedDrawings count];
@@ -481,7 +488,7 @@ -(void) setFrame: (NSRect)box
-(void) updateDrawingCacheCompletely: (BOOL)recreate
{
NSDictionary* attrs = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSFont userFixedPitchFontOfSize: 10.0], NSFontAttributeName,
+ [NSFont userFixedPitchFontOfSize: 10.0f], NSFontAttributeName,
nil];
NSUInteger x = 0,
count = [diffParser count];

0 comments on commit 2dd2049

Please sign in to comment.
Something went wrong with that request. Please try again.