You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2013/09/06 21:03:31 UTC

git commit: THRIFT-2162 Missing calls to inherited CTOR at misc. places

Updated Branches:
  refs/heads/master a6a32a56f -> 718f6eefb


THRIFT-2162 Missing calls to inherited CTOR at misc. places

Patch: Jens Geyer


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/718f6eef
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/718f6eef
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/718f6eef

Branch: refs/heads/master
Commit: 718f6eefb6791128a5290b3c7cf47f025ed60c66
Parents: a6a32a5
Author: Jens Geyer <je...@apache.org>
Authored: Fri Sep 6 21:02:34 2013 +0200
Committer: Jens Geyer <je...@apache.org>
Committed: Fri Sep 6 21:02:57 2013 +0200

----------------------------------------------------------------------
 compiler/cpp/src/generate/t_delphi_generator.cc |  1 +
 lib/delphi/src/Thrift.Collections.pas           |  2 ++
 lib/delphi/src/Thrift.Console.pas               |  1 +
 lib/delphi/src/Thrift.Protocol.pas              | 11 ++++++---
 lib/delphi/src/Thrift.Serializer.pas            |  2 ++
 lib/delphi/src/Thrift.Server.pas                |  5 ++++
 lib/delphi/src/Thrift.Stream.pas                |  2 ++
 lib/delphi/src/Thrift.Transport.pas             | 25 ++++++++++++++------
 lib/delphi/test/TestClient.pas                  |  6 ++++-
 .../test/multiplexed/Multiplex.Client.Main.pas  |  1 +
 10 files changed, 45 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/718f6eef/compiler/cpp/src/generate/t_delphi_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_delphi_generator.cc b/compiler/cpp/src/generate/t_delphi_generator.cc
index 547031d..fd396eb 100644
--- a/compiler/cpp/src/generate/t_delphi_generator.cc
+++ b/compiler/cpp/src/generate/t_delphi_generator.cc
@@ -1441,6 +1441,7 @@ void t_delphi_generator::generate_service_client(t_service* tservice) {
     ".TClient.Create( const iprot: IProtocol; const oprot: IProtocol);" << endl;
   indent_impl(s_service_impl) <<  "begin" << endl;
   indent_up_impl();
+  indent_impl(s_service_impl) << "inherited Create;" << endl;    
   indent_impl(s_service_impl) << "iprot_ := iprot;" << endl;    
   indent_impl(s_service_impl) << "oprot_ := oprot;" << endl;    
   indent_down_impl();

http://git-wip-us.apache.org/repos/asf/thrift/blob/718f6eef/lib/delphi/src/Thrift.Collections.pas
----------------------------------------------------------------------
diff --git a/lib/delphi/src/Thrift.Collections.pas b/lib/delphi/src/Thrift.Collections.pas
index 66ff1c0..3a0274c 100644
--- a/lib/delphi/src/Thrift.Collections.pas
+++ b/lib/delphi/src/Thrift.Collections.pas
@@ -320,6 +320,7 @@ end;
 
 constructor TThriftDictionaryImpl<TKey, TValue>.Create(ACapacity: Integer);
 begin
+  inherited Create;
   FDictionaly := TDictionary<TKey,TValue>.Create( ACapacity );
 end;
 
@@ -449,6 +450,7 @@ end;
 
 constructor TThriftListImpl<T>.Create;
 begin
+  inherited;
   FList := TList<T>.Create;
 end;
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/718f6eef/lib/delphi/src/Thrift.Console.pas
----------------------------------------------------------------------
diff --git a/lib/delphi/src/Thrift.Console.pas b/lib/delphi/src/Thrift.Console.pas
index 324efc3..5d1345b 100644
--- a/lib/delphi/src/Thrift.Console.pas
+++ b/lib/delphi/src/Thrift.Console.pas
@@ -84,6 +84,7 @@ end;
 
 constructor TGUIConsole.Create( AMemo: TMemo);
 begin
+  inherited Create;
   FMemo := AMemo;
   FLineBreak := True;
 end;

http://git-wip-us.apache.org/repos/asf/thrift/blob/718f6eef/lib/delphi/src/Thrift.Protocol.pas
----------------------------------------------------------------------
diff --git a/lib/delphi/src/Thrift.Protocol.pas b/lib/delphi/src/Thrift.Protocol.pas
index 1f27203..e88f1cf 100644
--- a/lib/delphi/src/Thrift.Protocol.pas
+++ b/lib/delphi/src/Thrift.Protocol.pas
@@ -516,6 +516,7 @@ end;
 constructor TFieldImpl.Create(const AName: string; const AType: TType;
   AId: SmallInt);
 begin
+  inherited Create;
   FName := AName;
   FType := AType;
   FId := AId;
@@ -523,6 +524,7 @@ end;
 
 constructor TFieldImpl.Create;
 begin
+  inherited Create;
   FName := '';
   FType := Low(TType);
   FId   := 0;
@@ -702,7 +704,7 @@ end;
 
 constructor TMapImpl.Create;
 begin
-
+  inherited Create;
 end;
 
 function TMapImpl.GetCount: Integer;
@@ -792,7 +794,7 @@ end;
 
 constructor TSetImpl.Create;
 begin
-
+  inherited Create;
 end;
 
 function TSetImpl.GetCount: Integer;
@@ -826,7 +828,7 @@ end;
 
 constructor TListImpl.Create;
 begin
-
+  inherited Create;
 end;
 
 function TListImpl.GetCount: Integer;
@@ -853,6 +855,7 @@ end;
 
 constructor TBinaryProtocolImpl.Create( const trans: ITransport);
 begin
+  //no inherited
   Create( trans, False, True);
 end;
 
@@ -1253,12 +1256,14 @@ end;
 
 constructor TBinaryProtocolImpl.TFactory.Create(AStrictRead, AStrictWrite: Boolean);
 begin
+  inherited Create;
   FStrictRead := AStrictRead;
   FStrictWrite := AStrictWrite;
 end;
 
 constructor TBinaryProtocolImpl.TFactory.Create;
 begin
+  //no inherited;  
   Create( False, True )
 end;
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/718f6eef/lib/delphi/src/Thrift.Serializer.pas
----------------------------------------------------------------------
diff --git a/lib/delphi/src/Thrift.Serializer.pas b/lib/delphi/src/Thrift.Serializer.pas
index dce6863..43b5d29 100644
--- a/lib/delphi/src/Thrift.Serializer.pas
+++ b/lib/delphi/src/Thrift.Serializer.pas
@@ -86,6 +86,7 @@ implementation
 constructor TSerializer.Create();
 // Create a new TSerializer that uses the TBinaryProtocol by default.
 begin
+  //no inherited;  
   Create( TBinaryProtocolImpl.TFactory.Create);
 end;
 
@@ -156,6 +157,7 @@ end;
 constructor TDeserializer.Create();
 // Create a new TDeserializer that uses the TBinaryProtocol by default.
 begin
+  //no inherited;  
   Create( TBinaryProtocolImpl.TFactory.Create);
 end;
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/718f6eef/lib/delphi/src/Thrift.Server.pas
----------------------------------------------------------------------
diff --git a/lib/delphi/src/Thrift.Server.pas b/lib/delphi/src/Thrift.Server.pas
index e6ab7ac..7d39f6b 100644
--- a/lib/delphi/src/Thrift.Server.pas
+++ b/lib/delphi/src/Thrift.Server.pas
@@ -120,6 +120,7 @@ begin
   InputTransFactory := TTransportFactoryImpl.Create;
   OutputTransFactory := TTransportFactoryImpl.Create;
 
+  //no inherited;  
   Create(
     AProcessor,
     AServerTransport,
@@ -143,6 +144,7 @@ begin
   InputTransFactory := TTransportFactoryImpl.Create;
   OutputTransFactory := TTransportFactoryImpl.Create;
 
+  //no inherited;  
   Create(
     AProcessor,
     AServerTransport,
@@ -163,6 +165,7 @@ begin
   InputProtocolFactory := TBinaryProtocolImpl.TFactory.Create;
   OutputProtocolFactory := TBinaryProtocolImpl.TFactory.Create;
 
+  //no inherited;  
   Create( AProcessor, AServerTransport, ATransportFactory, ATransportFactory,
     InputProtocolFactory, OutputProtocolFactory, DefaultLogDelegate);
 end;
@@ -173,6 +176,7 @@ constructor TServerImpl.Create(const AProcessor: IProcessor;
   const AInputProtocolFactory, AOutputProtocolFactory: IProtocolFactory;
   const ALogDelegate : TLogDelegate);
 begin
+  inherited Create;
   FProcessor := AProcessor;
   FServerTransport := AServerTransport;
   FInputTransportFactory := AInputTransportFactory;
@@ -191,6 +195,7 @@ constructor TServerImpl.Create( const AProcessor: IProcessor;
   const AServerTransport: IServerTransport; const ATransportFactory: ITransportFactory;
   const AProtocolFactory: IProtocolFactory);
 begin
+  //no inherited;  
   Create( AProcessor, AServerTransport,
           ATransportFactory, ATransportFactory,
           AProtocolFactory, AProtocolFactory,

http://git-wip-us.apache.org/repos/asf/thrift/blob/718f6eef/lib/delphi/src/Thrift.Stream.pas
----------------------------------------------------------------------
diff --git a/lib/delphi/src/Thrift.Stream.pas b/lib/delphi/src/Thrift.Stream.pas
index 81d5d2a..c08f5ea 100644
--- a/lib/delphi/src/Thrift.Stream.pas
+++ b/lib/delphi/src/Thrift.Stream.pas
@@ -98,6 +98,7 @@ end;
 
 constructor TThriftStreamAdapterCOM.Create( const AStream: IStream);
 begin
+  inherited Create;
   FStream := AStream;
 end;
 
@@ -221,6 +222,7 @@ end;
 
 constructor TThriftStreamAdapterDelphi.Create( const AStream: TStream; AOwnsStream: Boolean);
 begin
+  inherited Create;
   FStream := AStream;
   FOwnsStream := AOwnsStream;
 end;

http://git-wip-us.apache.org/repos/asf/thrift/blob/718f6eef/lib/delphi/src/Thrift.Transport.pas
----------------------------------------------------------------------
diff --git a/lib/delphi/src/Thrift.Transport.pas b/lib/delphi/src/Thrift.Transport.pas
index 8668e5a..0d5b384 100644
--- a/lib/delphi/src/Thrift.Transport.pas
+++ b/lib/delphi/src/Thrift.Transport.pas
@@ -502,6 +502,7 @@ end;
 
 constructor TTransportException.Create(AType: TExceptionType);
 begin
+  //no inherited;  
   Create( AType, '' )
 end;
 
@@ -539,17 +540,20 @@ end;
 
 constructor TServerSocketImpl.Create( const AServer: TTcpServer; AClientTimeout: Integer);
 begin
+  inherited Create;
   FServer := AServer;
   FClientTimeout := AClientTimeout;
 end;
 
 constructor TServerSocketImpl.Create( const AServer: TTcpServer);
 begin
+  //no inherited;  
   Create( AServer, 0 );
 end;
 
 constructor TServerSocketImpl.Create(APort: Integer);
 begin
+  //no inherited;  
   Create( APort, 0 );
 end;
 
@@ -616,6 +620,7 @@ end;
 constructor TServerSocketImpl.Create(APort, AClientTimeout: Integer;
   AUseBufferedSockets: Boolean);
 begin
+  inherited Create;
   FPort := APort;
   FClientTimeout := AClientTimeout;
   FUseBufferedSocket := AUseBufferedSockets;
@@ -655,6 +660,7 @@ end;
 
 constructor TServerSocketImpl.Create(APort, AClientTimeout: Integer);
 begin
+  //no inherited;  
   Create( APort, AClientTimeout, False );
 end;
 
@@ -666,27 +672,25 @@ var
 begin
   FClient := AClient;
   stream := TTcpSocketStreamImpl.Create( FClient);
-  FInputStream := stream;
-  FOutputStream := stream;
+  inherited Create( stream, stream);
 end;
 
 constructor TSocketImpl.Create(const AHost: string; APort: Integer);
 begin
+  //no inherited;  
   Create( AHost, APort, 0);
 end;
 
 procedure TSocketImpl.Close;
 begin
   inherited Close;
-  if FClient <> nil then
-  begin
-    FClient.Free;
-    FClient := nil;
-  end;
+  if FClient <> nil
+  then FreeAndNil( FClient);
 end;
 
 constructor TSocketImpl.Create(const AHost: string; APort, ATimeout: Integer);
 begin
+  inherited Create(nil,nil);
   FHost := AHost;
   FPort := APort;
   FTimeout := ATimeout;
@@ -781,6 +785,7 @@ end;
 
 constructor TBufferedStreamImpl.Create( const AStream: IThriftStream; ABufSize: Integer);
 begin
+  inherited Create;
   FStream := AStream;
   FBufSize := ABufSize;
   FReadBuffer := TMemoryStream.Create;
@@ -916,6 +921,7 @@ end;
 
 constructor TStreamTransportImpl.Create( const AInputStream : IThriftStream; const AOutputStream : IThriftStream);
 begin
+  inherited Create;
   FInputStream := AInputStream;
   FOutputStream := AOutputStream;
 end;
@@ -980,6 +986,7 @@ end;
 
 constructor TBufferedTransportImpl.Create( const ATransport: IStreamTransport);
 begin
+  //no inherited;  
   Create( ATransport, 1024 );
 end;
 
@@ -991,6 +998,7 @@ end;
 constructor TBufferedTransportImpl.Create( const ATransport: IStreamTransport;
   ABufSize: Integer);
 begin
+  inherited Create;
   FTransport := ATransport;
   FBufSize := ABufSize;
   InitBuffers;
@@ -1067,6 +1075,7 @@ end;
 
 constructor TFramedTransportImpl.Create;
 begin
+  inherited Create;
   InitWriteBuffer;
 end;
 
@@ -1077,6 +1086,7 @@ end;
 
 constructor TFramedTransportImpl.Create( const ATrans: ITransport);
 begin
+  inherited Create;
   InitWriteBuffer;
   FTransport := ATrans;
 end;
@@ -1206,6 +1216,7 @@ end;
 
 constructor TTcpSocketStreamImpl.Create( const ATcpClient: TCustomIpClient);
 begin
+  inherited Create;
   FTcpClient := ATcpClient;
 end;
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/718f6eef/lib/delphi/test/TestClient.pas
----------------------------------------------------------------------
diff --git a/lib/delphi/test/TestClient.pas b/lib/delphi/test/TestClient.pas
index 37fe7d7..e63bd4c 100644
--- a/lib/delphi/test/TestClient.pas
+++ b/lib/delphi/test/TestClient.pas
@@ -66,7 +66,9 @@ type
 
     procedure ClientTest;
     procedure JSONProtocolReadWriteTest;
+    {$IFDEF StressTest}
     procedure StressTest(const client : TThriftTest.Iface);
+    {$ENDIF}
   protected
     procedure Execute; override;
   public
@@ -859,6 +861,7 @@ begin
 end;
 
 
+{$IFDEF StressTest}
 procedure TClientThread.StressTest(const client : TThriftTest.Iface);
 begin
   while TRUE do begin
@@ -875,7 +878,7 @@ begin
     end;
   end;
 end;
-
+{$ENDIF}
 
 procedure TClientThread.JSONProtocolReadWriteTest;
 // Tests only then read/write procedures of the JSON protocol
@@ -1080,6 +1083,7 @@ end;
 
 constructor TThreadConsole.Create(AThread: TThread);
 begin
+  inherited Create;
   FThread := AThread;
 end;
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/718f6eef/lib/delphi/test/multiplexed/Multiplex.Client.Main.pas
----------------------------------------------------------------------
diff --git a/lib/delphi/test/multiplexed/Multiplex.Client.Main.pas b/lib/delphi/test/multiplexed/Multiplex.Client.Main.pas
index 2cc7ab0..a1af40b 100644
--- a/lib/delphi/test/multiplexed/Multiplex.Client.Main.pas
+++ b/lib/delphi/test/multiplexed/Multiplex.Client.Main.pas
@@ -78,6 +78,7 @@ end;
 
 constructor TTestClient.Create( const args: array of string);
 begin
+  inherited;  
   ParseArgs(args);
   Setup;
 end;