aboutsummaryrefslogtreecommitdiffhomepage
path: root/objectivec/GPBCodedOutputStream.m
diff options
context:
space:
mode:
Diffstat (limited to 'objectivec/GPBCodedOutputStream.m')
-rw-r--r--objectivec/GPBCodedOutputStream.m7
1 files changed, 5 insertions, 2 deletions
diff --git a/objectivec/GPBCodedOutputStream.m b/objectivec/GPBCodedOutputStream.m
index c299040f..b846c2fc 100644
--- a/objectivec/GPBCodedOutputStream.m
+++ b/objectivec/GPBCodedOutputStream.m
@@ -174,10 +174,10 @@ static void GPBWriteRawLittleEndian64(GPBOutputBufferState *state,
data:(NSMutableData *)data {
if ((self = [super init])) {
buffer_ = [data retain];
- [output open];
state_.bytes = [data mutableBytes];
state_.size = [data length];
state_.output = [output retain];
+ [state_.output open];
}
return self;
}
@@ -942,7 +942,10 @@ static void GPBWriteRawLittleEndian64(GPBOutputBufferState *state,
state_.position = length;
} else {
// Write is very big. Let's do it all at once.
- [state_.output write:((uint8_t *)value) + offset maxLength:length];
+ NSInteger written = [state_.output write:((uint8_t *)value) + offset maxLength:length];
+ if (written != (NSInteger)length) {
+ [NSException raise:GPBCodedOutputStreamException_WriteFailed format:@""];
+ }
}
}
}