Skip to content
Browse files

Fixed some problems where the ruler view wouldn't show up correctly i…

…n 64bit land.
  • Loading branch information...
1 parent c07386b commit 44a9c461a9defdcd97dc380a833c1526f6737cc9 @ccgus committed Jul 27, 2010
View
6 jstalk.xcodeproj/project.pbxproj
@@ -1238,6 +1238,9 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = src/JSTalk_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_MISSING_PARENTHESES = YES;
+ GCC_WARN_SHADOW = YES;
INFOPLIST_FILE = "res/JSTalkFramework-Info.plist";
INSTALL_PATH = "@loader_path/../Frameworks";
OTHER_CFLAGS = "-DDEBUG";
@@ -1268,6 +1271,9 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = src/JSTalk_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_MISSING_PARENTHESES = YES;
+ GCC_WARN_SHADOW = YES;
INFOPLIST_FILE = "res/JSTalkFramework-Info.plist";
INSTALL_PATH = "@loader_path/../Frameworks";
OTHER_LDFLAGS = (
View
4 src/JSTExtras.m
@@ -237,8 +237,8 @@ + (NSDictionary*)JSTAXStuff {
CFTypeRef attValue;
- AXError error = AXUIElementCopyAttributeValue(focusedUIElement, (CFStringRef)attName, &attValue);
- if (!error) {
+ AXError lerror = AXUIElementCopyAttributeValue(focusedUIElement, (CFStringRef)attName, &attValue);
+ if (!lerror) {
if ((AXValueGetType(attValue) == kAXValueCGPointType)) {
NSPoint p;
View
2 src/JSTTextView.h
@@ -18,6 +18,6 @@
@property (retain) NSDictionary *keywords;
-- (void) parseCode:(id)sender;
+- (void)parseCode:(id)sender;
@end
View
16 src/JSTTextView.m
@@ -12,7 +12,7 @@
#import "NoodleLineNumberView.h"
@interface JSTTextView (Private)
-- (void) setupLineView;
+- (void)setupLineView;
@end
@@ -32,7 +32,7 @@ - (id)initWithFrame:(NSRect)frameRect textContainer:(NSTextContainer *)container
return self;
}
-- (id) initWithCoder:(NSCoder *)aDecoder {
+- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self != nil) {
@@ -52,7 +52,7 @@ - (void)dealloc {
}
-- (void) setupLineViewAndStuff {
+- (void)setupLineViewAndStuff {
_lineNumberView = [[MarkerLineNumberView alloc] initWithScrollView:[self enclosingScrollView]];
[[self enclosingScrollView] setVerticalRulerView:_lineNumberView];
@@ -99,7 +99,7 @@ - (void) setupLineViewAndStuff {
-- (void) parseCode:(id)sender {
+- (void)parseCode:(id)sender {
// we should really do substrings...
@@ -161,16 +161,16 @@ - (void) textStorageDidProcessEditing:(NSNotification *)note {
-- (NSArray *) writablePasteboardTypes {
+- (NSArray *)writablePasteboardTypes {
return [[super writablePasteboardTypes] arrayByAddingObject:NSRTFPboardType];
}
-- (void) insertTab:(id)sender {
+- (void)insertTab:(id)sender {
[self insertText:@" "];
}
-- (void) insertNewline:(id)sender {
+- (void)insertNewline:(id)sender {
[super insertNewline:sender];
@@ -197,7 +197,7 @@ - (void) insertNewline:(id)sender {
// Mimic BBEdit's option-delete behavior, which is THE WAY IT SHOULD BE DONE
-- (void) deleteWordForward:(id)sender {
+- (void)deleteWordForward:(id)sender {
NSRange r = [self selectedRange];
NSUInteger textLength = [[self textStorage] length];
View
8 src/NoodleLineNumberMarker.h
@@ -32,13 +32,13 @@
@interface NoodleLineNumberMarker : NSRulerMarker
{
- unsigned lineNumber;
+ NSUInteger lineNumber;
}
-- (id)initWithRulerView:(NSRulerView *)aRulerView lineNumber:(float)line image:(NSImage *)anImage imageOrigin:(NSPoint)imageOrigin;
+- (id)initWithRulerView:(NSRulerView *)aRulerView lineNumber:(CGFloat)line image:(NSImage *)anImage imageOrigin:(NSPoint)imageOrigin;
-- (void)setLineNumber:(unsigned)line;
-- (unsigned)lineNumber;
+- (void)setLineNumber:(NSUInteger)line;
+- (NSUInteger)lineNumber;
@end
View
14 src/NoodleLineNumberMarker.m
@@ -32,7 +32,7 @@
@implementation NoodleLineNumberMarker
-- (id)initWithRulerView:(NSRulerView *)aRulerView lineNumber:(float)line image:(NSImage *)anImage imageOrigin:(NSPoint)imageOrigin
+- (id)initWithRulerView:(NSRulerView *)aRulerView lineNumber:(CGFloat)line image:(NSImage *)anImage imageOrigin:(NSPoint)imageOrigin
{
if ((self = [super initWithRulerView:aRulerView markerLocation:0.0 image:anImage imageOrigin:imageOrigin]) != nil)
{
@@ -41,12 +41,12 @@ - (id)initWithRulerView:(NSRulerView *)aRulerView lineNumber:(float)line image:(
return self;
}
-- (void)setLineNumber:(unsigned)line
+- (void)setLineNumber:(NSUInteger)line
{
lineNumber = line;
}
-- (unsigned)lineNumber
+- (NSUInteger)lineNumber
{
return lineNumber;
}
@@ -61,11 +61,11 @@ - (id)initWithCoder:(NSCoder *)decoder
{
if ([decoder allowsKeyedCoding])
{
- lineNumber = [[decoder decodeObjectForKey:NOODLE_LINE_CODING_KEY] unsignedIntValue];
+ lineNumber = [[decoder decodeObjectForKey:NOODLE_LINE_CODING_KEY] unsignedIntegerValue];
}
else
{
- lineNumber = [[decoder decodeObject] unsignedIntValue];
+ lineNumber = [[decoder decodeObject] unsignedIntegerValue];
}
}
return self;
@@ -77,11 +77,11 @@ - (void)encodeWithCoder:(NSCoder *)encoder
if ([encoder allowsKeyedCoding])
{
- [encoder encodeObject:[NSNumber numberWithUnsignedInt:lineNumber] forKey:NOODLE_LINE_CODING_KEY];
+ [encoder encodeObject:[NSNumber numberWithUnsignedInteger:lineNumber] forKey:NOODLE_LINE_CODING_KEY];
}
else
{
- [encoder encodeObject:[NSNumber numberWithUnsignedInt:lineNumber]];
+ [encoder encodeObject:[NSNumber numberWithUnsignedInteger:lineNumber]];
}
}
View
4 src/NoodleLineNumberView.h
@@ -57,7 +57,7 @@
- (void)setBackgroundColor:(NSColor *)color;
- (NSColor *)backgroundColor;
-- (NSInteger)lineNumberForLocation:(float)location;
-- (NoodleLineNumberMarker *)markerAtLine:(unsigned)line;
+- (NSInteger)lineNumberForLocation:(CGFloat)location;
+- (NoodleLineNumberMarker *)markerAtLine:(NSUInteger)line;
@end
View
38 src/NoodleLineNumberView.m
@@ -38,7 +38,7 @@ @interface NoodleLineNumberView (Private)
- (NSMutableArray *)lineIndices;
- (void)invalidateLineIndices;
- (void)calculateLines;
-- (unsigned)lineNumberForCharacterIndex:(unsigned)index inText:(NSString *)text;
+- (NSUInteger)lineNumberForCharacterIndex:(NSUInteger)index inText:(NSString *)text;
- (NSDictionary *)textAttributes;
- (NSDictionary *)markerTextAttributes;
@@ -184,7 +184,7 @@ - (void)textDidChange:(NSNotification *)notification
[self setNeedsDisplay:YES];
}
-- (NSInteger)lineNumberForLocation:(float)location
+- (NSInteger)lineNumberForLocation:(CGFloat)location
{
NSUInteger line, count, index, rectCount, i;
NSRectArray rects;
@@ -211,7 +211,7 @@ - (NSInteger)lineNumberForLocation:(float)location
for (line = 0; line < count; line++)
{
- index = [[lines objectAtIndex:line] unsignedIntValue];
+ index = [[lines objectAtIndex:line] unsignedIntegerValue];
rects = [layoutManager rectArrayForCharacterRange:NSMakeRange(index, 0)
withinSelectedCharacterRange:nullRange
@@ -230,9 +230,9 @@ - (NSInteger)lineNumberForLocation:(float)location
return NSNotFound;
}
-- (NoodleLineNumberMarker *)markerAtLine:(unsigned)line
+- (NoodleLineNumberMarker *)markerAtLine:(NSUInteger)line
{
- return [linesToMarkers objectForKey:[NSNumber numberWithUnsignedInt:line - 1]];
+ return [linesToMarkers objectForKey:[NSNumber numberWithUnsignedInteger:line - 1]];
}
@@ -246,7 +246,7 @@ - (void)calculateLines
{
NSUInteger index, numberOfLines, stringLength, lineEnd, contentEnd;
NSString *text;
- float oldThickness, newThickness;
+ CGFloat oldThickness, newThickness;
text = [view string];
stringLength = [text length];
@@ -258,18 +258,18 @@ - (void)calculateLines
do
{
- [lineIndices addObject:[NSNumber numberWithUnsignedInt:index]];
+ [lineIndices addObject:[NSNumber numberWithUnsignedInteger:index]];
index = NSMaxRange([text lineRangeForRange:NSMakeRange(index, 0)]);
numberOfLines++;
}
while (index < stringLength);
// Check if text ends with a new line.
- [text getLineStart:NULL end:&lineEnd contentsEnd:&contentEnd forRange:NSMakeRange([[lineIndices lastObject] unsignedIntValue], 0)];
+ [text getLineStart:NULL end:&lineEnd contentsEnd:&contentEnd forRange:NSMakeRange([[lineIndices lastObject] unsignedIntegerValue], 0)];
if (contentEnd < lineEnd)
{
- [lineIndices addObject:[NSNumber numberWithUnsignedInt:index]];
+ [lineIndices addObject:[NSNumber numberWithUnsignedInteger:index]];
}
oldThickness = [self ruleThickness];
@@ -290,9 +290,9 @@ - (void)calculateLines
}
}
-- (unsigned)lineNumberForCharacterIndex:(unsigned)index inText:(NSString *)text
+- (NSUInteger)lineNumberForCharacterIndex:(NSUInteger)index inText:(NSString *)text
{
- unsigned left, right, mid, lineStart;
+ NSUInteger left, right, mid, lineStart;
NSMutableArray *lines;
lines = [self lineIndices];
@@ -304,7 +304,7 @@ - (unsigned)lineNumberForCharacterIndex:(unsigned)index inText:(NSString *)text
while ((right - left) > 1)
{
mid = (right + left) / 2;
- lineStart = [[lines objectAtIndex:mid] unsignedIntValue];
+ lineStart = [[lines objectAtIndex:mid] unsignedIntegerValue];
if (index < lineStart)
{
@@ -340,12 +340,12 @@ - (NSDictionary *)markerTextAttributes
- (CGFloat)requiredThickness
{
- unsigned lineCount, digits, i;
+ NSUInteger lineCount, digits, i;
NSMutableString *sampleString;
NSSize stringSize;
lineCount = [[self lineIndices] count];
- digits = (unsigned)log10(lineCount) + 1;
+ digits = (NSUInteger)log10(lineCount) + 1;
sampleString = [NSMutableString string];
for (i = 0; i < digits; i++)
{
@@ -389,7 +389,7 @@ - (void)drawHashMarksAndLabelsInRect:(NSRect)aRect
NSString *text, *labelText;
NSUInteger rectCount, index, line, count;
NSRectArray rects;
- float ypos, yinset;
+ CGFloat ypos, yinset;
NSDictionary *textAttributes, *currentTextAttributes;
NSSize stringSize, markerSize;
NoodleLineNumberMarker *marker;
@@ -420,7 +420,7 @@ - (void)drawHashMarksAndLabelsInRect:(NSRect)aRect
for (line = [self lineNumberForCharacterIndex:range.location inText:text]; line < count; line++)
{
- index = [[lines objectAtIndex:line] unsignedIntValue];
+ index = [[lines objectAtIndex:line] unsignedIntegerValue];
if (NSLocationInRange(index, range))
{
@@ -435,7 +435,7 @@ - (void)drawHashMarksAndLabelsInRect:(NSRect)aRect
// portion. Need to compensate for the clipview's coordinates.
ypos = yinset + NSMinY(rects[0]) - NSMinY(visibleRect);
- marker = [linesToMarkers objectForKey:[NSNumber numberWithUnsignedInt:line]];
+ marker = [linesToMarkers objectForKey:[NSNumber numberWithUnsignedInteger:line]];
if (marker != nil)
{
@@ -500,7 +500,7 @@ - (void)addMarker:(NSRulerMarker *)aMarker
if ([aMarker isKindOfClass:[NoodleLineNumberMarker class]])
{
[linesToMarkers setObject:aMarker
- forKey:[NSNumber numberWithUnsignedInt:[(NoodleLineNumberMarker *)aMarker lineNumber] - 1]];
+ forKey:[NSNumber numberWithUnsignedInteger:[(NoodleLineNumberMarker *)aMarker lineNumber] - 1]];
}
else
{
@@ -512,7 +512,7 @@ - (void)removeMarker:(NSRulerMarker *)aMarker
{
if ([aMarker isKindOfClass:[NoodleLineNumberMarker class]])
{
- [linesToMarkers removeObjectForKey:[NSNumber numberWithUnsignedInt:[(NoodleLineNumberMarker *)aMarker lineNumber] - 1]];
+ [linesToMarkers removeObjectForKey:[NSNumber numberWithUnsignedInteger:[(NoodleLineNumberMarker *)aMarker lineNumber] - 1]];
}
else
{

0 comments on commit 44a9c46

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