Skip to content

Commit 49b8449

Browse files
committed
Use macro instead of a constant
1 parent 4f94bb4 commit 49b8449

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

FirebaseDatabase/Sources/third_party/SocketRocket/FSRWebSocket.m

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,22 +1560,20 @@ - (void)safeHandleEvent:(NSStreamEvent)eventCode stream:(NSStream *)aStream
15601560
case NSStreamEventHasBytesAvailable: {
15611561
SRFastLog(@"NSStreamEventHasBytesAvailable %@", aStream);
15621562

1563-
#pragma clang diagnostic push
1564-
#pragma clang diagnostic ignored "-Wvla"
1565-
const NSUInteger bufferSize = 2048;
1566-
uint8_t buffer[bufferSize];
1567-
#pragma clang diagnostic pop
1563+
#define FSRWEB_SOCKET_BUFFER_SIZE 2048
1564+
uint8_t buffer[FSRWEB_SOCKET_BUFFER_SIZE];
1565+
15681566

15691567
while (_inputStream.hasBytesAvailable) {
1570-
NSInteger bytes_read = [_inputStream read:buffer maxLength:bufferSize];
1568+
NSInteger bytes_read = [_inputStream read:buffer maxLength:FSRWEB_SOCKET_BUFFER_SIZE];
15711569

15721570
if (bytes_read > 0) {
15731571
[_readBuffer appendBytes:buffer length:bytes_read];
15741572
} else if (bytes_read < 0) {
15751573
[self _failWithError:_inputStream.streamError];
15761574
}
15771575

1578-
if (bytes_read != bufferSize) {
1576+
if (bytes_read != FSRWEB_SOCKET_BUFFER_SIZE) {
15791577
break;
15801578
}
15811579
};

0 commit comments

Comments
 (0)