Skip to content
Snippets Groups Projects
Commit 17974029 authored by Makarand Dharmapurikar's avatar Makarand Dharmapurikar
Browse files

fixed compiler warning #2

parent c66ac4f8
No related branches found
No related tags found
No related merge requests found
...@@ -70,8 +70,8 @@ static grpc_byte_buffer *CopyCharArrayToNewByteBuffer(const char *array, ...@@ -70,8 +70,8 @@ static grpc_byte_buffer *CopyCharArrayToNewByteBuffer(const char *array,
return nil; return nil;
} }
char *array; char *array;
NSUInteger length; size_t length;
MallocAndCopyByteBufferToCharArray(buffer, (size_t *)&length, &array); MallocAndCopyByteBufferToCharArray(buffer, &length, &array);
if (!array) { if (!array) {
// TODO(jcanizales): grpc_byte_buffer is reference-counted, so we can // TODO(jcanizales): grpc_byte_buffer is reference-counted, so we can
// prevent this memory problem by implementing a subclass of NSData // prevent this memory problem by implementing a subclass of NSData
...@@ -79,7 +79,9 @@ static grpc_byte_buffer *CopyCharArrayToNewByteBuffer(const char *array, ...@@ -79,7 +79,9 @@ static grpc_byte_buffer *CopyCharArrayToNewByteBuffer(const char *array,
// can be implemented using a grpc_byte_buffer_reader. // can be implemented using a grpc_byte_buffer_reader.
return nil; return nil;
} }
return [self dataWithBytesNoCopy:array length:length freeWhenDone:YES]; // Not depending upon size assumption of NSUInteger
NSUInteger length_max = MIN(length, UINT_MAX);
return [self dataWithBytesNoCopy:array length:length_max freeWhenDone:YES];
} }
- (grpc_byte_buffer *)grpc_byteBuffer { - (grpc_byte_buffer *)grpc_byteBuffer {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment