used the following commands: find . -type f -name "*.h" | xargs sed -i 's/\s*$//g' find . -type f -name "*.cpp" | xargs sed -i 's/\s*$//g'
Showing the changes to src/core/util_string.cpp (1 of 90 files). Show all
Unified · Split
| @@ -218,30 +218,30 @@ string rtrim( const string & val ) · 217 unmodified lines | ||
| 218 | 218 | // name: extract_args() |
| 219 | 219 | // desc: extract argument from format filename:arg1:arg2:etc |
| 220 | 220 | //----------------------------------------------------------------------------- |
| 221 | −t_CKBOOL extract_args( const string & token, | |
| 221 | +t_CKBOOL extract_args( const string & token, | |
| 222 | 222 | string & filename, vector<string> & args ) |
| 223 | 223 | { |
| 224 | 224 | // clear vector |
| 225 | 225 | args.clear(); |
| 226 | 226 | // clear filename |
| 227 | 227 | filename = ""; |
| 228 | − | |
| 228 | + | |
| 229 | 229 | // last : found pos |
| 230 | 230 | t_CKINT prev_pos = 0; |
| 231 | 231 | // curr : pos |
| 232 | 232 | t_CKINT i = 0; |
| 233 | − | |
| 233 | + | |
| 234 | 234 | string tmp; |
| 235 | − | |
| 235 | + | |
| 236 | 236 | // copy and trim |
| 237 | 237 | string s = trim( token ); |
| 238 | − | |
| 238 | + | |
| 239 | 239 | // ignore second character as arg separator if its : on Windows |
| 240 | 240 | t_CKBOOL ignoreSecond = FALSE; |
| 241 | 241 | #ifdef __PLATFORM_WIN32__ |
| 242 | 242 | ignoreSecond = TRUE; |
| 243 | 243 | #endif // __PLATFORM_WIN32__ |
| 244 | − | |
| 244 | + | |
| 245 | 245 | // detect |
| 246 | 246 | t_CKBOOL scan = FALSE; |
| 247 | 247 | t_CKBOOL ret = TRUE; |
| @@ -253,14 +253,14 @@ t_CKBOOL extract_args( const string & token, · 5 unmodified lines | ||
| 253 | 253 | scan = TRUE; |
| 254 | 254 | break; |
| 255 | 255 | } |
| 256 | − | |
| 256 | + | |
| 257 | 257 | // mad... |
| 258 | 258 | if( scan ) |
| 259 | 259 | { |
| 260 | 260 | mask = new char[s.length()]; |
| 261 | 261 | // zero |
| 262 | 262 | memset(mask, 0, s.length()*sizeof(char)); |
| 263 | − | |
| 263 | + | |
| 264 | 264 | // loop through |
| 265 | 265 | for( i = 0; i < s.length(); i++ ) |
| 266 | 266 | { |
| @@ -271,7 +271,7 @@ t_CKBOOL extract_args( const string & token, · 4 unmodified lines | ||
| 271 | 271 | // mask[i] = 1; |
| 272 | 272 | // break; // added 1.3.1.1 |
| 273 | 273 | // } |
| 274 | − | |
| 274 | + | |
| 275 | 275 | // 1.3.2.0: spencer and ge fixed this, requiring \ to escape : |
| 276 | 276 | if( s[i] == '\\' && (i+1) < s.length() ) |
| 277 | 277 | { |
| @@ -318,15 +318,15 @@ t_CKBOOL extract_args( const string & token, · 40 unmodified lines | ||
| 318 | 318 | ret = FALSE; |
| 319 | 319 | goto done; |
| 320 | 320 | } |
| 321 | − | |
| 321 | + | |
| 322 | 322 | // copy |
| 323 | 323 | if( filename == "" ) |
| 324 | 324 | filename = tmp; |
| 325 | 325 | else |
| 326 | 326 | args.push_back( tmp ); |
| 327 | − | |
| 327 | + | |
| 328 | 328 | tmp = ""; |
| 329 | − | |
| 329 | + | |
| 330 | 330 | // update |
| 331 | 331 | prev_pos = i + 1; |
| 332 | 332 | } |
| @@ -334,11 +334,11 @@ t_CKBOOL extract_args( const string & token, · 1 unmodified line | ||
| 334 | 334 | { |
| 335 | 335 | tmp.append(1, s[i]); |
| 336 | 336 | } |
| 337 | − | |
| 337 | + | |
| 338 | 338 | // reset |
| 339 | 339 | ignoreNext = FALSE; |
| 340 | 340 | } |
| 341 | − | |
| 341 | + | |
| 342 | 342 | // get the remainder, if any |
| 343 | 343 | if( tmp.length() ) |
| 344 | 344 | { |
| @@ -348,7 +348,7 @@ t_CKBOOL extract_args( const string & token, · 3 unmodified lines | ||
| 348 | 348 | else |
| 349 | 349 | args.push_back( tmp ); |
| 350 | 350 | } |
| 351 | − | |
| 351 | + | |
| 352 | 352 | // testing code - spencer 1.3.2.0 |
| 353 | 353 | // CK_FPRINTF_STDERR( "INPUT: %s\n", token.c_str() ); |
| 354 | 354 | // CK_FPRINTF_STDERR( "FILENAME: %s\n", filename.c_str() ); |
| @@ -467,21 +467,21 @@ std::string globTildePath( const std::string & path ) · 112 unmodified lines | ||
| 467 | 467 | std::string get_full_path( const std::string & fp ) |
| 468 | 468 | { |
| 469 | 469 | #ifndef __PLATFORM_WIN32__ |
| 470 | − | |
| 470 | + | |
| 471 | 471 | char buf[PATH_MAX]; |
| 472 | 472 | char * result = realpath(fp.c_str(), buf); |
| 473 | − | |
| 473 | + | |
| 474 | 474 | // try with .ck extension |
| 475 | 475 | if(result == NULL && !str_endsin(fp.c_str(), ".ck")) |
| 476 | 476 | result = realpath((fp + ".ck").c_str(), buf); |
| 477 | − | |
| 477 | + | |
| 478 | 478 | if(result == NULL) |
| 479 | 479 | return fp; |
| 480 | 480 | else |
| 481 | 481 | return buf; |
| 482 | − | |
| 482 | + | |
| 483 | 483 | #else // |
| 484 | − | |
| 484 | + | |
| 485 | 485 | char buf[MAX_PATH]; |
| 486 | 486 | DWORD result = GetFullPathName(fp.c_str(), MAX_PATH, buf, NULL); |
| 487 | 487 | |
| @@ -528,13 +528,13 @@ std::string expand_filepath( std::string & fp, t_CKBOOL ensurePathExists ) · 40 unmodified lines | ||
| 528 | 528 | std::string extract_filepath_dir(std::string &filepath) |
| 529 | 529 | { |
| 530 | 530 | char path_separator = '/'; |
| 531 | − | |
| 531 | + | |
| 532 | 532 | //#ifdef __WINDOWS_DS__ |
| 533 | 533 | // path_separator = '\\'; |
| 534 | 534 | //#else |
| 535 | 535 | // path_separator = '/'; |
| 536 | 536 | //#endif |
| 537 | − | |
| 537 | + | |
| 538 | 538 | // if the last character is a slash, skip it |
| 539 | 539 | t_CKINT i = filepath.rfind(path_separator); |
| 540 | 540 | // if not separator found, return empty string |
| @@ -543,7 +543,7 @@ std::string extract_filepath_dir(std::string &filepath) · 2 unmodified lines | ||
| 543 | 543 | // skip any/all extra trailing slashes |
| 544 | 544 | while( i > 0 && filepath[i-1] == path_separator ) |
| 545 | 545 | i--; |
| 546 | − | |
| 546 | + | |
| 547 | 547 | // change spencer 2014-7-17: include trailing slash |
| 548 | 548 | return std::string(filepath, 0, i+1); |
| 549 | 549 | } |
| @@ -570,7 +570,7 @@ string dir_go_up( const string & dir, t_CKINT numUp ) · 20 unmodified lines | ||
| 570 | 570 | // skip any trailing slashes |
| 571 | 571 | while( pos > 0 && dir[pos-1] == path_separator ) |
| 572 | 572 | pos--; |
| 573 | − | |
| 573 | + | |
| 574 | 574 | // loop |
| 575 | 575 | while( numUp > 0 ) |
| 576 | 576 | { |
| @@ -614,13 +614,13 @@ void parse_path_list( std::string & str, std::list<std::string> & lst ) · 37 unmodified lines | ||
| 614 | 614 | const char separator = ':'; |
| 615 | 615 | #endif |
| 616 | 616 | std::string::size_type i = 0, last = 0; |
| 617 | − while( last < str.size() && | |
| 617 | + while( last < str.size() && | |
| 618 | 618 | ( i = str.find( separator, last ) ) != std::string::npos ) |
| 619 | 619 | { |
| 620 | 620 | lst.push_back( str.substr( last, i - last ) ); |
| 621 | 621 | last = i + 1; |
| 622 | 622 | } |
| 623 | − | |
| 623 | + | |
| 624 | 624 | lst.push_back( str.substr( last, str.size() - last ) ); |
| 625 | 625 | } |
| 626 | 626 | |
| @@ -660,7 +660,7 @@ t_CKBOOL str_endsin( const char * str, const char * end ) · 33 unmodified lines | ||
| 660 | 660 | { |
| 661 | 661 | size_t len = strlen(str); |
| 662 | 662 | size_t endlen = strlen(end); |
| 663 | − | |
| 663 | + | |
| 664 | 664 | return strncmp(str+(len-endlen), end, endlen) == 0; |
| 665 | 665 | } |
| 666 | 666 | |