Changeset 602 for trunk


Ignore:
Timestamp:
12/21/09 22:12:37 (15 years ago)
Author:
Nicholas Riley
Message:

Rename variables which shadow stdlib functions (and maxSize).

Location:
trunk/Cocoa/Pester/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source/NJRQTMediaPopUpButton.m

    r600 r602  
    433433{
    434434    BDAlias *alias = [sender representedObject];
    435     int index = [self indexOfItem: sender], otherIndex = [self indexOfItem: otherItem];
     435    int itemIndex = [self indexOfItem: sender], otherIndex = [self indexOfItem: otherItem];
    436436    [self _setAlias: alias];
    437437    if (![self _validateWithPreview: YES]) {
    438438        [[self menu] removeItem: sender];
    439     } else if (index > otherIndex + 1) { // move "other" item to top of list
    440         int recentIndex = [recentMediaAliasData count] - index + otherIndex;
    441         NSMenuItem *item = [[self itemAtIndex: index] retain];
     439    } else if (itemIndex > otherIndex + 1) { // move "other" item to top of list
     440        int recentIndex = [recentMediaAliasData count] - itemIndex + otherIndex;
     441        NSMenuItem *item = [[self itemAtIndex: itemIndex] retain];
    442442        NSData *data = [[recentMediaAliasData objectAtIndex: recentIndex] retain];
    443443        // [self _validateRecentMedia];
    444         [self removeItemAtIndex: index];
     444        [self removeItemAtIndex: itemIndex];
    445445        [[self menu] insertItem: item atIndex: otherIndex + 1];
    446446        [self selectItem: item];
  • trunk/Cocoa/Pester/Source/NSCalendarDate-NJRExtensions.m

    r53 r602  
    3131}
    3232
    33 + (NSCalendarDate *)dateWithDate:(NSDate *)date atTime:(NSDate *)time;
     33+ (NSCalendarDate *)dateWithDate:(NSDate *)aDate atTime:(NSDate *)aTime;
    3434{
    3535    NSCalendarDate *calTime, *calDate;
    36     if (time == nil || date == nil) return nil;
    37     calTime = [NSCalendarDate dateWithDate: time];
    38     calDate = [NSCalendarDate dateWithDate: date];
     36    if (aTime == nil || aDate == nil) return nil;
     37    calTime = [NSCalendarDate dateWithDate: aTime];
     38    calDate = [NSCalendarDate dateWithDate: aDate];
    3939    if (calTime == nil || calDate == nil) return nil;
    4040    return [NSCalendarDate dateWithYear: [calDate yearOfCommonEra]
  • trunk/Cocoa/Pester/Source/OACalendarView.m

    r601 r602  
    7979
    8080    NSDateFormatter *monthAndYearFormatter;
    81     int index;
     81    int dayOfWeek;
    8282    NSUserDefaults *defaults;
    8383    NSArray *shortWeekDays;
     
    9898    defaults = [NSUserDefaults standardUserDefaults];
    9999    shortWeekDays = [defaults objectForKey:NSShortWeekDayNameArray];
    100     for (index = 0; index < OACalendarViewNumDaysPerWeek; index++) {
    101         dayOfWeekCell[index] = [[NSTableHeaderCell alloc] init];
    102         [dayOfWeekCell[index] setAlignment:NSCenterTextAlignment];
    103         [dayOfWeekCell[index] setStringValue:[[shortWeekDays objectAtIndex:index] substringToIndex:1]];
     100    for (dayOfWeek = 0; dayOfWeek < OACalendarViewNumDaysPerWeek; dayOfWeek++) {
     101        dayOfWeekCell[dayOfWeek] = [[NSTableHeaderCell alloc] init];
     102        [dayOfWeekCell[dayOfWeek] setAlignment:NSCenterTextAlignment];
     103        [dayOfWeekCell[dayOfWeek] setStringValue:[[shortWeekDays objectAtIndex:dayOfWeek] substringToIndex:1]];
    104104    }
    105105
     
    145145- (void)dealloc;
    146146{
    147     int index;
     147    int dayOfWeek;
    148148
    149149    [dayOfMonthCell release];
    150150
    151     for (index = 0; index < OACalendarViewNumDaysPerWeek; index++)
    152         [dayOfWeekCell[index] release];
     151    for (dayOfWeek = 0; dayOfWeek < OACalendarViewNumDaysPerWeek; dayOfWeek++)
     152        [dayOfWeekCell[dayOfWeek] release];
    153153
    154154    [monthAndYearTextFieldCell release];
     
    395395                NSMutableArray *days;
    396396                NSCalendarDate *day;
    397                 int index;
     397                int dayOfWeek;
    398398               
    399399                days = [NSMutableArray arrayWithCapacity:OACalendarViewNumDaysPerWeek];
    400400                day = [selectedDay dateByAddingYears:0 months:0 days:-[selectedDay dayOfWeek] hours:0 minutes:0 seconds:0];
    401                 for (index = 0; index < OACalendarViewNumDaysPerWeek; index++) {
     401                for (dayOfWeek = 0; dayOfWeek < OACalendarViewNumDaysPerWeek; dayOfWeek++) {
    402402                    NSCalendarDate *nextDay;
    403403
    404                     nextDay = [day dateByAddingYears:0 months:0 days:index hours:0 minutes:0 seconds:0];
     404                    nextDay = [day dateByAddingYears:0 months:0 days:dayOfWeek hours:0 minutes:0 seconds:0];
    405405                    if (flags.showsDaysForOtherMonths || [nextDay monthOfYear] == [selectedDay monthOfYear])
    406406                        [days addObject:nextDay];                   
     
    415415                NSMutableArray *days;
    416416                NSCalendarDate *day;
    417                 int index;
     417                int dayOfWeek;
    418418               
    419419                days = [NSMutableArray arrayWithCapacity:OACalendarViewMaxNumWeeksIntersectedByMonth];
    420420                day = [selectedDay dateByAddingYears:0 months:0 days:-(([selectedDay weekOfMonth] - 1) * OACalendarViewNumDaysPerWeek) hours:0 minutes:0 seconds:0];
    421                 for (index = 0; index < OACalendarViewMaxNumWeeksIntersectedByMonth; index++) {
     421                for (dayOfWeek = 0; dayOfWeek < OACalendarViewMaxNumWeeksIntersectedByMonth; dayOfWeek++) {
    422422                    NSCalendarDate *nextDay;
    423423
    424                     nextDay = [day dateByAddingYears:0 months:0 days:(index * OACalendarViewNumDaysPerWeek) hours:0 minutes:0 seconds:0];
     424                    nextDay = [day dateByAddingYears:0 months:0 days:(dayOfWeek * OACalendarViewNumDaysPerWeek) hours:0 minutes:0 seconds:0];
    425425                    if (flags.showsDaysForOtherMonths || [nextDay monthOfYear] == [selectedDay monthOfYear])
    426426                        [days addObject:nextDay];
     
    648648    int visibleMonthIndex;
    649649    NSCalendarDate *thisDay;
    650     int index, row, column;
     650    int cellIndex, row, column;
    651651    NSSize cellSize;
    652652    BOOL isFirstResponder = ([[self window] firstResponder] == self);
     
    663663    thisDay = [visibleMonth dateByAddingYears:0 months:0 days:-[visibleMonth dayOfWeek] hours:0 minutes:0 seconds:0];
    664664
    665     for (row = column = index = 0; index < OACalendarViewMaxNumWeeksIntersectedByMonth * OACalendarViewNumDaysPerWeek; index++) {
     665    for (row = column = cellIndex = 0; cellIndex < OACalendarViewMaxNumWeeksIntersectedByMonth * OACalendarViewNumDaysPerWeek; cellIndex++) {
    666666        NSColor *textColor;
    667667        BOOL isVisibleMonth;
     
    709709                [[self target] calendarView:self willDisplayCell:dayOfMonthCell forDate:thisDay];
    710710            } else {
    711                 if ((dayHighlightMask & (1 << index)) == 0) {
     711                if ((dayHighlightMask & (1 << cellIndex)) == 0) {
    712712                    textColor = (isVisibleMonth ? [NSColor blackColor] : [NSColor grayColor]);
    713713                } else {
     
    769769{
    770770    float maxWidth;
    771     int index;
     771    int dayOfWeek;
    772772
    773773    maxWidth = 0;
    774     for (index = 0; index < OACalendarViewNumDaysPerWeek; index++) {
     774    for (dayOfWeek = 0; dayOfWeek < OACalendarViewNumDaysPerWeek; dayOfWeek++) {
    775775        NSSize cellSize;
    776776
    777         cellSize = [dayOfWeekCell[index] cellSize];
     777        cellSize = [dayOfWeekCell[dayOfWeek] cellSize];
    778778        if (maxWidth < cellSize.width)
    779779            maxWidth = cellSize.width;
     
    785785- (NSSize)_maximumDayOfMonthSize;
    786786{
    787     NSSize maxSize;
    788     int index;
    789 
    790     maxSize = NSZeroSize; // I'm sure the height doesn't change, but I need to know the height anyway.
    791     for (index = 1; index <= 31; index++) {
     787    NSSize maximumSize;
     788    int dayOfMonth;
     789
     790    maximumSize = NSZeroSize; // I'm sure the height doesn't change, but I need to know the height anyway.
     791    for (dayOfMonth = 1; dayOfMonth <= 31; dayOfMonth++) {
    792792        NSString *str;
    793793        NSSize cellSize;
    794794
    795         str = [NSString stringWithFormat:@"%d", index];
     795        str = [NSString stringWithFormat:@"%d", dayOfMonth];
    796796        [dayOfMonthCell setStringValue:str];
    797797        cellSize = [dayOfMonthCell cellSize];
    798         if (maxSize.width < cellSize.width)
    799             maxSize.width = cellSize.width;
    800         if (maxSize.height < cellSize.height)
    801             maxSize.height = cellSize.height;
    802     }
    803 
    804     maxSize.width = ceil(maxSize.width);
    805     maxSize.height = ceil(maxSize.height);
    806 
    807     return maxSize;
     798        if (maximumSize.width < cellSize.width)
     799            maximumSize.width = cellSize.width;
     800        if (maximumSize.height < cellSize.height)
     801            maximumSize.height = cellSize.height;
     802    }
     803
     804    maximumSize.width = ceilf(maximumSize.width);
     805    maximumSize.height = ceilf(maximumSize.height);
     806
     807    return maximumSize;
    808808}
    809809
  • trunk/Cocoa/Pester/Source/PSAlarm.m

    r587 r602  
    171171}
    172172
    173 - (void)setForDate:(NSDate *)date atTime:(NSDate *)time;
     173- (void)setForDate:(NSDate *)aDate atTime:(NSDate *)aTime;
    174174{
    175175    NSCalendarDate *dateTime;
    176     if (time == nil && date == nil) {
     176    if (aTime == nil && aDate == nil) {
    177177        [self _beInvalid: @"Please specify an alarm date and time."]; return;
    178178    }
    179     if (time == nil) {
     179    if (aTime == nil) {
    180180        [self _beInvalid: @"Please specify an alarm time."]; return;
    181181    }
    182     if (date == nil) {
     182    if (aDate == nil) {
    183183        [self _beInvalid: @"Please specify an alarm date."]; return;
    184184    }
    185185    // XXX if calTime's date is different from the default date, complain
    186     dateTime = [NSCalendarDate dateWithDate: date atTime: time];
     186    dateTime = [NSCalendarDate dateWithDate: aDate atTime: aTime];
    187187    if (dateTime == nil) {
    188188        [self _beInvalid: @"Please specify a reasonable date and time."]; return;
  • trunk/Cocoa/Pester/Source/PSAlarms.m

    r364 r602  
    161161}
    162162
    163 - (PSAlarm *)alarmAtIndex:(int)index;
    164 {
    165     return [alarms objectAtIndex: index];
    166 }
    167 
    168 - (void)removeAlarmAtIndex:(int)index;
    169 {
    170     [(PSAlarm *)[alarms objectAtIndex: index] cancelTimer];
    171     [alarms removeObjectAtIndex: index];
     163- (PSAlarm *)alarmAtIndex:(int)alarmIndex;
     164{
     165    return [alarms objectAtIndex: alarmIndex];
     166}
     167
     168- (void)removeAlarmAtIndex:(int)alarmIndex;
     169{
     170    [(PSAlarm *)[alarms objectAtIndex: alarmIndex] cancelTimer];
     171    [alarms removeObjectAtIndex: alarmIndex];
    172172}
    173173
  • trunk/Cocoa/Pester/Source/PSPowerManager.m

    r361 r602  
    2020}
    2121
    22 + (void)setWakeTime:(NSDate *)time;
     22+ (void)setWakeTime:(NSDate *)wakeTime;
    2323{
    24     IOPMSchedulePowerEvent((CFDateRef)time, (CFStringRef)[[NSBundle mainBundle] bundleIdentifier], CFSTR(kIOPMAutoWake));
     24    IOPMSchedulePowerEvent((CFDateRef)wakeTime, (CFStringRef)[[NSBundle mainBundle] bundleIdentifier], CFSTR(kIOPMAutoWake));
    2525}
    2626
Note: See TracChangeset for help on using the changeset viewer.