aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar dmaclach <dmaclach@gmail.com>2018-11-13 20:48:49 -0800
committerGravatar GitHub <noreply@github.com>2018-11-13 20:48:49 -0800
commitc385c8abf10326cd76ab29ac1a83ba550e0862e1 (patch)
tree54475cf28c6f1c1a4c3f0cefc7cc087cb5a89f35
parent07dc0ac0b68b69b9e23e07126b02be9b35937154 (diff)
Added missing deprecated attribute to NSData+zlib. (#206)
-rw-r--r--Foundation/GTMNSData+zlib.h2
-rw-r--r--Foundation/GTMNSData+zlibTest.m6
2 files changed, 6 insertions, 2 deletions
diff --git a/Foundation/GTMNSData+zlib.h b/Foundation/GTMNSData+zlib.h
index dceadc4..bb9e1b7 100644
--- a/Foundation/GTMNSData+zlib.h
+++ b/Foundation/GTMNSData+zlib.h
@@ -32,7 +32,7 @@
//
// Uses the default compression level.
+ (NSData *)gtm_dataByGzippingBytes:(const void *)bytes
- length:(NSUInteger)length;
+ length:(NSUInteger)length __attribute__((deprecated("Use error variant")));
+ (NSData *)gtm_dataByGzippingBytes:(const void *)bytes
length:(NSUInteger)length
error:(NSError **)error;
diff --git a/Foundation/GTMNSData+zlibTest.m b/Foundation/GTMNSData+zlibTest.m
index 4f3acc1..ce068c4 100644
--- a/Foundation/GTMNSData+zlibTest.m
+++ b/Foundation/GTMNSData+zlibTest.m
@@ -431,12 +431,16 @@ static BOOL HasGzipHeader(NSData *data) {
// w/ *Bytes apis, default level
NSError *error = nil;
NSData *gzipped = [NSData gtm_dataByGzippingBytes:[data bytes]
- length:[data length]];
+ length:[data length]
+ error:&error];
XCTAssertNotNil(gzipped, @"failed to gzip data block");
XCTAssertGreaterThan([gzipped length],
(NSUInteger)0, @"failed to gzip data block");
XCTAssertTrue(HasGzipHeader(gzipped),
@"doesn't have gzip header on gzipped data");
+ XCTAssertNil(error);
+ error = nil;
+
NSData *dataPrime = [NSData gtm_dataByInflatingBytes:[gzipped bytes]
length:[gzipped length]
error:&error];