History

update long/t_CKINT mismatches; address windows 64-bit warnings

Ge Wang committed 4 years ago

Commit bd96b1b1 parent 72e554b24 files · +189 −176Browse files

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

Unified · Split

src/core/util_string.cpp+8−4
@@ -53,7 +53,11 @@ using namespace std; · 52 unmodified lines
5353 string itoa( t_CKINT val )
5454 {
5555 char buffer[128];
56− sprintf( buffer, "%li", val );
56+#ifdef _WIN64
57+ sprintf( buffer, "%lld", val );
58+#else
59+ sprintf( buffer, "%ld", val );
60+#endif
5761 return string(buffer);
5862 }
5963
@@ -68,7 +72,7 @@ string ftoa( t_CKFLOAT val, t_CKUINT precision ) · 8 unmodified lines
6872 char str[32];
6973 char buffer[128];
7074 if( precision > 32 ) precision = 32;
71− sprintf( str, "%%.%lif", precision );
75+ sprintf( str, "%%.%lif", (long)precision );
7276 sprintf( buffer, str, val );
7377 return string(buffer);
7478 }
@@ -469,7 +473,7 @@ std::string extract_filepath_dir(std::string &filepath) · 394 unmodified lines
469473 //#endif
470474
471475 // if the last character is a slash, skip it
472− int i = filepath.rfind(path_separator);
476+ t_CKINT i = filepath.rfind(path_separator);
473477
474478 if(i == std::string::npos)
475479 return std::string();
@@ -556,7 +560,7 @@ std::string normalize_directory_separator(const std::string &filepath) · 80 unmodified lines
556560 {
557561 #ifdef __PLATFORM_WIN32__
558562 std::string new_filepath = filepath;
559− int len = new_filepath.size();
563+ t_CKINT len = new_filepath.size();
560564 for(int i = 0; i < len; i++)
561565 {
562566 if(new_filepath[i] == '\\') new_filepath[i] = '/';

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