mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00: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…
Reference in New Issue
Block a user