THRIFT-2162 Missing calls to inherited CTOR at misc. places
authorJens Geyer <jensg@apache.org>
Fri, 6 Sep 2013 19:02:34 +0000 (21:02 +0200)
committerJens Geyer <jensg@apache.org>
Fri, 6 Sep 2013 19:02:57 +0000 (21:02 +0200)
Patch: Jens Geyer

compiler/cpp/src/generate/t_delphi_generator.cc
lib/delphi/src/Thrift.Collections.pas
lib/delphi/src/Thrift.Console.pas
lib/delphi/src/Thrift.Protocol.pas
lib/delphi/src/Thrift.Serializer.pas
lib/delphi/src/Thrift.Server.pas
lib/delphi/src/Thrift.Stream.pas
lib/delphi/src/Thrift.Transport.pas
lib/delphi/test/TestClient.pas
lib/delphi/test/multiplexed/Multiplex.Client.Main.pas

index 547031d..fd396eb 100644 (file)
@@ -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();
index 66ff1c0..3a0274c 100644 (file)
@@ -320,6 +320,7 @@ end;
 \r
 constructor TThriftDictionaryImpl<TKey, TValue>.Create(ACapacity: Integer);\r
 begin\r
+  inherited Create;\r
   FDictionaly := TDictionary<TKey,TValue>.Create( ACapacity );\r
 end;\r
 \r
@@ -449,6 +450,7 @@ end;
 \r
 constructor TThriftListImpl<T>.Create;\r
 begin\r
+  inherited;\r
   FList := TList<T>.Create;\r
 end;\r
 \r
index 324efc3..5d1345b 100644 (file)
@@ -84,6 +84,7 @@ end;
 \r
 constructor TGUIConsole.Create( AMemo: TMemo);\r
 begin\r
+  inherited Create;\r
   FMemo := AMemo;\r
   FLineBreak := True;\r
 end;\r
index 1f27203..e88f1cf 100644 (file)
@@ -516,6 +516,7 @@ end;
 constructor TFieldImpl.Create(const AName: string; const AType: TType;\r
   AId: SmallInt);\r
 begin\r
+  inherited Create;\r
   FName := AName;\r
   FType := AType;\r
   FId := AId;\r
@@ -523,6 +524,7 @@ end;
 \r
 constructor TFieldImpl.Create;\r
 begin\r
+  inherited Create;\r
   FName := '';\r
   FType := Low(TType);\r
   FId   := 0;\r
@@ -702,7 +704,7 @@ end;
 \r
 constructor TMapImpl.Create;\r
 begin\r
-\r
+  inherited Create;\r
 end;\r
 \r
 function TMapImpl.GetCount: Integer;\r
@@ -792,7 +794,7 @@ end;
 \r
 constructor TSetImpl.Create;\r
 begin\r
-\r
+  inherited Create;\r
 end;\r
 \r
 function TSetImpl.GetCount: Integer;\r
@@ -826,7 +828,7 @@ end;
 \r
 constructor TListImpl.Create;\r
 begin\r
-\r
+  inherited Create;\r
 end;\r
 \r
 function TListImpl.GetCount: Integer;\r
@@ -853,6 +855,7 @@ end;
 \r
 constructor TBinaryProtocolImpl.Create( const trans: ITransport);\r
 begin\r
+  //no inherited\r
   Create( trans, False, True);\r
 end;\r
 \r
@@ -1253,12 +1256,14 @@ end;
 \r
 constructor TBinaryProtocolImpl.TFactory.Create(AStrictRead, AStrictWrite: Boolean);\r
 begin\r
+  inherited Create;\r
   FStrictRead := AStrictRead;\r
   FStrictWrite := AStrictWrite;\r
 end;\r
 \r
 constructor TBinaryProtocolImpl.TFactory.Create;\r
 begin\r
+  //no inherited;  \r
   Create( False, True )\r
 end;\r
 \r
index dce6863..43b5d29 100644 (file)
@@ -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;
 
index e6ab7ac..7d39f6b 100644 (file)
@@ -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,
index 81d5d2a..c08f5ea 100644 (file)
@@ -98,6 +98,7 @@ end;
 \r
 constructor TThriftStreamAdapterCOM.Create( const AStream: IStream);\r
 begin\r
+  inherited Create;\r
   FStream := AStream;\r
 end;\r
 \r
@@ -221,6 +222,7 @@ end;
 \r
 constructor TThriftStreamAdapterDelphi.Create( const AStream: TStream; AOwnsStream: Boolean);\r
 begin\r
+  inherited Create;\r
   FStream := AStream;\r
   FOwnsStream := AOwnsStream;\r
 end;\r
index 8668e5a..0d5b384 100644 (file)
@@ -502,6 +502,7 @@ end;
 \r
 constructor TTransportException.Create(AType: TExceptionType);\r
 begin\r
+  //no inherited;  \r
   Create( AType, '' )\r
 end;\r
 \r
@@ -539,17 +540,20 @@ end;
 \r
 constructor TServerSocketImpl.Create( const AServer: TTcpServer; AClientTimeout: Integer);\r
 begin\r
+  inherited Create;\r
   FServer := AServer;\r
   FClientTimeout := AClientTimeout;\r
 end;\r
 \r
 constructor TServerSocketImpl.Create( const AServer: TTcpServer);\r
 begin\r
+  //no inherited;  \r
   Create( AServer, 0 );\r
 end;\r
 \r
 constructor TServerSocketImpl.Create(APort: Integer);\r
 begin\r
+  //no inherited;  \r
   Create( APort, 0 );\r
 end;\r
 \r
@@ -616,6 +620,7 @@ end;
 constructor TServerSocketImpl.Create(APort, AClientTimeout: Integer;\r
   AUseBufferedSockets: Boolean);\r
 begin\r
+  inherited Create;\r
   FPort := APort;\r
   FClientTimeout := AClientTimeout;\r
   FUseBufferedSocket := AUseBufferedSockets;\r
@@ -655,6 +660,7 @@ end;
 \r
 constructor TServerSocketImpl.Create(APort, AClientTimeout: Integer);\r
 begin\r
+  //no inherited;  \r
   Create( APort, AClientTimeout, False );\r
 end;\r
 \r
@@ -666,27 +672,25 @@ var
 begin\r
   FClient := AClient;\r
   stream := TTcpSocketStreamImpl.Create( FClient);\r
-  FInputStream := stream;\r
-  FOutputStream := stream;\r
+  inherited Create( stream, stream);\r
 end;\r
 \r
 constructor TSocketImpl.Create(const AHost: string; APort: Integer);\r
 begin\r
+  //no inherited;  \r
   Create( AHost, APort, 0);\r
 end;\r
 \r
 procedure TSocketImpl.Close;\r
 begin\r
   inherited Close;\r
-  if FClient <> nil then\r
-  begin\r
-    FClient.Free;\r
-    FClient := nil;\r
-  end;\r
+  if FClient <> nil\r
+  then FreeAndNil( FClient);\r
 end;\r
 \r
 constructor TSocketImpl.Create(const AHost: string; APort, ATimeout: Integer);\r
 begin\r
+  inherited Create(nil,nil);\r
   FHost := AHost;\r
   FPort := APort;\r
   FTimeout := ATimeout;\r
@@ -781,6 +785,7 @@ end;
 \r
 constructor TBufferedStreamImpl.Create( const AStream: IThriftStream; ABufSize: Integer);\r
 begin\r
+  inherited Create;\r
   FStream := AStream;\r
   FBufSize := ABufSize;\r
   FReadBuffer := TMemoryStream.Create;\r
@@ -916,6 +921,7 @@ end;
 \r
 constructor TStreamTransportImpl.Create( const AInputStream : IThriftStream; const AOutputStream : IThriftStream);\r
 begin\r
+  inherited Create;\r
   FInputStream := AInputStream;\r
   FOutputStream := AOutputStream;\r
 end;\r
@@ -980,6 +986,7 @@ end;
 \r
 constructor TBufferedTransportImpl.Create( const ATransport: IStreamTransport);\r
 begin\r
+  //no inherited;  \r
   Create( ATransport, 1024 );\r
 end;\r
 \r
@@ -991,6 +998,7 @@ end;
 constructor TBufferedTransportImpl.Create( const ATransport: IStreamTransport;\r
   ABufSize: Integer);\r
 begin\r
+  inherited Create;\r
   FTransport := ATransport;\r
   FBufSize := ABufSize;\r
   InitBuffers;\r
@@ -1067,6 +1075,7 @@ end;
 \r
 constructor TFramedTransportImpl.Create;\r
 begin\r
+  inherited Create;\r
   InitWriteBuffer;\r
 end;\r
 \r
@@ -1077,6 +1086,7 @@ end;
 \r
 constructor TFramedTransportImpl.Create( const ATrans: ITransport);\r
 begin\r
+  inherited Create;\r
   InitWriteBuffer;\r
   FTransport := ATrans;\r
 end;\r
@@ -1206,6 +1216,7 @@ end;
 \r
 constructor TTcpSocketStreamImpl.Create( const ATcpClient: TCustomIpClient);\r
 begin\r
+  inherited Create;\r
   FTcpClient := ATcpClient;\r
 end;\r
 \r
index 37fe7d7..e63bd4c 100644 (file)
@@ -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;
 
index 2cc7ab0..a1af40b 100644 (file)
@@ -78,6 +78,7 @@ end;
 
 constructor TTestClient.Create( const args: array of string);
 begin
+  inherited;  
   ParseArgs(args);
   Setup;
 end;