Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addressing Xcode warnings #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions VDKQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,6 @@ extern NSString * VDKQueueAccessRevocationNotification;


@interface VDKQueue : NSObject
{
id<VDKQueueDelegate> _delegate;
BOOL _alwaysPostNotifications; // By default, notifications are posted only if there is no delegate set. Set this value to YES to have notes posted even when there is a delegate.

@private
int _coreQueueFD; // The actual kqueue ID (Unix file descriptor).
NSMutableDictionary *_watchedPathEntries; // List of VDKQueuePathEntries. Keys are NSStrings of the path that each VDKQueuePathEntry is for.
BOOL _keepWatcherThreadRunning; // Set to NO to cancel the thread that watches _coreQueueFD for kQueue events
}


//
Expand All @@ -139,12 +130,14 @@ extern NSString * VDKQueueAccessRevocationNotification;
- (void) removePath:(NSString *)aPath;
- (void) removeAllPaths;

/// Returns the number of paths that this VDKQueue instance is actively watching.
- (NSUInteger) numberOfWatchedPaths;

- (NSUInteger) numberOfWatchedPaths; // Returns the number of paths that this VDKQueue instance is actively watching.

@property (nonatomic, assign) id<VDKQueueDelegate> delegate;
/// By default, notifications are posted only if there is no delegate set. Set this value to YES to have notes posted even when there is a delegate.
@property (nonatomic, assign) BOOL alwaysPostNotifications;


@property (assign) id<VDKQueueDelegate> delegate;
@property (assign) BOOL alwaysPostNotifications;

@end
@end
24 changes: 16 additions & 8 deletions VDKQueue.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
// distribution.

#import "VDKQueue.h"
#import <AppKit/AppKit.h>
#import <unistd.h>
#import <fcntl.h>
#include <sys/stat.h>
Expand All @@ -43,11 +44,6 @@

// This is a simple model class used to hold info about each path we watch.
@interface VDKQueuePathEntry : NSObject
{
NSString* _path;
int _watchedFD;
u_int _subscriptionFlags;
}

- (id) initWithPath:(NSString*)inPath andSubscriptionFlags:(u_int)flags;

Expand All @@ -58,10 +54,15 @@ - (id) initWithPath:(NSString*)inPath andSubscriptionFlags:(u_int)flags;
@end

@implementation VDKQueuePathEntry
{
NSString* _path;
int _watchedFD;
u_int _subscriptionFlags;
}
@synthesize path = _path, watchedFD = _watchedFD, subscriptionFlags = _subscriptionFlags;


- (id) initWithPath:(NSString*)inPath andSubscriptionFlags:(u_int)flags;
- (id) initWithPath:(NSString*)inPath andSubscriptionFlags:(u_int)flags
{
self = [super init];
if (self)
Expand Down Expand Up @@ -113,6 +114,15 @@ - (void) watcherThread:(id)sender;


@implementation VDKQueue
{
@private
/// The actual kqueue ID (Unix file descriptor).
int _coreQueueFD;
/// List of VDKQueuePathEntries. Keys are NSStrings of the path that each VDKQueuePathEntry is for.
NSMutableDictionary *_watchedPathEntries;
/// Set to NO to cancel the thread that watches _coreQueueFD for kQueue events
BOOL _keepWatcherThreadRunning;
}
@synthesize delegate = _delegate, alwaysPostNotifications = _alwaysPostNotifications;


Expand Down Expand Up @@ -205,8 +215,6 @@ - (VDKQueuePathEntry *) addPathToQueue:(NSString *)path notifyingAbout:(u_int)fl

return [[pathEntry retain] autorelease];
}

return nil;
}


Expand Down