Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb33583a

Browse files
committed
Merge branch 'release-1.7.13'
2 parentsa81237e +c84dac8 commitb33583a

File tree

29 files changed

+227
-91
lines changed

29 files changed

+227
-91
lines changed

‎.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
language:objective-c
3-
osx_image:xcode7
3+
osx_image:xcode8.3
44

55
before_install:
66
-curl -sL https://gist.github.com/henrikhodne/7ac6d02ff9a24a94720c/raw/install_appledoc.sh | sh

‎Core/Source/DTASN1/DTASN1Parser.m

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ - (id)initWithData:(NSData *)data
5959
_UTCFormatter = [[NSDateFormatteralloc]init];
6060
_UTCFormatter.dateFormat =@"yyMMddHHmmss'Z'";
6161
_UTCFormatter.timeZone = [NSTimeZonetimeZoneWithAbbreviation:@"UTC"];
62+
_UTCFormatter.locale = [[NSLocalealloc]initWithLocaleIdentifier:@"en_US_POSIX"];
6263

6364
if (!_dataLength)
6465
{
@@ -336,10 +337,16 @@ - (BOOL)_parseValueWithTag:(NSUInteger)tag dataRange:(NSRange)dataRange
336337
{
337338
if (_delegateFlags.delegateSupportsString)
338339
{
339-
uint8_t *buffer =malloc(dataRange.length);
340-
[_datagetBytes:bufferrange:dataRange];
340+
NSString *string =@"";
341+
uint8_t *buffer=NULL;
341342

342-
NSString *string = [[NSStringalloc]initWithBytesNoCopy:bufferlength:dataRange.lengthencoding:NSUTF8StringEncodingfreeWhenDone:YES];
343+
if (dataRange.length)
344+
{
345+
buffer =malloc(dataRange.length);
346+
[_datagetBytes:bufferrange:dataRange];
347+
348+
string = [[NSStringalloc]initWithBytesNoCopy:bufferlength:dataRange.lengthencoding:NSUTF8StringEncodingfreeWhenDone:YES];
349+
}
343350

344351
// FIXME: This does not properly deal with Latin1 strings, those get simply ignored
345352

@@ -349,8 +356,11 @@ - (BOOL)_parseValueWithTag:(NSUInteger)tag dataRange:(NSRange)dataRange
349356
}
350357
else
351358
{
352-
free(buffer);
353-
buffer =NULL;
359+
if (buffer)
360+
{
361+
free(buffer);
362+
buffer =NULL;
363+
}
354364
}
355365
}
356366
break;
@@ -423,7 +433,7 @@ - (BOOL)_parseRange:(NSRange)range
423433
}
424434

425435
// get length
426-
NSUInteger lengthOfLength;
436+
NSUInteger lengthOfLength =0;
427437
NSUInteger length = [self_parseLengthAtLocation:locationlengthOfLength:&lengthOfLength];
428438

429439
// abort if there was a problem with the length

‎Core/Source/DTAsyncFileDeleter/DTAsyncFileDeleter.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ - (void)removeItemAtPath:(NSString *)path
7474
__block UIBackgroundTaskIdentifier backgroundTaskID = UIBackgroundTaskInvalid;
7575

7676
// block to use for timeout as well as completed task
77-
void (^completionBlock)() = ^{
77+
void (^completionBlock)(void) = ^{
7878
[[UIApplicationsharedApplication]endBackgroundTask:backgroundTaskID];
7979
backgroundTaskID = UIBackgroundTaskInvalid;
8080
};

‎Core/Source/DTReachability/DTReachability.m

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,27 @@ - (instancetype) initWithHostname:(NSString *)hostname
7474
{
7575
_observers = [[NSMutableSetalloc]init];
7676
_hostname = hostname;
77+
78+
#if TARGET_OS_IPHONE
79+
[NSNotificationCenter.defaultCenteraddObserver:selfselector:@selector(applicationDidEnterBackground:)name:UIApplicationDidEnterBackgroundNotificationobject:nil];
80+
[NSNotificationCenter.defaultCenteraddObserver:selfselector:@selector(applicationDidBecomeActive:)name:UIApplicationDidBecomeActiveNotificationobject:nil];
81+
#endif
7782
}
7883
return self;
7984
}
8085

86+
- (void)applicationDidEnterBackground:(NSNotification *)notification
87+
{
88+
[self_unregisterNetworkReachability];
89+
}
90+
91+
- (void)applicationDidBecomeActive:(NSNotification *)notification
92+
{
93+
[self_registerNetworkReachability];
94+
}
95+
96+
97+
8198
- (void)dealloc
8299
{
83100
[self_unregisterNetworkReachability];

‎Core/Source/DTSQLite/DTSQLiteDatabase.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@
5050
/**
5151
@param block The block to perform
5252
*/
53-
- (void)performBlock:(void (^)())block;
53+
- (void)performBlock:(void (^)(void))block;
5454

5555
/**
5656
@param block The block to perform
5757
*/
58-
- (void)performBlockAndWait:(void (^)())block;
58+
- (void)performBlockAndWait:(void (^)(void))block;
5959

6060
@end

‎Core/Source/DTSQLite/DTSQLiteDatabase.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ - (NSArray *)fetchRowsForQuery:(NSString *)query error:(NSError **)error
120120

121121
#pragma mark - Block Operations
122122

123-
- (void)performBlock:(void (^)())block
123+
- (void)performBlock:(void (^)(void))block
124124
{
125125
[_queueaddOperationWithBlock:block];
126126
}
127127

128-
- (void)performBlockAndWait:(void (^)())block
128+
- (void)performBlockAndWait:(void (^)(void))block
129129
{
130130
[_queueaddOperationWithBlock:block];
131131
[_queuewaitUntilAllOperationsAreFinished];

‎Core/Source/Externals/minizip/unzip.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,8 +1170,7 @@ extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
11701170
pfile_info->internal_fa=file_info64.internal_fa;
11711171
pfile_info->external_fa=file_info64.external_fa;
11721172

1173-
pfile_info->tmu_date=file_info64.tmu_date,
1174-
1173+
pfile_info->tmu_date=file_info64.tmu_date;
11751174

11761175
pfile_info->compressed_size= (uLong)file_info64.compressed_size;
11771176
pfile_info->uncompressed_size= (uLong)file_info64.uncompressed_size;

‎Core/Source/Runtime/DTObjectBlockExecutor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
Convenience method to create a block executor with a deallocation block
1717
@param block The block to execute when the created receiver is being deallocated
1818
*/
19-
+ (id)blockExecutorWithDeallocBlock:(void(^)())block;
19+
+ (id)blockExecutorWithDeallocBlock:(void(^)(void))block;
2020

2121
/**
2222
Block to execute when dealloc of the receiver is called
2323
*/
24-
@property (nonatomic,copy)void (^deallocBlock)();
24+
@property (nonatomic,copy)void (^deallocBlock)(void);
2525

2626
@end

‎Core/Source/Runtime/DTObjectBlockExecutor.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
@implementationDTObjectBlockExecutor
1313

14-
+ (id)blockExecutorWithDeallocBlock:(void(^)())block
14+
+ (id)blockExecutorWithDeallocBlock:(void(^)(void))block
1515
{
1616
DTObjectBlockExecutor *executor = [[DTObjectBlockExecutoralloc]init];
1717
executor.deallocBlock = block;// copy

‎Core/Source/Runtime/NSObject+DTRuntime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Adds a block to be executed as soon as the receiver's memory is deallocated
2222
@param block The block to execute when the receiver is being deallocated
2323
*/
24-
- (void)addDeallocBlock:(void(^)())block;
24+
- (void)addDeallocBlock:(void(^)(void))block;
2525

2626
/**
2727
Adds a new instance method to a class. All instances of this class will have this method.

‎Core/Source/Runtime/NSObject+DTRuntime.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ @implementation NSObject (DTRuntime)
1515

1616
#pragma mark - Blocks
1717

18-
- (void)addDeallocBlock:(void(^)())block
18+
- (void)addDeallocBlock:(void(^)(void))block
1919
{
2020
// don't accept NULL block
2121
NSParameterAssert(block);

‎Core/Source/iOS/DTProgressHUD/DTProgressHUDWindow.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#import"DTProgressHUDWindow.h"
1010
#import"DTProgressHUD.h"
11+
#import"UIScreen+DTFoundation.h"
1112

1213
#defineDegreesToRadians(degrees) (degrees * M_PI /180)
1314

@@ -60,7 +61,7 @@ - (instancetype)initWithProgressHUD:(DTProgressHUD *)progressHUD
6061
[[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector(statusBarDidChangeFrame:)name:UIApplicationDidChangeStatusBarOrientationNotificationobject:nil];
6162

6263
// set initial transform
63-
UIInterfaceOrientation orientation = [[UIApplicationsharedApplication]statusBarOrientation];
64+
UIInterfaceOrientation orientation = [[UIScreenmainScreen]orientation];
6465
[selfsetTransform:_transformForInterfaceOrientation(orientation)];
6566
}
6667
return self;
@@ -75,7 +76,7 @@ - (void)dealloc
7576

7677
- (void)statusBarDidChangeFrame:(NSNotification *)notification
7778
{
78-
UIInterfaceOrientation orientation = [[UIApplicationsharedApplication]statusBarOrientation];
79+
UIInterfaceOrientation orientation = [[UIScreenmainScreen]orientation];
7980
[selfsetTransform:_transformForInterfaceOrientation(orientation)];
8081
}
8182

‎Core/Source/iOS/DTTiledLayerWithoutFade.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@ + (CFTimeInterval)fadeDuration
1515
return0;
1616
}
1717

18+
+ (BOOL)shouldDrawOnMainThread
19+
{
20+
returnYES;
21+
}
22+
1823
@end

‎Core/Source/iOS/UIImage+DTFoundation.m

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ + (UIImage *)imageWithContentsOfURL:(NSURL *)URL cachePolicy:(NSURLRequestCacheP
7070
NSCachedURLResponse *cacheResponse = [[NSURLCachesharedURLCache]cachedResponseForRequest:request];
7171

7272
__blockNSData *data;
73+
__blockNSError *internalError;
7374

7475
if (cacheResponse)
7576
{
@@ -89,12 +90,12 @@ + (UIImage *)imageWithContentsOfURL:(NSURL *)URL cachePolicy:(NSURLRequestCacheP
8990
#else
9091
dispatch_semaphore_t semaphore =dispatch_semaphore_create(0);
9192

92-
[[NSURLSessionsharedSession]dataTaskWithRequest:requestcompletionHandler:^(NSData *responseData,NSURLResponse *response,NSError *responseError) {
93-
94-
data = responseData;
95-
*error = responseError;
96-
dispatch_semaphore_signal(semaphore);
97-
}];
93+
[[[NSURLSessionsharedSession]dataTaskWithRequest:requestcompletionHandler:^(NSData *responseData,NSURLResponse *response,NSError *responseError) {
94+
95+
data = responseData;
96+
internalError = responseError;
97+
dispatch_semaphore_signal(semaphore);
98+
}]resume];
9899

99100
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
100101
#endif
@@ -105,6 +106,11 @@ + (UIImage *)imageWithContentsOfURL:(NSURL *)URL cachePolicy:(NSURLRequestCacheP
105106
returnnil;
106107
}
107108

109+
if (error)
110+
{
111+
*error = internalError;
112+
}
113+
108114
UIImage *image = [UIImageimageWithData:data];
109115
return image;
110116
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// UIScreen+DTFoundation.h
3+
// DTFoundation
4+
//
5+
// Created by Johannes Marbach on 16.10.17.
6+
// Copyright © 2017 Cocoanetics. All rights reserved.
7+
//
8+
9+
/** DTFoundation enhancements for `UIView`*/
10+
11+
@interfaceUIScreen (DTFoundation)
12+
13+
- (UIInterfaceOrientation)orientation;
14+
15+
@end
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//
2+
// UIScreen+DTFoundation.m
3+
// DTFoundation
4+
//
5+
// Created by Johannes Marbach on 16.10.17.
6+
// Copyright © 2017 Cocoanetics. All rights reserved.
7+
//
8+
9+
#import"UIScreen+DTFoundation.h"
10+
11+
@implementationUIScreen (DTFoundation)
12+
13+
- (UIInterfaceOrientation)orientation {
14+
CGPoint point = [self.coordinateSpaceconvertPoint:CGPointZerotoCoordinateSpace:self.fixedCoordinateSpace];
15+
if (point.x ==0 && point.y ==0) {
16+
return UIInterfaceOrientationPortrait;
17+
}elseif (point.x !=0 && point.y !=0) {
18+
return UIInterfaceOrientationPortraitUpsideDown;
19+
}elseif (point.x ==0 && point.y !=0) {
20+
return UIInterfaceOrientationLandscapeLeft;
21+
}elseif (point.x !=0 && point.y ==0) {
22+
return UIInterfaceOrientationLandscapeRight;
23+
}else {
24+
return UIInterfaceOrientationUnknown;
25+
}
26+
}
27+
28+
@end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp