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

Rename variables which shadow stdlib functions (and maxSize).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.