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
54{54{
55 char buffer[128];55 char buffer[128];
56#ifdef _WIN6456#ifdef _WIN64
57 sprintf( buffer, "%lld", val );57 snprintf( buffer, 128, "%lld", val );
58#else58#else
59 sprintf( buffer, "%ld", val );59 snprintf( buffer, 128, "%ld", val );
60#endif60#endif
61 return string(buffer);61 return string(buffer);
62}62}
@@ -72,8 +72,8 @@ string ftoa( t_CKFLOAT val, t_CKUINT precision ) · 9 unmodified lines
72 char str[32];72 char str[32];
73 char buffer[128];73 char buffer[128];
74 if( precision > 32 ) precision = 32;74 if( precision > 32 ) precision = 32;
75 sprintf( str, "%%.%lif", (long)precision );75 snprintf( str, 32, "%%.%lif", (long)precision );
76 sprintf( buffer, str, val );76 snprintf( buffer, 128, str, val );
77 return string(buffer);77 return string(buffer);
78}78}
79 79

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