Skip to content

Commit a8f4794

Browse files
committed
Fix std::string corruption caused by memset a non-POD variable
Fixes #4
1 parent be41953 commit a8f4794

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

include/CmdLineParams.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ namespace Codec
2626

2727
struct CmdLineParams
2828
{
29-
uint8_t quality;
30-
bool dither;
31-
bool usingRenderDoc;
29+
uint8_t quality;
30+
bool dither;
31+
bool usingRenderDoc;
3232
Codec::Codec codec;
33-
std::string filename[2];
33+
std::string filename[2];
34+
35+
CmdLineParams() : quality( 0 ), dither( false ), usingRenderDoc( false ), codec( Codec::etc1 ) {}
3436
};

src/main.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ void saveToDisk( T &encoder, const CmdLineParams params )
162162
int main( int nargs, char *const argv[] )
163163
{
164164
CmdLineParams params;
165-
memset( &params, 0, sizeof( params ) );
166165
params.quality = 2;
167166

168167
if( !parseCmdLine( nargs, argv, params ) )

0 commit comments

Comments
 (0)