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
53string itoa( t_CKINT val )53string itoa( t_CKINT val )
54{54{
55 char buffer[128];55 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
57 return string(buffer);61 return string(buffer);
58}62}
59 63
@@ -68,7 +72,7 @@ string ftoa( t_CKFLOAT val, t_CKUINT precision ) · 8 unmodified lines
68 char str[32];72 char str[32];
69 char buffer[128];73 char buffer[128];
70 if( precision > 32 ) precision = 32;74 if( precision > 32 ) precision = 32;
71 sprintf( str, "%%.%lif", precision );75 sprintf( str, "%%.%lif", (long)precision );
72 sprintf( buffer, str, val );76 sprintf( buffer, str, val );
73 return string(buffer);77 return string(buffer);
74}78}
@@ -469,7 +473,7 @@ std::string extract_filepath_dir(std::string &filepath) · 394 unmodified lines
469//#endif473//#endif
470 474
471 // if the last character is a slash, skip it475 // if the last character is a slash, skip it
472 int i = filepath.rfind(path_separator);476 t_CKINT i = filepath.rfind(path_separator);
473 477
474 if(i == std::string::npos)478 if(i == std::string::npos)
475 return std::string();479 return std::string();
@@ -556,7 +560,7 @@ std::string normalize_directory_separator(const std::string &filepath) · 80 unmodified lines
556{560{
557#ifdef __PLATFORM_WIN32__561#ifdef __PLATFORM_WIN32__
558 std::string new_filepath = filepath;562 std::string new_filepath = filepath;
559 int len = new_filepath.size();563 t_CKINT len = new_filepath.size();
560 for(int i = 0; i < len; i++)564 for(int i = 0; i < len; i++)
561 {565 {
562 if(new_filepath[i] == '\\') new_filepath[i] = '/';566 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