This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Commit 6cb4afe 1 parent d14bdb8 commit 6cb4afe Copy full SHA for 6cb4afe
File tree 2 files changed +9
-10
lines changed
2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -9,17 +9,15 @@ - (NSData *)mgl_compressedData
9
9
std::string string (static_cast <const char *>(self.bytes ), self.length );
10
10
std::string compressed_string = mbgl::util::compress (string);
11
11
12
- return [NSData dataWithBytes: ( void *) compressed_string. c_str () length: compressed_string.length ()];
12
+ return [NSData dataWithBytes: & compressed_string[ 0 ] length: compressed_string.length ()];
13
13
}
14
14
15
15
- (NSData *)mgl_decompressedData
16
16
{
17
17
std::string string (static_cast <const char *>(self.bytes ), self.length );
18
18
std::string decompressed_string = mbgl::util::decompress (string);
19
19
20
- NSString *decompressedString = @(decompressed_string.c_str ());
21
-
22
- return [decompressedString dataUsingEncoding: NSUTF8StringEncoding];
20
+ return [NSData dataWithBytes: &decompressed_string[0 ] length: decompressed_string.length ()];
23
21
}
24
22
25
23
@end
Original file line number Diff line number Diff line change @@ -22,19 +22,20 @@ - (void)testCompressDecompress
22
22
23
23
NSArray *decompressedArray = [NSJSONSerialization JSONObjectWithData: decompressedData options: 0 error: nil ];
24
24
25
- XCTAssertTrue ([originalArray isEqualToArray: decompressedArray], @" originalDict and decompressedDict should be equal" );
25
+ XCTAssertTrue ([originalArray isEqualToArray: decompressedArray], @" originalArray and decompressedArray should be equal" );
26
26
}
27
27
28
28
- (NSArray *)mockDataWithCount : (NSUInteger )count
29
29
{
30
30
NSMutableArray *array = [NSMutableArray array ];
31
- for ( NSUInteger i= 0 ;i<count;i++) {
32
-
33
- NSTimeInterval ts = [[ NSDate date ] timeIntervalSince1970 ];
31
+
32
+ for ( NSUInteger i= 0 ;i<count;i++)
33
+ {
34
34
[array addObject: @{@" lat" : @([self safeValueBetween: -90 and: 90 ]),
35
- @" lng" : @([self safeValueBetween: -190 and: 190 ]),
36
- @" timestamp" : @((floor (ts ) * 100 ) / 100 )}];
35
+ @" lng" : @([self safeValueBetween: -180 and: 180 ]),
36
+ @" timestamp" : @((floor ([ NSDate date ]. timeIntervalSince1970 ) * 100 ) / 100 )}];
37
37
}
38
+
38
39
return array;
39
40
}
40
41
You can’t perform that action at this time.
0 commit comments