mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2026-05-13 00:02:02 +08:00
Fixes warning regarding shadowing local variables
This commit is contained in:
@@ -330,8 +330,8 @@ static void _NetServiceClientCallBack(CFNetServiceRef service, CFStreamError* er
|
|||||||
DNOT_REACHED();
|
DNOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
int yes = 1;
|
int noSigPipe = 1;
|
||||||
setsockopt(socket, SOL_SOCKET, SO_NOSIGPIPE, &yes, sizeof(yes)); // Make sure this socket cannot generate SIG_PIPE
|
setsockopt(socket, SOL_SOCKET, SO_NOSIGPIPE, &noSigPipe, sizeof(noSigPipe)); // Make sure this socket cannot generate SIG_PIPE
|
||||||
|
|
||||||
Class connectionClass = [[self class] connectionClass];
|
Class connectionClass = [[self class] connectionClass];
|
||||||
GCDWebServerConnection* connection = [[connectionClass alloc] initWithServer:self localAddress:localAddress remoteAddress:remoteAddress socket:socket]; // Connection will automatically retain itself while opened
|
GCDWebServerConnection* connection = [[connectionClass alloc] initWithServer:self localAddress:localAddress remoteAddress:remoteAddress socket:socket]; // Connection will automatically retain itself while opened
|
||||||
|
|||||||
@@ -99,8 +99,8 @@ static dispatch_queue_t _formatterQueue = NULL;
|
|||||||
|
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
NSMutableData* data = [[NSMutableData alloc] initWithCapacity:dispatch_data_get_size(buffer)];
|
NSMutableData* data = [[NSMutableData alloc] initWithCapacity:dispatch_data_get_size(buffer)];
|
||||||
dispatch_data_apply(buffer, ^bool(dispatch_data_t region, size_t offset, const void* buffer, size_t size) {
|
dispatch_data_apply(buffer, ^bool(dispatch_data_t region, size_t offset, const void* bufferChunk, size_t size) {
|
||||||
[data appendBytes:buffer length:size];
|
[data appendBytes:bufferChunk length:size];
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
block(data);
|
block(data);
|
||||||
@@ -118,8 +118,8 @@ static dispatch_queue_t _formatterQueue = NULL;
|
|||||||
|
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
NSMutableData* data = [NSMutableData dataWithCapacity:kHeadersReadBuffer];
|
NSMutableData* data = [NSMutableData dataWithCapacity:kHeadersReadBuffer];
|
||||||
dispatch_data_apply(buffer, ^bool(dispatch_data_t region, size_t offset, const void* buffer, size_t size) {
|
dispatch_data_apply(buffer, ^bool(dispatch_data_t region, size_t offset, const void* bufferChunk, size_t size) {
|
||||||
[data appendBytes:buffer length:size];
|
[data appendBytes:bufferChunk length:size];
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
NSRange range = [data rangeOfData:_separatorData options:0 range:NSMakeRange(0, data.length)];
|
NSRange range = [data rangeOfData:_separatorData options:0 range:NSMakeRange(0, data.length)];
|
||||||
@@ -158,8 +158,8 @@ static dispatch_queue_t _formatterQueue = NULL;
|
|||||||
if (buffer) {
|
if (buffer) {
|
||||||
NSInteger remainingLength = length - dispatch_data_get_size(buffer);
|
NSInteger remainingLength = length - dispatch_data_get_size(buffer);
|
||||||
if (remainingLength >= 0) {
|
if (remainingLength >= 0) {
|
||||||
bool success = dispatch_data_apply(buffer, ^bool(dispatch_data_t region, size_t offset, const void* buffer, size_t size) {
|
bool success = dispatch_data_apply(buffer, ^bool(dispatch_data_t region, size_t offset, const void* bufferChunk, size_t size) {
|
||||||
NSInteger result = [_request write:buffer maxLength:size];
|
NSInteger result = [_request write:bufferChunk maxLength:size];
|
||||||
if (result != (NSInteger)size) {
|
if (result != (NSInteger)size) {
|
||||||
LOG_ERROR(@"Failed writing request body on socket %i (error %i)", _socket, (int)result);
|
LOG_ERROR(@"Failed writing request body on socket %i (error %i)", _socket, (int)result);
|
||||||
return false;
|
return false;
|
||||||
@@ -342,7 +342,7 @@ static dispatch_queue_t _formatterQueue = NULL;
|
|||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
if ([_response hasBody]) {
|
if ([_response hasBody]) {
|
||||||
[self _writeBodyWithCompletionBlock:^(BOOL success) {
|
[self _writeBodyWithCompletionBlock:^(BOOL successInner) {
|
||||||
|
|
||||||
[_response close]; // Can't do anything with result anyway
|
[_response close]; // Can't do anything with result anyway
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user