mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Properly terminate source file data.
This commit is contained in:
parent
80bd4275eb
commit
ff8c9ab6dc
@ -395,9 +395,10 @@ void View::SetTextEditorFile( const char* fileName, int line )
|
|||||||
fseek( f, 0, SEEK_END );
|
fseek( f, 0, SEEK_END );
|
||||||
const auto sz = ftell( f );
|
const auto sz = ftell( f );
|
||||||
fseek( f, 0, SEEK_SET );
|
fseek( f, 0, SEEK_SET );
|
||||||
auto data = new char[sz];
|
auto data = new char[sz+1];
|
||||||
fread( data, 1, sz, f );
|
fread( data, 1, sz, f );
|
||||||
fclose( f );
|
fclose( f );
|
||||||
|
data[sz] = '\0';
|
||||||
m_textEditor->SetText( data );
|
m_textEditor->SetText( data );
|
||||||
delete[] data;
|
delete[] data;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user