Skip to content

Commit

Permalink
Fix std::string corruption caused by memset a non-POD variable
Browse files Browse the repository at this point in the history
Fixes #4
  • Loading branch information
darksylinc committed Oct 25, 2020
1 parent be41953 commit a8f4794
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 6 additions & 4 deletions include/CmdLineParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ namespace Codec

struct CmdLineParams
{
uint8_t quality;
bool dither;
bool usingRenderDoc;
uint8_t quality;
bool dither;
bool usingRenderDoc;
Codec::Codec codec;
std::string filename[2];
std::string filename[2];

CmdLineParams() : quality( 0 ), dither( false ), usingRenderDoc( false ), codec( Codec::etc1 ) {}
};
1 change: 0 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ void saveToDisk( T &encoder, const CmdLineParams params )
int main( int nargs, char *const argv[] )
{
CmdLineParams params;
memset( &params, 0, sizeof( params ) );
params.quality = 2;

if( !parseCmdLine( nargs, argv, params ) )
Expand Down

0 comments on commit a8f4794

Please sign in to comment.