Changes as a result of recent Apple recommendations surrounding support for 64 bit and modern Objective-C syntax. Also some cleanup of unused imports in implementation files.
git-svn-id: https://svn.apache.org/repos/asf/chemistry/objectivecmis/trunk@1576003 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ObjectiveCMIS.xcodeproj/project.pbxproj b/ObjectiveCMIS.xcodeproj/project.pbxproj
index 9db267b..4405874 100644
--- a/ObjectiveCMIS.xcodeproj/project.pbxproj
+++ b/ObjectiveCMIS.xcodeproj/project.pbxproj
@@ -1091,6 +1091,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
@@ -1114,7 +1115,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 5.1;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
ONLY_ACTIVE_ARCH = YES;
"OTHER_CFLAGS[arch=*]" = "-DDEBUG";
SDKROOT = iphoneos;
@@ -1126,6 +1127,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
@@ -1143,7 +1145,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 5.1;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.1.1;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m
index 395dc59..9549435 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomEntryParser.m
@@ -267,7 +267,7 @@
withObject:self withObject:self.objectData];
}
- // Reseting our parent as the delegate since we're done
+ // Resetting our parent as the delegate since we're done
parser.delegate = self.parentDelegate;
self.parentDelegate = nil;
}
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomFeedParser.h b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomFeedParser.h
index 97241f6..8204fb3 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomFeedParser.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomFeedParser.h
@@ -39,7 +39,7 @@
/**
* Number of items will be returned when executing a query.
*/
-@property (readonly) NSInteger numItems;
+@property (readonly) int numItems;
/// designated initialiser
- (id)initWithData:(NSData*)feedData;
diff --git a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomFeedParser.m b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomFeedParser.m
index 07499ee..1a661b0 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomFeedParser.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/AtomPubParser/CMISAtomFeedParser.m
@@ -23,7 +23,7 @@
@interface CMISAtomFeedParser ()
@property (nonatomic, strong, readwrite) NSData *feedData;
@property (nonatomic, strong, readwrite) NSMutableArray *internalEntries;
-@property (readwrite) NSInteger numItems;
+@property (readwrite) int numItems;
@property (nonatomic, strong, readwrite) NSMutableSet *feedLinkRelations;
@property (nonatomic, strong, readwrite) id childParserDelegate;
@property (nonatomic, strong) NSMutableString *string;
@@ -105,7 +105,7 @@
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
if ([elementName isEqualToString:kCMISAtomFeedNumItems]) {
- self.numItems = [self.string integerValue];
+ self.numItems = [self.string intValue];
}
self.string = nil;
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m
index 39d4833..5ffad33 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectService.m
@@ -22,12 +22,10 @@
#import "CMISHttpResponse.h"
#import "CMISAtomEntryWriter.h"
#import "CMISAtomEntryParser.h"
-#import "CMISConstants.h"
#import "CMISErrors.h"
#import "CMISStringInOutParameter.h"
#import "CMISURLUtil.h"
#import "CMISFileUtil.h"
-#import "CMISRequest.h"
#import "CMISLog.h"
@implementation CMISAtomPubObjectService
@@ -311,7 +309,7 @@
} else {
CMISLogError(@"Invalid http response status code when updating content: %d", httpResponse.statusCode);
error = [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime
- detailedDescription:[NSString stringWithFormat:@"Could not update content: http status code %d", httpResponse.statusCode]];
+ detailedDescription:[NSString stringWithFormat:@"Could not update content: http status code %li", (long)httpResponse.statusCode]];
}
}
if (completionBlock) {
@@ -737,7 +735,7 @@
CMISLogError(@"Error content: %@", [[NSString alloc] initWithData:response.data encoding:NSUTF8StringEncoding]);
if (completionBlock) {
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime
- detailedDescription:[NSString stringWithFormat:@"Could not create content: http status code %d", response.statusCode]]);
+ detailedDescription:[NSString stringWithFormat:@"Could not create content: http status code %li", (long)response.statusCode]]);
}
}
}
@@ -821,7 +819,7 @@
CMISLogError(@"Error content: %@", [[NSString alloc] initWithData:response.data encoding:NSUTF8StringEncoding]);
if (completionBlock) {
completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime
- detailedDescription:[NSString stringWithFormat:@"Could not create content: http status code %d", response.statusCode]]);
+ detailedDescription:[NSString stringWithFormat:@"Could not create content: http status code %li", (long)response.statusCode]]);
}
}
}
diff --git a/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByIdUriBuilder.h b/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByIdUriBuilder.h
index 1c45a5a..2b1e6e6 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByIdUriBuilder.h
+++ b/ObjectiveCMIS/Bindings/AtomPub/CMISObjectByIdUriBuilder.h
@@ -22,13 +22,13 @@
#import "CMISEnums.h"
-typedef enum
+typedef NS_ENUM(NSInteger, CMISReturnVersion)
{
NOT_PROVIDED,
THIS,
LATEST,
LATEST_MAJOR
-} CMISReturnVersion;
+};
@interface CMISObjectByIdUriBuilder : NSObject
diff --git a/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISWorkspace.m b/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISWorkspace.m
index a5a4260..3d13328 100644
--- a/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISWorkspace.m
+++ b/ObjectiveCMIS/Bindings/AtomPub/Objects/CMISWorkspace.m
@@ -18,8 +18,6 @@
*/
#import "CMISWorkspace.h"
-#import "CMISRepositoryInfo.h"
-#import "CMISSessionParameters.h"
#import "CMISAtomCollection.h"
@implementation CMISWorkspace
diff --git a/ObjectiveCMIS/Bindings/CMISObjectList.h b/ObjectiveCMIS/Bindings/CMISObjectList.h
index dbc97e2..20bd957 100644
--- a/ObjectiveCMIS/Bindings/CMISObjectList.h
+++ b/ObjectiveCMIS/Bindings/CMISObjectList.h
@@ -46,6 +46,6 @@
* The value in the parameter MAY NOT be accurate the next time the client retrieves the result set
* or the next page in the result set.
*/
-@property NSInteger numItems;
+@property int numItems;
@end
\ No newline at end of file
diff --git a/ObjectiveCMIS/Client/CMISDocument.m b/ObjectiveCMIS/Client/CMISDocument.m
index 77fc51e..e3f1111 100644
--- a/ObjectiveCMIS/Client/CMISDocument.m
+++ b/ObjectiveCMIS/Client/CMISDocument.m
@@ -22,7 +22,6 @@
#import "CMISObjectConverter.h"
#import "CMISStringInOutParameter.h"
#import "CMISOperationContext.h"
-#import "CMISFileUtil.h"
#import "CMISErrors.h"
#import "CMISRequest.h"
#import "CMISSession.h"
diff --git a/ObjectiveCMIS/Client/CMISObject.m b/ObjectiveCMIS/Client/CMISObject.m
index 30652df..5fed464 100644
--- a/ObjectiveCMIS/Client/CMISObject.m
+++ b/ObjectiveCMIS/Client/CMISObject.m
@@ -75,9 +75,9 @@
// Extract Extensions and store in the extensionsDict
self.extensionsDict = [[NSMutableDictionary alloc] init];
- [self.extensionsDict setObject:[self nonNilArray:objectData.extensions] forKey:[NSNumber numberWithInt:CMISExtensionLevelObject]];
- [self.extensionsDict setObject:[self nonNilArray:self.properties.extensions] forKey:[NSNumber numberWithInt:CMISExtensionLevelProperties]];
- [self.extensionsDict setObject:[self nonNilArray:self.allowableActions.extensions] forKey:[NSNumber numberWithInt:CMISExtensionLevelAllowableActions]];
+ [self.extensionsDict setObject:[self nonNilArray:objectData.extensions] forKey:[NSNumber numberWithInteger:CMISExtensionLevelObject]];
+ [self.extensionsDict setObject:[self nonNilArray:self.properties.extensions] forKey:[NSNumber numberWithInteger:CMISExtensionLevelProperties]];
+ [self.extensionsDict setObject:[self nonNilArray:self.allowableActions.extensions] forKey:[NSNumber numberWithInteger:CMISExtensionLevelAllowableActions]];
// Renditions must be converted here, because they need access to the session
if (objectData.renditions != nil) {
@@ -157,7 +157,7 @@
{
// TODO Need to implement the following extension levels CMISExtensionLevelAcl, CMISExtensionLevelPolicies, CMISExtensionLevelChangeEvent
- return [self.extensionsDict objectForKey:[NSNumber numberWithInt:extensionLevel]];
+ return [self.extensionsDict objectForKey:[NSNumber numberWithInteger:extensionLevel]];
}
@end
diff --git a/ObjectiveCMIS/Client/CMISOperationContext.h b/ObjectiveCMIS/Client/CMISOperationContext.h
index e6b9452..45476fe 100644
--- a/ObjectiveCMIS/Client/CMISOperationContext.h
+++ b/ObjectiveCMIS/Client/CMISOperationContext.h
@@ -31,8 +31,8 @@
@property (nonatomic, strong) NSString *renditionFilterString;
@property (nonatomic, strong) NSString *orderBy;
@property (nonatomic, assign) BOOL includePathSegments;
-@property (nonatomic, assign) NSInteger maxItemsPerPage;
-@property (nonatomic, assign) NSInteger skipCount;
+@property (nonatomic, assign) int maxItemsPerPage;
+@property (nonatomic, assign) int skipCount;
/**
* creates a default operationContext instance. The defaults are
diff --git a/ObjectiveCMIS/Client/CMISPagedResult.h b/ObjectiveCMIS/Client/CMISPagedResult.h
index d8ff002..6d0947b 100644
--- a/ObjectiveCMIS/Client/CMISPagedResult.h
+++ b/ObjectiveCMIS/Client/CMISPagedResult.h
@@ -26,7 +26,7 @@
@property (nonatomic, strong) NSArray *resultArray;
@property BOOL hasMoreItems;
-@property NSInteger numItems;
+@property int numItems;
@end
@@ -42,14 +42,14 @@
@property (nonatomic, strong, readonly) NSArray *resultArray;
@property (readonly) BOOL hasMoreItems;
-@property (readonly) NSInteger numItems;
+@property (readonly) int numItems;
/**
* completionBlock returns paged results or nil if unsuccessful
*/
+ (void)pagedResultUsingFetchBlock:(CMISFetchNextPageBlock)fetchNextPageBlock
- limitToMaxItems:(NSInteger)maxItems
- startFromSkipCount:(NSInteger)skipCount
+ limitToMaxItems:(int)maxItems
+ startFromSkipCount:(int)skipCount
completionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock;
/**
diff --git a/ObjectiveCMIS/Client/CMISPagedResult.m b/ObjectiveCMIS/Client/CMISPagedResult.m
index 1080560..f6438e0 100644
--- a/ObjectiveCMIS/Client/CMISPagedResult.m
+++ b/ObjectiveCMIS/Client/CMISPagedResult.m
@@ -35,9 +35,9 @@
@property (nonatomic, strong, readwrite) NSArray *resultArray;
@property (readwrite) BOOL hasMoreItems;
-@property (readwrite) NSInteger numItems;
-@property (readwrite) NSInteger maxItems;
-@property (readwrite) NSInteger skipCount;
+@property (readwrite) int numItems;
+@property (readwrite) int maxItems;
+@property (readwrite) int skipCount;
@property (nonatomic, copy) CMISFetchNextPageBlock fetchNextPageBlock;
@@ -53,10 +53,10 @@
/** Internal init */
- (id)initWithResultArray:(NSArray *)resultArray
retrievedUsingFetchBlock:(CMISFetchNextPageBlock)fetchNextPageBlock
- numItems:(NSInteger)numItems
+ numItems:(int)numItems
hasMoreItems:(BOOL)hasMoreItems
- maxItems:(NSInteger)maxItems
- skipCount:(NSInteger)skipCount;
+ maxItems:(int)maxItems
+ skipCount:(int)skipCount;
{
self = [super init];
if (self) {
@@ -71,8 +71,8 @@
}
+ (void)pagedResultUsingFetchBlock:(CMISFetchNextPageBlock)fetchNextPageBlock
- limitToMaxItems:(NSInteger)maxItems
- startFromSkipCount:(NSInteger)skipCount
+ limitToMaxItems:(int)maxItems
+ startFromSkipCount:(int)skipCount
completionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock
{
// Fetch the first requested page
@@ -95,7 +95,7 @@
{
[CMISPagedResult pagedResultUsingFetchBlock:self.fetchNextPageBlock
limitToMaxItems:self.maxItems
- startFromSkipCount:(self.skipCount + self.resultArray.count)
+ startFromSkipCount:(self.skipCount + (int)self.resultArray.count)
completionBlock:completionBlock];
}
diff --git a/ObjectiveCMIS/Client/CMISSession.m b/ObjectiveCMIS/Client/CMISSession.m
index dc10758..15d94c6 100644
--- a/ObjectiveCMIS/Client/CMISSession.m
+++ b/ObjectiveCMIS/Client/CMISSession.m
@@ -29,7 +29,6 @@
#import "CMISRequest.h"
#import "CMISPagedResult.h"
#import "CMISTypeDefinition.h"
-#import "CMISNetworkProvider.h"
#import "CMISDefaultNetworkProvider.h"
#import "CMISLog.h"
@@ -42,7 +41,7 @@
// Returns a CMISSession using the given session parameters.
- (id)initWithSessionParameters:(CMISSessionParameters *)sessionParameters;
-// Authenticates using the CMISSessionParameters and returns if the authentication was succesful
+// Authenticates using the CMISSessionParameters and returns if the authentication was successful
- (CMISRequest*)authenticateWithCompletionBlock:(void (^)(CMISSession *session, NSError * error))completionBlock;
@end
diff --git a/ObjectiveCMIS/Common/CMISAllowableActions.m b/ObjectiveCMIS/Common/CMISAllowableActions.m
index 0b61aa6..4bfeb45 100644
--- a/ObjectiveCMIS/Common/CMISAllowableActions.m
+++ b/ObjectiveCMIS/Common/CMISAllowableActions.m
@@ -20,7 +20,7 @@
#import "CMISAllowableActions.h"
#import "CMISEnums.h"
-#define INT_OBJ(x) [NSNumber numberWithInt:x]
+#define INT_OBJ(x) [NSNumber numberWithInteger:x]
@interface CMISAllowableActions ()
diff --git a/ObjectiveCMIS/Common/CMISEnums.h b/ObjectiveCMIS/Common/CMISEnums.h
index aa156ee..11dda73 100644
--- a/ObjectiveCMIS/Common/CMISEnums.h
+++ b/ObjectiveCMIS/Common/CMISEnums.h
@@ -20,31 +20,31 @@
#import <Foundation/Foundation.h>
// Binding type
-typedef enum
+typedef NS_ENUM(NSInteger, CMISBindingType)
{
CMISBindingTypeAtomPub,
CMISBindingTypeCustom
-} CMISBindingType;
+};
// Base type
-typedef enum
+typedef NS_ENUM(NSInteger, CMISBaseType)
{
CMISBaseTypeDocument,
CMISBaseTypeFolder,
CMISBaseTypeRelationship,
CMISBaseTypePolicy
-} CMISBaseType;
+};
-typedef enum
+typedef NS_ENUM(NSInteger, CMISIncludeRelationship)
{
CMISIncludeRelationshipNone,
CMISIncludeRelationshipSource,
CMISIncludeRelationshipTarget,
CMISIncludeRelationshipBoth
-} CMISIncludeRelationship;
+};
// Property types
-typedef enum
+typedef NS_ENUM(NSInteger, CMISPropertyType)
{
CMISPropertyTypeBoolean = 0,
CMISPropertyTypeId,
@@ -54,26 +54,26 @@
CMISPropertyTypeHtml,
CMISPropertyTypeString,
CMISPropertyTypeUri
-} CMISPropertyType;
+};
// Property cardinality options
-typedef enum
+typedef NS_ENUM(NSInteger, CMISCardinality)
{
CMISCardinalitySingle,
CMISCardinalityMulti
-} CMISCardinality;
+};
// Property updatability options
-typedef enum
+typedef NS_ENUM(NSInteger, CMISUpdatability)
{
CMISUpdatabilityReadOnly,
CMISUpdatabilityReadWrite,
CMISUpdatabilityWhenCheckedOut,
CMISUpdatabilityOnCreate
-} CMISUpdatability;
+};
// Allowable action type
-typedef enum
+typedef NS_ENUM(NSInteger, CMISActionType)
{
CMISActionCanDeleteObject,
CMISActionCanUpdateProperties,
@@ -104,7 +104,7 @@
CMISActionCanGetRenditions,
CMISActionCanGetACL,
CMISActionCanApplyACL
-} CMISActionType;
+};
// AllowableAction String Array, the objects defined MUST be in the same order as those in enum CMISActionType
#define CMISAllowableActionsArray @"canDeleteObject", @"canUpdateProperties", @"canGetProperties", \
@@ -116,7 +116,7 @@
@"canCreateRelationship", @"canDeleteTree", @"canGetRenditions", @"canGetACL", @"canApplyACL", nil
// Extension Levels
-typedef enum
+typedef NS_ENUM(NSInteger, CMISExtensionLevel)
{
CMISExtensionLevelObject,
CMISExtensionLevelProperties,
@@ -124,23 +124,23 @@
// TODO expose the remaining extensions as they are implemented
// CMISExtensionLevelAcl, CMISExtensionLevelPolicies, CMISExtensionLevelChangeEvent
-} CMISExtensionLevel;
+};
// UnfileObject
-typedef enum
+typedef NS_ENUM(NSInteger, CMISUnfileObject)
{
CMISUnfile,
CMISDeleteSingleFiled,
CMISDelete, // default
-} CMISUnfileObject;
+};
// ContentStreamAllowed
-typedef enum
+typedef NS_ENUM(NSInteger, CMISContentStreamAllowedType)
{
CMISContentStreamNotAllowed,
CMISContentStreamAllowed,
CMISContentStreamRequired
-} CMISContentStreamAllowedType;
+};
@interface CMISEnums : NSObject
diff --git a/ObjectiveCMIS/Common/CMISErrors.h b/ObjectiveCMIS/Common/CMISErrors.h
index 1bd6dd7..5bc7374 100644
--- a/ObjectiveCMIS/Common/CMISErrors.h
+++ b/ObjectiveCMIS/Common/CMISErrors.h
@@ -25,7 +25,7 @@
/** error codes defined in CMIS
*/
-typedef enum
+typedef NS_ENUM(NSInteger, CMISErrorCodes)
{
//error range for basic errors - not covered in the spec but
// present in the OpenCMIS Java lib
@@ -67,7 +67,7 @@
kCMISErrorCodeUpdateConflict = 518,
kCMISErrorCodeVersioning = 519
-}CMISErrorCodes;
+};
extern NSString * const kCMISErrorDomainName;
diff --git a/ObjectiveCMIS/Common/CMISNetworkProvider.h b/ObjectiveCMIS/Common/CMISNetworkProvider.h
index 28be679..d01ee87 100644
--- a/ObjectiveCMIS/Common/CMISNetworkProvider.h
+++ b/ObjectiveCMIS/Common/CMISNetworkProvider.h
@@ -14,12 +14,13 @@
#import <Foundation/Foundation.h>
#import "CMISProperties.h"
-typedef enum {
+typedef NS_ENUM(NSInteger, CMISHttpRequestMethod)
+{
HTTP_GET,
HTTP_POST,
HTTP_PUT,
HTTP_DELETE
-} CMISHttpRequestMethod;
+};
@class CMISBindingSession, CMISRequest, CMISHttpResponse;
diff --git a/ObjectiveCMIS/Common/CMISObjectData.m b/ObjectiveCMIS/Common/CMISObjectData.m
index 461f27a..082d599 100644
--- a/ObjectiveCMIS/Common/CMISObjectData.m
+++ b/ObjectiveCMIS/Common/CMISObjectData.m
@@ -18,7 +18,6 @@
*/
#import "CMISObjectData.h"
-#import "CMISRenditionData.h"
@implementation CMISObjectData
diff --git a/ObjectiveCMIS/Common/CMISSessionParameters.m b/ObjectiveCMIS/Common/CMISSessionParameters.m
index ac27f9e..f1176c8 100644
--- a/ObjectiveCMIS/Common/CMISSessionParameters.m
+++ b/ObjectiveCMIS/Common/CMISSessionParameters.m
@@ -50,8 +50,8 @@
- (NSString *)description
{
- return [NSString stringWithFormat:@"bindingType: %u, username: %@, password: %@, atomPubUrl: %@",
- self.bindingType, self.username, self.password, self.atomPubUrl];
+ return [NSString stringWithFormat:@"bindingType: %li, username: %@, password: %@, atomPubUrl: %@",
+ (long)self.bindingType, self.username, self.password, self.atomPubUrl];
}
- (NSArray *)allKeys
diff --git a/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.m b/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.m
index ce17816..5506ae7 100644
--- a/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.m
+++ b/ObjectiveCMIS/Common/CMISStandardAuthenticationProvider.m
@@ -58,9 +58,8 @@
NSString *encodedLoginData = [CMISBase64Encoder stringByEncodingText:[loginString dataUsingEncoding:NSUTF8StringEncoding]];
NSString *authHeader = [NSString stringWithFormat:@"Basic %@", encodedLoginData];
return [NSDictionary dictionaryWithObject:authHeader forKey:@"Authorization"];
- } else {
- return [NSDictionary dictionary];
}
+ return [NSDictionary dictionary];
}
@@ -69,7 +68,7 @@
// default implementation mimics default NSURLConnectionDelegate behavior
NSString *authenticationMethod = protectionSpace.authenticationMethod;
if ([authenticationMethod isEqualToString:NSURLAuthenticationMethodClientCertificate] && self.credential.identity) {
- return YES; // client certificat requested and certificate identity available
+ return YES; // client certificate requested and certificate identity available
}
if ([authenticationMethod isEqualToString:NSURLAuthenticationMethodHTTPBasic] && self.credential.user && self.credential.hasPassword) {
return YES; // basic authentication requested and username & password available
diff --git a/ObjectiveCMIS/Common/CMISStandardUntrustedSSLAuthenticationProvider.m b/ObjectiveCMIS/Common/CMISStandardUntrustedSSLAuthenticationProvider.m
index 2fbad88..455e4cd 100644
--- a/ObjectiveCMIS/Common/CMISStandardUntrustedSSLAuthenticationProvider.m
+++ b/ObjectiveCMIS/Common/CMISStandardUntrustedSSLAuthenticationProvider.m
@@ -25,9 +25,8 @@
{
if ([protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
return YES;
- } else {
- return [super canAuthenticateAgainstProtectionSpace:protectionSpace];
}
+ return [super canAuthenticateAgainstProtectionSpace:protectionSpace];
}
/**
diff --git a/ObjectiveCMIS/Utils/CMISBase64Encoder.m b/ObjectiveCMIS/Utils/CMISBase64Encoder.m
index 1ea5dd3..a8f5131 100644
--- a/ObjectiveCMIS/Utils/CMISBase64Encoder.m
+++ b/ObjectiveCMIS/Utils/CMISBase64Encoder.m
@@ -33,14 +33,14 @@
+ (NSData *)dataByEncodingText:(NSData *)plainText
{
- uint encodedLength = (4 * (([plainText length] / 3) + (1 - (3 - ([plainText length] % 3)) / 3)));
+ NSUInteger encodedLength = (4 * (([plainText length] / 3) + (1 - (3 - ([plainText length] % 3)) / 3)));
NSMutableData *encodedData = [[NSMutableData alloc] initWithLength:encodedLength];
char *outputBuffer = encodedData.mutableBytes;
unsigned char *inputBuffer = (unsigned char *) [plainText bytes];
NSInteger i;
NSInteger j = 0;
- int remain;
+ NSUInteger remain;
for (i = 0; i < [plainText length]; i += 3) {
remain = [plainText length] - i;
diff --git a/ObjectiveCMIS/Utils/CMISDefaultNetworkProvider.m b/ObjectiveCMIS/Utils/CMISDefaultNetworkProvider.m
index d9dc91f..9f0af51 100644
--- a/ObjectiveCMIS/Utils/CMISDefaultNetworkProvider.m
+++ b/ObjectiveCMIS/Utils/CMISDefaultNetworkProvider.m
@@ -13,14 +13,10 @@
*/
#import "CMISDefaultNetworkProvider.h"
-#import "CMISAuthenticationProvider.h"
#import "CMISErrors.h"
#import "CMISHttpRequest.h"
#import "CMISHttpDownloadRequest.h"
#import "CMISHttpUploadRequest.h"
-#import "CMISRequest.h"
-#import "CMISSessionParameters.h"
-#import "CMISNetworkProvider.h"
#import "CMISLog.h"
@interface CMISDefaultNetworkProvider ()
diff --git a/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m b/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m
index 94f37ec..172bb10 100644
--- a/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m
+++ b/ObjectiveCMIS/Utils/CMISHttpDownloadRequest.m
@@ -50,7 +50,7 @@
httpRequest.bytesExpected = bytesExpected;
httpRequest.authenticationProvider = authenticationProvider;
- if ([httpRequest startRequest:urlRequest] == NO) {
+ if (![httpRequest startRequest:urlRequest]) {
httpRequest = nil;
};
diff --git a/ObjectiveCMIS/Utils/CMISHttpRequest.m b/ObjectiveCMIS/Utils/CMISHttpRequest.m
index c79f931..95cd9a1 100644
--- a/ObjectiveCMIS/Utils/CMISHttpRequest.m
+++ b/ObjectiveCMIS/Utils/CMISHttpRequest.m
@@ -20,7 +20,6 @@
#import "CMISHttpRequest.h"
#import "CMISHttpResponse.h"
#import "CMISErrors.h"
-#import "CMISAuthenticationProvider.h"
#import "CMISLog.h"
//Exception names as returned in the <!--exception> tag
@@ -55,7 +54,7 @@
httpRequest.additionalHeaders = additionalHeaders;
httpRequest.authenticationProvider = authenticationProvider;
- if ([httpRequest startRequest:urlRequest] == NO) {
+ if (![httpRequest startRequest:urlRequest]) {
httpRequest = nil;
}
@@ -128,7 +127,7 @@
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace
{
- return [self.authenticationProvider canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace];
+ return [self.authenticationProvider canAuthenticateAgainstProtectionSpace:protectionSpace];
}
diff --git a/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m b/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m
index 5e5d285..97a7dde 100644
--- a/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m
+++ b/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m
@@ -57,19 +57,17 @@
+ (void)createBoundInputStream:(NSInputStream **)inputStreamPtr
outputStream:(NSOutputStream **)outputStreamPtr
{
- CFReadStreamRef readStream;
- CFWriteStreamRef writeStream;
+ CFReadStreamRef readStream;
+ CFWriteStreamRef writeStream;
- assert( (inputStreamPtr != NULL) || (outputStreamPtr != NULL) );
+ assert((inputStreamPtr != NULL) || (outputStreamPtr != NULL));
readStream = NULL;
writeStream = NULL;
- CFStreamCreateBoundPair(
- NULL,
- ((inputStreamPtr != nil) ? &readStream : NULL),
+ CFStreamCreateBoundPair(NULL,
+ ((inputStreamPtr != nil) ? &readStream : NULL),
((outputStreamPtr != nil) ? &writeStream : NULL),
- (CFIndex) kFullBufferSize
- );
+ (CFIndex)kFullBufferSize);
if (inputStreamPtr != NULL) {
*inputStreamPtr = CFBridgingRelease(readStream);
@@ -86,17 +84,17 @@
@property (nonatomic, assign) unsigned long long bytesUploaded;
@property (nonatomic, copy) void (^progressBlock)(unsigned long long bytesUploaded, unsigned long long bytesTotal);
@property (nonatomic, assign) BOOL base64Encoding;
-@property (nonatomic, strong) NSInputStream * base64InputStream;
-@property (nonatomic, strong) NSOutputStream * encoderStream;
-@property (nonatomic, strong) NSData * streamStartData;
-@property (nonatomic, strong) NSData * streamEndData;
+@property (nonatomic, strong) NSInputStream *base64InputStream;
+@property (nonatomic, strong) NSOutputStream *encoderStream;
+@property (nonatomic, strong) NSData *streamStartData;
+@property (nonatomic, strong) NSData *streamEndData;
@property (nonatomic, assign) unsigned long long encodedLength;
-@property (nonatomic, strong) NSData * dataBuffer;
-@property (nonatomic, assign, readwrite) size_t bufferOffset;
-@property (nonatomic, assign, readwrite) size_t bufferLimit;
+@property (nonatomic, strong) NSData *dataBuffer;
+@property (nonatomic, assign, readwrite) size_t bufferOffset;
+@property (nonatomic, assign, readwrite) size_t bufferLimit;
- (void)stopSendWithStatus:(NSString *)statusString;
-+ (NSUInteger)base64EncodedLength:(NSUInteger)contentSize;
++ (unsigned long long)base64EncodedLength:(unsigned long long)contentSize;
- (void)prepareXMLWithCMISProperties:(CMISProperties *)cmisProperties mimeType:(NSString *)mimeType;
- (void)prepareStreams;
@@ -109,7 +107,6 @@
@implementation CMISHttpUploadRequest
-
+ (id)startRequest:(NSMutableURLRequest *)urlRequest
httpMethod:(CMISHttpRequestMethod)httpRequestMethod
inputStream:(NSInputStream*)inputStream
@@ -130,7 +127,7 @@
httpRequest.base64InputStream = nil;
httpRequest.encoderStream = nil;
- if ([httpRequest startRequest:urlRequest] == NO) {
+ if (![httpRequest startRequest:urlRequest]) {
httpRequest = nil;
}
@@ -160,7 +157,7 @@
[httpRequest prepareStreams];
[httpRequest prepareXMLWithCMISProperties:cmisProperties mimeType:mimeType];
- if ([httpRequest startRequest:urlRequest] == NO) {
+ if (![httpRequest startRequest:urlRequest]) {
httpRequest = nil;
}
@@ -245,9 +242,9 @@
}
if (self.bytesExpected == 0) {
- self.progressBlock((NSUInteger)totalBytesWritten, (NSUInteger)totalBytesExpectedToWrite);
+ self.progressBlock((unsigned long long)totalBytesWritten, (unsigned long long)totalBytesExpectedToWrite);
} else {
- self.progressBlock((NSUInteger)totalBytesWritten, self.bytesExpected);
+ self.progressBlock((unsigned long long)totalBytesWritten, self.bytesExpected);
}
}
}
@@ -320,24 +317,24 @@
}
}
break;
+
case NSStreamEventHasBytesAvailable: {
- } break;
+ }
+ break;
+
case NSStreamEventHasSpaceAvailable: {
if (self.base64InputStream) {
NSStreamStatus inputStatus = self.base64InputStream.streamStatus;
if (inputStatus == NSStreamStatusClosed) {
CMISLogDebug(@"Base64InputStream %@ is closed", self.base64InputStream);
- }
- else if (inputStatus == NSStreamStatusAtEnd){
+ } else if (inputStatus == NSStreamStatusAtEnd){
CMISLogDebug(@"Base64InputStream %@ has reached the end", self.base64InputStream);
- }
- else if (inputStatus == NSStreamStatusError){
+ } else if (inputStatus == NSStreamStatusError){
CMISLogDebug(@"Base64InputStream %@ input stream error: %@", self.base64InputStream, self.base64InputStream.streamError);
[self stopSendWithStatus:@"Network read error"];
}
}
-
if (self.bufferOffset == self.bufferLimit) {
if (self.streamStartData != nil) {
self.streamStartData = nil;
@@ -350,14 +347,12 @@
rawBytesRead = [self.inputStream read:rawBuffer maxLength:kRawBufferSize];
if (-1 == rawBytesRead) {
[self stopSendWithStatus:@"Error while reading from source input stream"];
- }
- else if (0 != rawBytesRead){
+ } else if (0 != rawBytesRead) {
NSData *encodedBuffer = [CMISBase64Encoder dataByEncodingText:[NSData dataWithBytes:rawBuffer length:rawBytesRead]];
self.dataBuffer = [NSData dataWithData:encodedBuffer];
self.bufferOffset = 0;
self.bufferLimit = encodedBuffer.length;
- }
- else{
+ } else {
[self.inputStream close];
self.inputStream = nil;
self.bufferOffset = 0;
@@ -390,18 +385,23 @@
bytesWritten = [self.encoderStream write:&buffer[self.bufferOffset] maxLength:self.bufferLimit - self.bufferOffset];
if (bytesWritten <= 0) {
[self stopSendWithStatus:@"Network write error"];
- }
- else{
+ } else {
self.bufferOffset += bytesWritten;
}
}
- }break;
+ }
+ break;
+
case NSStreamEventErrorOccurred: {
[self stopSendWithStatus:@"Stream open error"];
- }break;
+ }
+ break;
+
case NSStreamEventEndEncountered: {
- }break;
+ }
+ break;
+
default:
break;
}
@@ -429,7 +429,7 @@
NSString *end = [NSString stringWithFormat:@"%@%@", xmlContentEnd, xmlProperties];
self.streamEndData = [end dataUsingEncoding:NSUTF8StringEncoding];
- NSUInteger encodedLength = [CMISHttpUploadRequest base64EncodedLength:(NSUInteger)self.bytesExpected];
+ unsigned long long encodedLength = [CMISHttpUploadRequest base64EncodedLength:self.bytesExpected];
encodedLength += start.length;
encodedLength += end.length;
self.encodedLength = encodedLength;
@@ -437,8 +437,6 @@
- (void)prepareStreams
{
- /*
- */
if (self.inputStream.streamStatus != NSStreamStatusOpen) {
[self.inputStream open];
}
@@ -455,25 +453,23 @@
}
-+ (NSUInteger)base64EncodedLength:(NSUInteger)contentSize
++ (unsigned long long)base64EncodedLength:(unsigned long long)contentSize
{
- if (0 == contentSize)
- {
+ if (0 == contentSize) {
return 0;
}
- NSUInteger adjustedThirdPartOfSize = (contentSize / 3) + ( (0 == contentSize % 3 ) ? 0 : 1 );
+ unsigned long long adjustedThirdPartOfSize = (contentSize / 3) + ( (0 == contentSize % 3 ) ? 0 : 1 );
return 4 * adjustedThirdPartOfSize;
}
+ (NSUInteger)rawEncodedLength:(NSUInteger)base64EncodedSize
{
- if (0 == base64EncodedSize)
- {
+ if (0 == base64EncodedSize) {
return 0;
}
- NSUInteger adjustedFourthPartOfSize = (base64EncodedSize / 4) + ( (0 == base64EncodedSize % 4 ) ? 0 : 1 );
+ NSUInteger adjustedFourthPartOfSize = (base64EncodedSize / 4) + ( (0 == base64EncodedSize % 4 ) ? 0 : 1 );
return 3 * adjustedFourthPartOfSize;
}
diff --git a/ObjectiveCMIS/Utils/CMISObjectConverter.m b/ObjectiveCMIS/Utils/CMISObjectConverter.m
index 1181a64..43ddc48 100644
--- a/ObjectiveCMIS/Utils/CMISObjectConverter.m
+++ b/ObjectiveCMIS/Utils/CMISObjectConverter.m
@@ -17,7 +17,6 @@
under the License.
*/
-#import <Foundation/Foundation.h>
#import "CMISObjectConverter.h"
#import "CMISDocument.h"
#import "CMISFolder.h"
@@ -25,7 +24,6 @@
#import "CMISErrors.h"
#import "CMISPropertyDefinition.h"
#import "CMISSession.h"
-#import "CMISConstants.h"
#import "CMISDateUtil.h"
@interface CMISObjectConverter ()
@@ -294,7 +292,7 @@
}
default: {
NSError *error = [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument
- detailedDescription:[NSString stringWithFormat:@"Unsupported: cannot convert property type %d", propertyDefinition.propertyType]];
+ detailedDescription:[NSString stringWithFormat:@"Unsupported: cannot convert property type %li", (long)propertyDefinition.propertyType]];
completionBlock(nil, error);
return;
}
diff --git a/ObjectiveCMIS/Utils/CMISURLUtil.m b/ObjectiveCMIS/Utils/CMISURLUtil.m
index 4b9c047..68b0594 100644
--- a/ObjectiveCMIS/Utils/CMISURLUtil.m
+++ b/ObjectiveCMIS/Utils/CMISURLUtil.m
@@ -17,7 +17,6 @@
under the License.
*/
-#import <Foundation/Foundation.h>
#import "CMISURLUtil.h"
diff --git a/ObjectiveCMISTests/ObjectiveCMISTests.m b/ObjectiveCMISTests/ObjectiveCMISTests.m
index cc86a51..f2631cd 100644
--- a/ObjectiveCMISTests/ObjectiveCMISTests.m
+++ b/ObjectiveCMISTests/ObjectiveCMISTests.m
@@ -21,7 +21,6 @@
#import "ObjectiveCMISTests.h"
#import "CMISSession.h"
#import "CMISConstants.h"
-#import "CMISDocument.h"
#import "CMISFileUtil.h"
#import "CMISAtomLink.h"
#import "CMISAtomPubConstants.h"