History

address snprintf warnings

Ge Wang committed 3 years ago

Commit 2b091f41 parent af9e3622 files · +12 −5Browse files

Showing the changes to src/core/chuck_shell.cpp (1 of 2 files). Show all

Unified · Split

src/core/chuck_shell.cpp+5−3
@@ -1974,7 +1974,9 @@ t_CKINT Chuck_Shell::Command_VMSwap::execute( vector< string > & argv, · 1973 unmodified lines
19741974 t_CKINT Chuck_Shell::Command_VMList::execute( vector< string > & argv,
19751975 string & out )
19761976 {
1977− char buf[16];
1977+ // 1.5.0.1 (ge) changed from 16 to 32;
1978+ // the former not long enough for big 64-bit numbers
1979+ char buf[32];
19781980 vector<string>::size_type i, len = caller->vms.size();
19791981
19801982 if( caller->current_vm != NULL )
@@ -1985,9 +1987,9 @@ t_CKINT Chuck_Shell::Command_VMList::execute( vector< string > & argv, · 4 unmodified lines
19851987 if( caller->vms[i] != NULL )
19861988 {
19871989 #ifndef __PLATFORM_WIN32__
1988− snprintf( buf, 16, "%lu", i );
1990+ snprintf( buf, 32, "%lu", i );
19891991 #else
1990− snprintf( buf, 16, "%lu", (long)i );
1992+ snprintf( buf, 32, "%lu", (long)i );
19911993 #endif // __PLATFORM_WIN32__
19921994 out += string( "VM " ) + buf + ": " +
19931995 caller->vms[i]->fullname() + "\n";

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t