Skip to content

Commit

Permalink
fix some warnings and podspec
Browse files Browse the repository at this point in the history
  • Loading branch information
mash committed Dec 28, 2013
1 parent d460b92 commit 0688c27
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 29 deletions.
7 changes: 4 additions & 3 deletions IRKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ Pod::Spec.new do |s|
s.author = { "Masakazu OHTSUKA" => "[email protected]" }
s.source = { :git => "https://github.com/irkit/ios-sdk.git", :tag => "1.0.1" }
s.platform = :ios, '7.0'
s.source_files = 'IRKit/IRKit/*.{h,m}'
s.source_files = 'IRKit/IRKit/*.{h,m,c}'
s.public_header_files = 'IRKit/IRKit/'
s.resources = "IRKit/IRKitResources/*"
s.frameworks = 'Foundation', 'QuartzCore', 'CoreGraphics', 'UIKit', 'MediaPlayer', 'SystemConfiguration', 'AudioToolbox', 'AudioUnit', 'AVFoundation'
s.resources = "IRKit/IRKitResources/*"
s.frameworks = 'Foundation', 'QuartzCore', 'CoreGraphics', 'UIKit', 'MediaPlayer', 'SystemConfiguration', 'AudioToolbox', 'AVFoundation'
s.library = 'c++'
s.requires_arc = true
s.dependency 'ISHTTPOperation', '~> 1.1.0'
s.dependency 'Reachability', '~> 3.1.1'
Expand Down
19 changes: 10 additions & 9 deletions IRKit/IRKit/IRHTTPClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ - (void)startPollingRequest {
}
if (self.longPollInterval > 0) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, self.longPollInterval * NSEC_PER_SEC),
dispatch_get_current_queue(), ^{
dispatch_get_main_queue(), ^{
[self startPollingRequest];
});
}
Expand Down Expand Up @@ -136,7 +136,7 @@ + (void)postSignal:(IRSignal *)signal withCompletion:(void (^)(NSError *error))c
}];
}
else {
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:payload options:nil error:nil];
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:payload options:0 error:nil];
NSString *json = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSURLRequest *request = [self makePOSTRequestToInternetPath:@"/messages"
withParams:@{ @"message" : json,
Expand Down Expand Up @@ -240,6 +240,7 @@ + (IRHTTPClient*)waitForSignalWithCompletion: (void (^)(NSHTTPURLResponse* res,
IRHTTPClient *client = [[IRHTTPClient alloc] init];
client.longPollRequest = req;
client.longPollInterval = GETMESSAGES_LONGPOLL_INTERVAL;
__weak IRHTTPClient *_client = client;
client.longPollDidFinish = (ResponseHandlerBlock)^(NSHTTPURLResponse *res, id object, NSError *error) {
LOG( @"res: %@, object: %@, error: %@", res, object, error );

Expand Down Expand Up @@ -268,9 +269,9 @@ + (IRHTTPClient*)waitForSignalWithCompletion: (void (^)(NSHTTPURLResponse* res,
}
if (doRetry) {
// remove clear=1
client.longPollRequest = [self makeGETRequestToInternetPath:@"/messages"
withParams:@{}
timeoutInterval:LONGPOLL_TIMEOUT];
_client.longPollRequest = [self makeGETRequestToInternetPath:@"/messages"
withParams:@{}
timeoutInterval:LONGPOLL_TIMEOUT];
return NO;
}
if (! error) {
Expand Down Expand Up @@ -468,7 +469,7 @@ + (NSURLRequest*)makePOSTRequestToInternetPath: (NSString*)path
NSData *data = [[self stringOfURLEncodedDictionary:realParams] dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%d", [data length]] forHTTPHeaderField:@"Content-Length"];
[request setValue:[NSString stringWithFormat:@"%lu", (unsigned long)[data length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody:data];

return request;
Expand Down Expand Up @@ -530,10 +531,10 @@ + (NSURLRequest*)makePOSTJSONRequestToLocalPath: (NSString*)path
request.cachePolicy = NSURLRequestReloadIgnoringLocalCacheData;
request.timeoutInterval = DEFAULT_TIMEOUT;

NSData *data = [NSJSONSerialization dataWithJSONObject:params options:nil error:nil];
NSData *data = [NSJSONSerialization dataWithJSONObject:params options:0 error:nil];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%d", [data length]] forHTTPHeaderField:@"Content-Length"];
[request setValue:[NSString stringWithFormat:@"%lu", (unsigned long)[data length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody:data];
return request;
}
Expand All @@ -552,7 +553,7 @@ + (NSURLRequest*)makePOSTRequestToLocalPath: (NSString*)path
NSData *data = [[self stringOfURLEncodedDictionary:params] dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%d", [data length]] forHTTPHeaderField:@"Content-Length"];
[request setValue:[NSString stringWithFormat:@"%lu", (unsigned long)[data length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody:data];
return request;
}
Expand Down
19 changes: 12 additions & 7 deletions IRKit/IRKit/IRMorsePlayerOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@

#define OUTPUT_BUS 0
#define SAMPLE_RATE 44100
#define ASSERT_OR_RETURN(status) \

#ifdef IRKIT_DEBUG
# define ASSERT_OR_RETURN(status) \
if (status) { \
NSError *e = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil]; \
LOG( @"status: %ld error: %@", status, e ); \
return; \
}
#else
# define ASSERT_OR_RETURN(status)
#endif

#define LONGEST_CHARACTER_LENGTH 7 // $
#define SOUND_SILENCE 0
Expand All @@ -36,7 +41,7 @@ @implementation IRMorsePlayerOperation {
bool *_sequence;
int _sequenceCount;
int _nextIndex;
int _remainingSamplesOfIndex;
size_t _remainingSamplesOfIndex;
size_t _samplesPerUnit;
}

Expand Down Expand Up @@ -292,9 +297,9 @@ - (void) initializeAUGraph {
audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
audioFormat.mFramesPerPacket = 1;
audioFormat.mChannelsPerFrame = 1; // MONO
audioFormat.mBitsPerChannel = bytesPerSample * 8;
audioFormat.mBytesPerPacket = bytesPerSample;
audioFormat.mBytesPerFrame = bytesPerSample;
audioFormat.mBitsPerChannel = (UInt32) bytesPerSample * 8;
audioFormat.mBytesPerPacket = (UInt32) bytesPerSample;
audioFormat.mBytesPerFrame = (UInt32) bytesPerSample;

// stream formats

Expand Down Expand Up @@ -333,8 +338,8 @@ - (void) initializeAUGraph {
}

- (void) play {
OSStatus result = AUGraphStart(_graph);
ASSERT_OR_RETURN(result);
OSStatus result __attribute__((unused)) = AUGraphStart(_graph);
LOG( @"%d", result );
}

OSStatus
Expand Down
1 change: 1 addition & 0 deletions IRKit/IRKit/IRNewPeripheralViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

@interface IRNewPeripheralViewController : UIViewController<
IRNewPeripheralScene1ViewControllerDelegate,
IRNewPeripheralScene2ViewControllerDelegate,
IRWifiEditViewControllerDelegate,
IRMorsePlayerViewControllerDelegate,
IRPeripheralNameEditViewControllerDelegate,
Expand Down
4 changes: 2 additions & 2 deletions IRKit/IRKit/IRPeripheralNameEditViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ - (BOOL) isTextValid {

NSRegularExpression *regex = [NSRegularExpression
regularExpressionWithPattern:@"^\\s*$"
options:nil
options:0
error:nil];
NSUInteger matches = [regex numberOfMatchesInString:_textField.text
options:nil
options:0
range:NSMakeRange(0,_textField.text.length)];

if (matches > 0) {
Expand Down
4 changes: 2 additions & 2 deletions IRKit/IRKit/IRSignalNameEditViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ - (BOOL) isTextValid {

NSRegularExpression *regex = [NSRegularExpression
regularExpressionWithPattern:@"^\\s*$"
options:nil
options:0
error:nil];
NSUInteger matches = [regex numberOfMatchesInString:_textField.text
options:nil
options:0
range:NSMakeRange(0,_textField.text.length)];

if (matches > 0) {
Expand Down
9 changes: 6 additions & 3 deletions IRKit/IRKit/IRSignals.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@
- (void)sendSequentiallyWithCompletion:(void (^)(NSError *error))completion;
- (NSUInteger) indexOfSignal: (IRSignal*) signal;

#pragma mark - Key Value Coding - Mutable Unordered Accessors
#pragma mark - Key Value Coding - Mutable Ordered To-Many Accessors

// Getter Indexed Accessors
- (NSArray*) signals;
- (NSUInteger) countOfSignals;
- (IRSignal*)objectInSignalsAtIndex:(NSUInteger)index;
- (IRSignal*)memberOfSignals:(IRSignal *)object;
- (void)addSignalsObject:(IRSignal *)object;

// Mutable Indexed Accessors
- (void)insertObject:(IRSignal *)object inSignalsAtIndex:(NSUInteger)index;
- (void)removeObjectFromSignalsAtIndex:(NSUInteger)index;

- (void)addSignalsObject:(IRSignal *)object;

@end
7 changes: 4 additions & 3 deletions IRKit/IRKit/IRViewCustomizer.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ - (id) init {
return nil;
}

__weak IRViewCustomizer *_self = self;
_viewDidLoad = ^(UIViewController* viewController) {
viewController.edgesForExtendedLayout = UIRectEdgeNone;
viewController.view.backgroundColor = [IRViewCustomizer defaultViewBackgroundColor];
[self customizeLabelFonts:viewController.view];
[_self customizeLabelFonts:viewController.view];

if ([viewController isKindOfClass:[IRNewSignalScene1ViewController class]] ||
[viewController isKindOfClass:[IRNewPeripheralScene1ViewController class]]) {
Expand Down Expand Up @@ -135,9 +136,9 @@ + (void)customizeNavigationBar: (UINavigationBar*)bar {

NSMutableDictionary *attributes = [NSMutableDictionary dictionaryWithDictionary: [[UINavigationBar appearance] titleTextAttributes]];
[attributes setObject:[UIFont fontWithName:@"HelveticaNeue-Light" size:20.]
forKey:UITextAttributeFont ];
forKey:NSFontAttributeName ];
[attributes setObject:[self textColor]
forKey:UITextAttributeTextColor];
forKey:NSForegroundColorAttributeName];
[bar setTitleTextAttributes: attributes];
}

Expand Down

0 comments on commit 0688c27

Please sign in to comment.