File tree Expand file tree Collapse file tree 3 files changed +15
-15
lines changed
Expand file tree Collapse file tree 3 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -27,19 +27,19 @@ + (UInt32)file:(NSString *)filePath
2727 if (*error != nil ) {
2828 return 0 ;
2929 }
30-
31- int len = (int )[data length ];
32- int count = (len + kQNBlockSize - 1 ) / kQNBlockSize ;
33-
30+
31+ int len = (int )[data length ];
32+ int count = (len + kQNBlockSize - 1 ) / kQNBlockSize ;
33+
3434 uLong crc = crc32 (0L , Z_NULL, 0 );
35- NSLog (@" %lu %d " , crc, count);
35+ NSLog (@" %lu %d " , crc, count);
3636 for (int i = 0 ; i < count; i++) {
3737 int offset = i * kQNBlockSize ;
3838 int size = (len - offset) > kQNBlockSize ? kQNBlockSize : (len - offset);
3939 NSData *d = [data subdataWithRange: NSMakeRange (offset, (unsigned int )size)];
40- crc = crc32 (crc, [d bytes ], (uInt)[d length ]);
40+ crc = crc32 (crc, [d bytes ], (uInt)[d length ]);
4141 }
42- NSLog (@" %lu %d " , crc, count);
42+ NSLog (@" %lu %d " , crc, count);
4343 return (UInt32)crc;
4444 }
4545}
Original file line number Diff line number Diff line change @@ -81,9 +81,9 @@ - (void)putData:(NSData *)data
8181 mimeType = @" application/octet-stream" ;
8282 }
8383
84- if (option && option.checkCrc ) {
85- parameters[@" crc32" ] = [NSNumber numberWithUnsignedLong: [QNCrc32 data: data]];
86- }
84+ if (option && option.checkCrc ) {
85+ parameters[@" crc32" ] = [NSNumber numberWithUnsignedLong: [QNCrc32 data: data]];
86+ }
8787
8888 QNInternalProgressBlock p = nil ;
8989
Original file line number Diff line number Diff line change @@ -24,12 +24,12 @@ - (void)testData {
2424}
2525
2626- (void )testFile {
27- NSError *error;
28- NSURL *file = [QNTempFile createTempfileWithSize: 5 * 1024 * 1024 ];
29- UInt32 u = [QNCrc32 file: [file relativePath ] error: &error];
27+ NSError *error;
28+ NSURL *file = [QNTempFile createTempfileWithSize: 5 * 1024 * 1024 ];
29+ UInt32 u = [QNCrc32 file: [file relativePath ] error: &error];
3030
31- XCTAssert (u == 3376132981 , @" Pass" );
32- [QNTempFile removeTempfile: file];
31+ XCTAssert (u == 3376132981 , @" Pass" );
32+ [QNTempFile removeTempfile: file];
3333}
3434
3535@end
You can’t perform that action at this time.
0 commit comments