Ignore:
Timestamp:
28/03/2008 22:18:44 (4 years ago)
Author:
chris
Message:

Improve logging with macros that consistently output strerror(errno) and
errno, replacing almost all use of strerror() in the main code.

Log a more detailed error message before throwing an exception for some
more system call failures.

Make FileStream? store its filename on all platforms, not just Windows.

Wrap some long lines at less than 80 characters to improve readability.

Fix some minor violations of coding standard (white space) and a typo
in a comment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/lib/common/EventWatchFilesystemObject.cpp

    r1694 r2115  
    2727// 
    2828// Function 
    29 //              Name:    EventWatchFilesystemObject::EventWatchFilesystemObject(const char *) 
    30 //              Purpose: Constructor -- opens the file object 
    31 //              Created: 12/3/04 
     29//      Name:    EventWatchFilesystemObject::EventWatchFilesystemObject 
     30//               (const char *) 
     31//      Purpose: Constructor -- opens the file object 
     32//      Created: 12/3/04 
    3233// 
    3334// -------------------------------------------------------------------------- 
     
    4041        if(mDescriptor == -1) 
    4142        { 
    42                 BOX_ERROR("EventWatchFilesystemObject: " 
    43                         "Failed to open file '" << Filename << "': " << 
    44                         strerror(errno)); 
     43                BOX_LOG_SYS_ERROR("EventWatchFilesystemObject: " 
     44                        "Failed to open file '" << Filename << "'"); 
    4545                THROW_EXCEPTION(CommonException, OSFileOpenError) 
    4646        } 
     
    5454// 
    5555// Function 
    56 //              Name:    EventWatchFilesystemObject::~EventWatchFilesystemObject() 
    57 //              Purpose: Destructor 
    58 //              Created: 12/3/04 
     56//      Name:    EventWatchFilesystemObject::~EventWatchFilesystemObject() 
     57//      Purpose: Destructor 
     58//      Created: 12/3/04 
    5959// 
    6060// -------------------------------------------------------------------------- 
     
    7171// 
    7272// Function 
    73 //              Name:    EventWatchFilesystemObject::EventWatchFilesystemObject(const EventWatchFilesystemObject &) 
    74 //              Purpose: Copy constructor 
    75 //              Created: 12/3/04 
     73//      Name:    EventWatchFilesystemObject::EventWatchFilesystemObject 
     74//               (const EventWatchFilesystemObject &) 
     75//      Purpose: Copy constructor 
     76//      Created: 12/3/04 
    7677// 
    7778// -------------------------------------------------------------------------- 
    78 EventWatchFilesystemObject::EventWatchFilesystemObject(const EventWatchFilesystemObject &rToCopy) 
     79EventWatchFilesystemObject::EventWatchFilesystemObject( 
     80        const EventWatchFilesystemObject &rToCopy) 
    7981        : mDescriptor(::dup(rToCopy.mDescriptor)) 
    8082{ 
     
    9092// 
    9193// Function 
    92 //              Name:    EventWatchFilesystemObject::FillInKEvent(struct kevent &, int) 
    93 //              Purpose: For WaitForEvent 
    94 //              Created: 12/3/04 
     94//      Name:    EventWatchFilesystemObject::FillInKEvent(struct kevent &, int) 
     95//      Purpose: For WaitForEvent 
     96//      Created: 12/3/04 
    9597// 
    9698// -------------------------------------------------------------------------- 
    97 void EventWatchFilesystemObject::FillInKEvent(struct kevent &rEvent, int Flags) const 
     99void EventWatchFilesystemObject::FillInKEvent(struct kevent &rEvent, 
     100        int Flags) const 
    98101{ 
    99         EV_SET(&rEvent, mDescriptor, EVFILT_VNODE, EV_CLEAR, NOTE_DELETE | NOTE_WRITE, 0, (void*)this); 
     102        EV_SET(&rEvent, mDescriptor, EVFILT_VNODE, EV_CLEAR, 
     103                NOTE_DELETE | NOTE_WRITE, 0, (void*)this); 
    100104} 
    101105#else 
    102 void EventWatchFilesystemObject::FillInPoll(int &fd, short &events, int Flags) const 
     106void EventWatchFilesystemObject::FillInPoll(int &fd, short &events, 
     107        int Flags) const 
    103108{ 
    104109        THROW_EXCEPTION(CommonException, KQueueNotSupportedOnThisPlatform) 
Note: See TracChangeset for help on using the changeset viewer.