Thrift: Whitespace cleanup.
Summary:
- Expanded tabs to spaces where spaces were the norm.
- Deleted almost all trailing whitespace.
- Added newlines to the ends of a few files.
- Ran dos2unix on one file or two.
Reviewed By: mcslee
Test Plan: git diff -b
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665467 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cocoa/src/TApplicationException.m b/lib/cocoa/src/TApplicationException.m
index bace360..9187087 100644
--- a/lib/cocoa/src/TApplicationException.m
+++ b/lib/cocoa/src/TApplicationException.m
@@ -48,21 +48,21 @@
[protocol readFieldBeginReturningName: NULL
type: &fieldType
fieldID: &fieldID];
- if (fieldType == TType_STOP) {
+ if (fieldType == TType_STOP) {
break;
}
switch (fieldID) {
case 1:
if (fieldType == TType_STRING) {
reason = [protocol readString];
- } else {
+ } else {
[TProtocolUtil skipType: fieldType onProtocol: protocol];
}
break;
case 2:
if (fieldType == TType_I32) {
type = [protocol readI32];
- } else {
+ } else {
[TProtocolUtil skipType: fieldType onProtocol: protocol];
}
break;
diff --git a/lib/cocoa/src/TException.m b/lib/cocoa/src/TException.m
index 33ed7b5..48d9090 100644
--- a/lib/cocoa/src/TException.m
+++ b/lib/cocoa/src/TException.m
@@ -37,7 +37,7 @@
if ([self userInfo] != nil) {
[result appendFormat: @"\n userInfo = %@", [self userInfo]];
}
-
+
return result;
}
diff --git a/lib/cocoa/src/protocol/TBinaryProtocol.h b/lib/cocoa/src/protocol/TBinaryProtocol.h
index 7e288fa..975af97 100644
--- a/lib/cocoa/src/protocol/TBinaryProtocol.h
+++ b/lib/cocoa/src/protocol/TBinaryProtocol.h
@@ -12,7 +12,7 @@
- (id) initWithTransport: (id <TTransport>) transport;
-- (id) initWithTransport: (id <TTransport>) transport
+- (id) initWithTransport: (id <TTransport>) transport
strictRead: (BOOL) strictRead
strictWrite: (BOOL) strictWrite;
@@ -29,4 +29,4 @@
- (TBinaryProtocol *) newProtocolOnTransport: (id <TTransport>) transport;
-@end
\ No newline at end of file
+@end
diff --git a/lib/cocoa/src/protocol/TBinaryProtocol.m b/lib/cocoa/src/protocol/TBinaryProtocol.m
index 7564f5d..e196138 100644
--- a/lib/cocoa/src/protocol/TBinaryProtocol.m
+++ b/lib/cocoa/src/protocol/TBinaryProtocol.m
@@ -7,13 +7,13 @@
static TBinaryProtocolFactory * gSharedFactory = nil;
-@implementation TBinaryProtocolFactory
+@implementation TBinaryProtocolFactory
+ (TBinaryProtocolFactory *) sharedFactory {
if (gSharedFactory == nil) {
gSharedFactory = [[TBinaryProtocolFactory alloc] init];
}
-
+
return gSharedFactory;
}
@@ -32,7 +32,7 @@
return [self initWithTransport: transport strictRead: NO strictWrite: NO];
}
-- (id) initWithTransport: (id <TTransport>) transport
+- (id) initWithTransport: (id <TTransport>) transport
strictRead: (BOOL) strictRead
strictWrite: (BOOL) strictWrite
{
@@ -109,7 +109,7 @@
@throw [TProtocolException exceptionWithName: @"TProtocolException"
reason: [NSString stringWithFormat: @"Message too big. Size limit is: %d Message size is: %d",
mMessageSizeLimit,
- size]];
+ size]];
}
NSString * messageName = [self readStringBody: size];
if (name != NULL) {
@@ -151,7 +151,7 @@
int ft = [self readByte];
if (fieldType != NULL) {
*fieldType = ft;
- }
+ }
if (ft != TType_STOP) {
int fid = [self readI16];
if (fieldID != NULL) {
@@ -233,7 +233,7 @@
int32_t size = [self readI32];
uint8_t * buff = malloc(size);
if (buff == NULL) {
- @throw [TProtocolException
+ @throw [TProtocolException
exceptionWithName: @"TProtocolException"
reason: [NSString stringWithFormat: @"Out of memory. Unable to allocate %d bytes trying to read binary data.",
size]];
@@ -395,7 +395,7 @@
}
-- (void) writeBinary: (NSData *) data
+- (void) writeBinary: (NSData *) data
{
[self writeI32: [data length]];
[mTransport write: [data bytes] offset: 0 length: [data length]];
diff --git a/lib/cocoa/src/server/TSocketServer.h b/lib/cocoa/src/server/TSocketServer.h
index 4b8e8d0..2ab21c7 100644
--- a/lib/cocoa/src/server/TSocketServer.h
+++ b/lib/cocoa/src/server/TSocketServer.h
@@ -7,7 +7,7 @@
NSSocketPort * mServerSocket;
NSFileHandle * mSocketFileHandle;
id <TProtocolFactory> mInputProtocolFactory;
- id <TProtocolFactory> mOutputProtocolFactory;
+ id <TProtocolFactory> mOutputProtocolFactory;
id <TProcessor> mProcessor;
}
diff --git a/lib/cocoa/src/server/TSocketServer.m b/lib/cocoa/src/server/TSocketServer.m
index d9d24e1..1108428 100644
--- a/lib/cocoa/src/server/TSocketServer.m
+++ b/lib/cocoa/src/server/TSocketServer.m
@@ -16,12 +16,12 @@
mInputProtocolFactory = [protocolFactory retain];
mOutputProtocolFactory = [protocolFactory retain];
mProcessor = [processor retain];
-
+
// create a socket
mServerSocket = [[NSSocketPort alloc] initWithTCPPort: port];
// FIXME - move this separate start method and add method to close
// and cleanup any open ports
-
+
if (mServerSocket == nil) {
NSLog(@"Unable to listen on TCP port %d", port);
} else {
@@ -30,17 +30,17 @@
// wrap it in a file handle so we can get messages from it
mSocketFileHandle = [[NSFileHandle alloc] initWithFileDescriptor: [mServerSocket socket]
closeOnDealloc: YES];
-
+
// register for notifications of accepted incoming connections
- [[NSNotificationCenter defaultCenter] addObserver: self
- selector: @selector(connectionAccepted:)
+ [[NSNotificationCenter defaultCenter] addObserver: self
+ selector: @selector(connectionAccepted:)
name: NSFileHandleConnectionAcceptedNotification
object: mSocketFileHandle];
-
+
// tell socket to listen
[mSocketFileHandle acceptConnectionInBackgroundAndNotify];
}
-
+
return self;
}
@@ -58,12 +58,12 @@
- (void) connectionAccepted: (NSNotification *) aNotification
{
NSFileHandle * socket = [[aNotification userInfo] objectForKey: NSFileHandleNotificationFileHandleItem];
-
+
// now that we have a client connected, spin off a thread to handle activity
[NSThread detachNewThreadSelector: @selector(handleClientConnection:)
toTarget: self
withObject: socket];
-
+
[[aNotification object] acceptConnectionInBackgroundAndNotify];
}
@@ -76,14 +76,14 @@
id <TProtocol> inProtocol = [mInputProtocolFactory newProtocolOnTransport: transport];
id <TProtocol> outProtocol = [mOutputProtocolFactory newProtocolOnTransport: transport];
-
+
@try {
while ([mProcessor processOnInputProtocol: inProtocol outputProtocol: outProtocol]);
}
@catch (TTransportException * te) {
NSLog(@"%@", te);
}
-
+
[pool release];
}
diff --git a/lib/cocoa/src/transport/THTTPClient.h b/lib/cocoa/src/transport/THTTPClient.h
index d9ea1a9..0aabb46 100644
--- a/lib/cocoa/src/transport/THTTPClient.h
+++ b/lib/cocoa/src/transport/THTTPClient.h
@@ -13,7 +13,7 @@
- (id) initWithURL: (NSURL *) aURL;
-- (id) initWithURL: (NSURL *) aURL
+- (id) initWithURL: (NSURL *) aURL
userAgent: (NSString *) userAgent
timeout: (int) timeout;
diff --git a/lib/cocoa/src/transport/THTTPClient.m b/lib/cocoa/src/transport/THTTPClient.m
index f5186e2..4bad09c 100644
--- a/lib/cocoa/src/transport/THTTPClient.m
+++ b/lib/cocoa/src/transport/THTTPClient.m
@@ -9,7 +9,7 @@
if (mRequest != nil) {
[mRequest release];
}
-
+
// set up our request object that we'll use for each request
mRequest = [[NSMutableURLRequest alloc] initWithURL: mURL];
[mRequest setHTTPMethod: @"POST"];
@@ -37,7 +37,7 @@
}
-- (id) initWithURL: (NSURL *) aURL
+- (id) initWithURL: (NSURL *) aURL
userAgent: (NSString *) userAgent
timeout: (int) timeout
{
@@ -45,7 +45,7 @@
if (!self) {
return nil;
}
-
+
mTimeout = timeout;
if (userAgent) {
mUserAgent = [userAgent retain];
@@ -56,7 +56,7 @@
// create our request data buffer
mRequestData = [[NSMutableData alloc] initWithCapacity: 1024];
-
+
return self;
}
@@ -66,7 +66,7 @@
[aURL retain];
[mURL release];
mURL = aURL;
-
+
[self setupRequest];
}
@@ -108,7 +108,7 @@
// make the HTTP request
NSURLResponse * response;
NSError * error;
- NSData * responseData =
+ NSData * responseData =
[NSURLConnection sendSynchronousRequest: mRequest returningResponse: &response error: &error];
[mRequestData setLength: 0];
@@ -126,10 +126,10 @@
NSHTTPURLResponse * httpResponse = (NSHTTPURLResponse *) response;
if ([httpResponse statusCode] != 200) {
@throw [TTransportException exceptionWithName: @"TTransportException"
- reason: [NSString stringWithFormat: @"Bad response from HTTP server: %d",
+ reason: [NSString stringWithFormat: @"Bad response from HTTP server: %d",
[httpResponse statusCode]]];
}
-
+
// phew!
[mResponseData release];
mResponseData = [responseData retain];
diff --git a/lib/cocoa/src/transport/TNSFileHandleTransport.m b/lib/cocoa/src/transport/TNSFileHandleTransport.m
index 79a9e8d..c97b6c9 100644
--- a/lib/cocoa/src/transport/TNSFileHandleTransport.m
+++ b/lib/cocoa/src/transport/TNSFileHandleTransport.m
@@ -16,10 +16,10 @@
outputFileHandle: (NSFileHandle *) outputFileHandle
{
self = [super init];
-
+
mInputFileHandle = [inputFileHandle retain];
mOutputFileHandle = [outputFileHandle retain];
-
+
return self;
}
@@ -49,16 +49,16 @@
- (void) write: (uint8_t *) data offset: (unsigned int) offset length: (unsigned int) length
{
- NSData * dataObject = [[NSData alloc] initWithBytesNoCopy: data+offset
+ NSData * dataObject = [[NSData alloc] initWithBytesNoCopy: data+offset
length: length
freeWhenDone: NO];
-
+
[mOutputFileHandle writeData: dataObject];
-
+
[dataObject release];
}
-
+
- (void) flush
{
diff --git a/lib/cocoa/src/transport/TNSStreamTransport.m b/lib/cocoa/src/transport/TNSStreamTransport.m
index 42a197e..92da5b3 100644
--- a/lib/cocoa/src/transport/TNSStreamTransport.m
+++ b/lib/cocoa/src/transport/TNSStreamTransport.m
@@ -51,7 +51,7 @@
} else if (result != length) {
@throw [TTransportException exceptionWithReason: @"Output stream did not write all of our data."];
}
-}
+}
- (void) flush
{
diff --git a/lib/cocoa/src/transport/TSocketClient.m b/lib/cocoa/src/transport/TSocketClient.m
index e8ae6e9..e3da164 100644
--- a/lib/cocoa/src/transport/TSocketClient.m
+++ b/lib/cocoa/src/transport/TSocketClient.m
@@ -8,16 +8,16 @@
{
NSInputStream * input = nil;
NSOutputStream * output = nil;
-
+
[NSStream getStreamsToHost: [NSHost hostWithName: hostname]
port: port
- inputStream: &input
+ inputStream: &input
outputStream: &output];
self = [super initWithInputStream: input outputStream: output];
[input open];
[output open];
-
+
return self;
}