Skip to content

Commit

Permalink
Rename variables which shadow stdlib functions (and maxSize).
Browse files Browse the repository at this point in the history
  • Loading branch information
nriley committed Dec 20, 2009
1 parent 45caf6f commit a6075c3
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 53 deletions.
10 changes: 5 additions & 5 deletions Source/NJRQTMediaPopUpButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -432,16 +432,16 @@ - (void)_systemSoundSelected:(NSMenuItem *)sender;
- (void)_aliasSelected:(NSMenuItem *)sender;
{
BDAlias *alias = [sender representedObject];
int index = [self indexOfItem: sender], otherIndex = [self indexOfItem: otherItem];
int itemIndex = [self indexOfItem: sender], otherIndex = [self indexOfItem: otherItem];
[self _setAlias: alias];
if (![self _validateWithPreview: YES]) {
[[self menu] removeItem: sender];
} else if (index > otherIndex + 1) { // move "other" item to top of list
int recentIndex = [recentMediaAliasData count] - index + otherIndex;
NSMenuItem *item = [[self itemAtIndex: index] retain];
} else if (itemIndex > otherIndex + 1) { // move "other" item to top of list
int recentIndex = [recentMediaAliasData count] - itemIndex + otherIndex;
NSMenuItem *item = [[self itemAtIndex: itemIndex] retain];
NSData *data = [[recentMediaAliasData objectAtIndex: recentIndex] retain];
// [self _validateRecentMedia];
[self removeItemAtIndex: index];
[self removeItemAtIndex: itemIndex];
[[self menu] insertItem: item atIndex: otherIndex + 1];
[self selectItem: item];
[item release];
Expand Down
8 changes: 4 additions & 4 deletions Source/NSCalendarDate-NJRExtensions.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ + (NSCalendarDate *)dateForDay:(NSDate *)date;
timeZone: nil];
}

+ (NSCalendarDate *)dateWithDate:(NSDate *)date atTime:(NSDate *)time;
+ (NSCalendarDate *)dateWithDate:(NSDate *)aDate atTime:(NSDate *)aTime;
{
NSCalendarDate *calTime, *calDate;
if (time == nil || date == nil) return nil;
calTime = [NSCalendarDate dateWithDate: time];
calDate = [NSCalendarDate dateWithDate: date];
if (aTime == nil || aDate == nil) return nil;
calTime = [NSCalendarDate dateWithDate: aTime];
calDate = [NSCalendarDate dateWithDate: aDate];
if (calTime == nil || calDate == nil) return nil;
return [NSCalendarDate dateWithYear: [calDate yearOfCommonEra]
month: [calDate monthOfYear]
Expand Down
64 changes: 32 additions & 32 deletions Source/OACalendarView.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ - (id)initWithFrame:(NSRect)frameRect;
// These sizes will need to be adjusted if the font changes, grid or border widths change, etc. We use the controlContentFontOfSize:11.0 for the - if the control content font is changed our calculations will change and the above sizes will be incorrect. Similarly, we use the default NSTextFieldCell font/size for the month/year header, and the default NSTableHeaderCell font/size for the day of week headers; if either of those change, the aove sizes will be incorrect.

NSDateFormatter *monthAndYearFormatter;
int index;
int dayOfWeek;
NSUserDefaults *defaults;
NSArray *shortWeekDays;
NSRect buttonFrame;
Expand All @@ -97,10 +97,10 @@ - (id)initWithFrame:(NSRect)frameRect;

defaults = [NSUserDefaults standardUserDefaults];
shortWeekDays = [defaults objectForKey:NSShortWeekDayNameArray];
for (index = 0; index < OACalendarViewNumDaysPerWeek; index++) {
dayOfWeekCell[index] = [[NSTableHeaderCell alloc] init];
[dayOfWeekCell[index] setAlignment:NSCenterTextAlignment];
[dayOfWeekCell[index] setStringValue:[[shortWeekDays objectAtIndex:index] substringToIndex:1]];
for (dayOfWeek = 0; dayOfWeek < OACalendarViewNumDaysPerWeek; dayOfWeek++) {
dayOfWeekCell[dayOfWeek] = [[NSTableHeaderCell alloc] init];
[dayOfWeekCell[dayOfWeek] setAlignment:NSCenterTextAlignment];
[dayOfWeekCell[dayOfWeek] setStringValue:[[shortWeekDays objectAtIndex:dayOfWeek] substringToIndex:1]];
}

dayOfMonthCell = [[NSTextFieldCell alloc] init];
Expand Down Expand Up @@ -144,12 +144,12 @@ - (id)initWithFrame:(NSRect)frameRect;

- (void)dealloc;
{
int index;
int dayOfWeek;

[dayOfMonthCell release];

for (index = 0; index < OACalendarViewNumDaysPerWeek; index++)
[dayOfWeekCell[index] release];
for (dayOfWeek = 0; dayOfWeek < OACalendarViewNumDaysPerWeek; dayOfWeek++)
[dayOfWeekCell[dayOfWeek] release];

[monthAndYearTextFieldCell release];
[buttons release];
Expand Down Expand Up @@ -394,14 +394,14 @@ - (NSArray *)selectedDays;
{
NSMutableArray *days;
NSCalendarDate *day;
int index;
int dayOfWeek;

days = [NSMutableArray arrayWithCapacity:OACalendarViewNumDaysPerWeek];
day = [selectedDay dateByAddingYears:0 months:0 days:-[selectedDay dayOfWeek] hours:0 minutes:0 seconds:0];
for (index = 0; index < OACalendarViewNumDaysPerWeek; index++) {
for (dayOfWeek = 0; dayOfWeek < OACalendarViewNumDaysPerWeek; dayOfWeek++) {
NSCalendarDate *nextDay;

nextDay = [day dateByAddingYears:0 months:0 days:index hours:0 minutes:0 seconds:0];
nextDay = [day dateByAddingYears:0 months:0 days:dayOfWeek hours:0 minutes:0 seconds:0];
if (flags.showsDaysForOtherMonths || [nextDay monthOfYear] == [selectedDay monthOfYear])
[days addObject:nextDay];
}
Expand All @@ -414,14 +414,14 @@ - (NSArray *)selectedDays;
{
NSMutableArray *days;
NSCalendarDate *day;
int index;
int dayOfWeek;

days = [NSMutableArray arrayWithCapacity:OACalendarViewMaxNumWeeksIntersectedByMonth];
day = [selectedDay dateByAddingYears:0 months:0 days:-(([selectedDay weekOfMonth] - 1) * OACalendarViewNumDaysPerWeek) hours:0 minutes:0 seconds:0];
for (index = 0; index < OACalendarViewMaxNumWeeksIntersectedByMonth; index++) {
for (dayOfWeek = 0; dayOfWeek < OACalendarViewMaxNumWeeksIntersectedByMonth; dayOfWeek++) {
NSCalendarDate *nextDay;

nextDay = [day dateByAddingYears:0 months:0 days:(index * OACalendarViewNumDaysPerWeek) hours:0 minutes:0 seconds:0];
nextDay = [day dateByAddingYears:0 months:0 days:(dayOfWeek * OACalendarViewNumDaysPerWeek) hours:0 minutes:0 seconds:0];
if (flags.showsDaysForOtherMonths || [nextDay monthOfYear] == [selectedDay monthOfYear])
[days addObject:nextDay];
}
Expand Down Expand Up @@ -647,7 +647,7 @@ - (void)_drawDaysOfMonthInRect:(NSRect)rect;
NSRect discardRect;
int visibleMonthIndex;
NSCalendarDate *thisDay;
int index, row, column;
int cellIndex, row, column;
NSSize cellSize;
BOOL isFirstResponder = ([[self window] firstResponder] == self);

Expand All @@ -662,7 +662,7 @@ - (void)_drawDaysOfMonthInRect:(NSRect)rect;

thisDay = [visibleMonth dateByAddingYears:0 months:0 days:-[visibleMonth dayOfWeek] hours:0 minutes:0 seconds:0];

for (row = column = index = 0; index < OACalendarViewMaxNumWeeksIntersectedByMonth * OACalendarViewNumDaysPerWeek; index++) {
for (row = column = cellIndex = 0; cellIndex < OACalendarViewMaxNumWeeksIntersectedByMonth * OACalendarViewNumDaysPerWeek; cellIndex++) {
NSColor *textColor;
BOOL isVisibleMonth;

Expand Down Expand Up @@ -708,7 +708,7 @@ - (void)_drawDaysOfMonthInRect:(NSRect)rect;
if (flags.targetWatchesCellDisplay) {
[[self target] calendarView:self willDisplayCell:dayOfMonthCell forDate:thisDay];
} else {
if ((dayHighlightMask & (1 << index)) == 0) {
if ((dayHighlightMask & (1 << cellIndex)) == 0) {
textColor = (isVisibleMonth ? [NSColor blackColor] : [NSColor grayColor]);
} else {
textColor = [NSColor blueColor];
Expand Down Expand Up @@ -768,13 +768,13 @@ - (void)_drawGridInRect:(NSRect)rect;
- (float)_maximumDayOfWeekWidth;
{
float maxWidth;
int index;
int dayOfWeek;

maxWidth = 0;
for (index = 0; index < OACalendarViewNumDaysPerWeek; index++) {
for (dayOfWeek = 0; dayOfWeek < OACalendarViewNumDaysPerWeek; dayOfWeek++) {
NSSize cellSize;

cellSize = [dayOfWeekCell[index] cellSize];
cellSize = [dayOfWeekCell[dayOfWeek] cellSize];
if (maxWidth < cellSize.width)
maxWidth = cellSize.width;
}
Expand All @@ -784,27 +784,27 @@ - (float)_maximumDayOfWeekWidth;

- (NSSize)_maximumDayOfMonthSize;
{
NSSize maxSize;
int index;
NSSize maximumSize;
int dayOfMonth;

maxSize = NSZeroSize; // I'm sure the height doesn't change, but I need to know the height anyway.
for (index = 1; index <= 31; index++) {
maximumSize = NSZeroSize; // I'm sure the height doesn't change, but I need to know the height anyway.
for (dayOfMonth = 1; dayOfMonth <= 31; dayOfMonth++) {
NSString *str;
NSSize cellSize;

str = [NSString stringWithFormat:@"%d", index];
str = [NSString stringWithFormat:@"%d", dayOfMonth];
[dayOfMonthCell setStringValue:str];
cellSize = [dayOfMonthCell cellSize];
if (maxSize.width < cellSize.width)
maxSize.width = cellSize.width;
if (maxSize.height < cellSize.height)
maxSize.height = cellSize.height;
if (maximumSize.width < cellSize.width)
maximumSize.width = cellSize.width;
if (maximumSize.height < cellSize.height)
maximumSize.height = cellSize.height;
}

maxSize.width = ceil(maxSize.width);
maxSize.height = ceil(maxSize.height);
maximumSize.width = ceilf(maximumSize.width);
maximumSize.height = ceilf(maximumSize.height);

return maxSize;
return maximumSize;
}

- (float)_minimumColumnWidth;
Expand Down
10 changes: 5 additions & 5 deletions Source/PSAlarm.m
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,20 @@ - (void)setForDateAtTime:(NSCalendarDate *)dateTime;
[self _setIntervalFromDate];
}

- (void)setForDate:(NSDate *)date atTime:(NSDate *)time;
- (void)setForDate:(NSDate *)aDate atTime:(NSDate *)aTime;
{
NSCalendarDate *dateTime;
if (time == nil && date == nil) {
if (aTime == nil && aDate == nil) {
[self _beInvalid: @"Please specify an alarm date and time."]; return;
}
if (time == nil) {
if (aTime == nil) {
[self _beInvalid: @"Please specify an alarm time."]; return;
}
if (date == nil) {
if (aDate == nil) {
[self _beInvalid: @"Please specify an alarm date."]; return;
}
// XXX if calTime's date is different from the default date, complain
dateTime = [NSCalendarDate dateWithDate: date atTime: time];
dateTime = [NSCalendarDate dateWithDate: aDate atTime: aTime];
if (dateTime == nil) {
[self _beInvalid: @"Please specify a reasonable date and time."]; return;
}
Expand Down
10 changes: 5 additions & 5 deletions Source/PSAlarms.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ - (int)alarmCount;
return [alarms count];
}

- (PSAlarm *)alarmAtIndex:(int)index;
- (PSAlarm *)alarmAtIndex:(int)alarmIndex;
{
return [alarms objectAtIndex: index];
return [alarms objectAtIndex: alarmIndex];
}

- (void)removeAlarmAtIndex:(int)index;
- (void)removeAlarmAtIndex:(int)alarmIndex;
{
[(PSAlarm *)[alarms objectAtIndex: index] cancelTimer];
[alarms removeObjectAtIndex: index];
[(PSAlarm *)[alarms objectAtIndex: alarmIndex] cancelTimer];
[alarms removeObjectAtIndex: alarmIndex];
}

- (void)removeAlarmsAtIndices:(NSArray *)indices;
Expand Down
4 changes: 2 additions & 2 deletions Source/PSPowerManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ + (BOOL)autoWakeSupported;
return NO; // XXX temporary for 1.1b5
}

+ (void)setWakeTime:(NSDate *)time;
+ (void)setWakeTime:(NSDate *)wakeTime;
{
IOPMSchedulePowerEvent((CFDateRef)time, (CFStringRef)[[NSBundle mainBundle] bundleIdentifier], CFSTR(kIOPMAutoWake));
IOPMSchedulePowerEvent((CFDateRef)wakeTime, (CFStringRef)[[NSBundle mainBundle] bundleIdentifier], CFSTR(kIOPMAutoWake));
}

+ (void)clearWakeTime;
Expand Down

0 comments on commit a6075c3

Please sign in to comment.