No changes, just a small optimization in DataStreamTestCase.
Don't create streams on the heap completely unnecessarily, just allocate them on the stack. This makes the code shorter, safer and slightly more efficient. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73935 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -75,23 +75,19 @@ DataStreamTestCase::DataStreamTestCase()
|
|||||||
static
|
static
|
||||||
wxFloat64 TestFloatRW(wxFloat64 fValue)
|
wxFloat64 TestFloatRW(wxFloat64 fValue)
|
||||||
{
|
{
|
||||||
wxFileOutputStream* pFileOutput = new wxFileOutputStream( wxT("mytext.dat") );
|
{
|
||||||
wxDataOutputStream* pDataOutput = new wxDataOutputStream( *pFileOutput );
|
wxFileOutputStream pFileOutput( wxT("mytext.dat") );
|
||||||
|
wxDataOutputStream pDataOutput( pFileOutput );
|
||||||
|
|
||||||
*pDataOutput << fValue;
|
pDataOutput << fValue;
|
||||||
|
}
|
||||||
|
|
||||||
delete pDataOutput;
|
wxFileInputStream pFileInput( wxT("mytext.dat") );
|
||||||
delete pFileOutput;
|
wxDataInputStream pDataInput( pFileInput );
|
||||||
|
|
||||||
wxFileInputStream* pFileInput = new wxFileInputStream( wxT("mytext.dat") );
|
|
||||||
wxDataInputStream* pDataInput = new wxDataInputStream( *pFileInput );
|
|
||||||
|
|
||||||
wxFloat64 fInFloat;
|
wxFloat64 fInFloat;
|
||||||
|
|
||||||
*pDataInput >> fInFloat;
|
pDataInput >> fInFloat;
|
||||||
|
|
||||||
delete pDataInput;
|
|
||||||
delete pFileInput;
|
|
||||||
|
|
||||||
return fInFloat;
|
return fInFloat;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user