History

updating sprintf() functions to snprintf(); additional changes for type casting consistency

Ge Wang committed 3 years ago

Commit 725e88b1 parent 452dff937 files · +282 −257Browse files

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

Unified · Split

src/core/util_string.cpp+4−4
@@ -54,9 +54,9 @@ string itoa( t_CKINT val ) · 53 unmodified lines
5454 {
5555 char buffer[128];
5656 #ifdef _WIN64
57− sprintf( buffer, "%lld", val );
57+ snprintf( buffer, 128, "%lld", val );
5858 #else
59− sprintf( buffer, "%ld", val );
59+ snprintf( buffer, 128, "%ld", val );
6060 #endif
6161 return string(buffer);
6262 }
@@ -72,8 +72,8 @@ string ftoa( t_CKFLOAT val, t_CKUINT precision ) · 9 unmodified lines
7272 char str[32];
7373 char buffer[128];
7474 if( precision > 32 ) precision = 32;
75− sprintf( str, "%%.%lif", (long)precision );
76− sprintf( buffer, str, val );
75+ snprintf( str, 32, "%%.%lif", (long)precision );
76+ snprintf( buffer, 128, str, val );
7777 return string(buffer);
7878 }
7979

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