# # # patch "win32/fs.cc" # from [e8a0fbb17e9b03fecd71e8f3d5eeee0d0dbf5de9] # to [a46c5fc926a5b302eb52739ed74772d1eb0ae87d] # # patch "win32/get_system_flavour.cc" # from [dd8415ec8a86d475603b5445dce3f3d18c662582] # to [8efb6bd99f6d609941294ce7d55a608a9cc94940] # # patch "win32/inodeprint.cc" # from [fa81e7a6c6f6d55b7b29c55f74ce5de6fbc4e697] # to [59fe4edc9c3dd1e42ff9f6dd0cef5572fe900d79] # # patch "win32/os_strerror.cc" # from [72cc1d13dee3316d38a42a93ec1c74d66ced8424] # to [59239fd3668421bc3a3c79d6e789a207a8ae2980] # # patch "win32/process.cc" # from [de8d8551026653552c48a3c5c1cb2a45b99939f9] # to [ee730c09564abfbe59c02bf647d5b33dc5c5f865] # # patch "win32/read_password.cc" # from [2367156ff1a6fe6ec68b0281f835578391ba25e2] # to [cf6800617aeed302e364567daa9aa61da6e047d0] # # patch "win32/terminal.cc" # from [5f926f20442ec159cb0444079b324927dcf48bdd] # to [374a0405faee0b84777b8192386f954efab1b433] # ============================================================ --- win32/fs.cc e8a0fbb17e9b03fecd71e8f3d5eeee0d0dbf5de9 +++ win32/fs.cc a46c5fc926a5b302eb52739ed74772d1eb0ae87d @@ -17,29 +17,31 @@ #include "sanity.hh" #include "platform.hh" +using std::string; +using std::vector; namespace fs = boost::filesystem; -std::string +string get_current_working_dir() { - std::vector buffer; + vector buffer; buffer.resize(4096); E(getcwd(&*buffer.begin(), buffer.size()), F("cannot get working directory: %s") % strerror(errno)); - std::string str(&*buffer.begin()); + string str(&*buffer.begin()); if (str[str.size() - 1] == '\\') str = str.substr(0, str.size() - 1); return str; } void -change_current_working_dir(std::string const & to) +change_current_working_dir(string const & to) { E(!chdir(to.c_str()), F("cannot change to directory %s: %s") % to % strerror(errno)); } -static std::string +static string get_default_confdir_base() { char const * appdata = getenv("APPDATA"); @@ -51,10 +53,10 @@ get_default_confdir_base() return ""; } -std::string +string get_default_confdir() { - std::string base = get_default_confdir_base(); + string base = get_default_confdir_base(); N(!base.empty(), F("could not determine configuration path")); return base + "\\monotone"; } @@ -62,7 +64,7 @@ get_default_confdir() // FIXME: BUG: this probably mangles character sets // (as in, we're treating system-provided data as utf8, but it's probably in // the filesystem charset) -std::string +string get_homedir() { // Windows is fun! @@ -92,7 +94,7 @@ get_homedir() if (homedrive != NULL && homepath != NULL) { L(FL("Home directory from HOMEDRIVE+HOMEPATH\n")); - return std::string(homedrive) + homepath; + return string(homedrive) + homepath; } char const * systemdrive = getenv("SystemDrive"); if (systemdrive != NULL) @@ -103,8 +105,8 @@ get_homedir() return "C:"; } -std::string -tilde_expand(std::string const & in) +string +tilde_expand(string const & in) { if (in.empty() || in[0] != '~') return in; @@ -128,7 +130,7 @@ path::status } path::status -get_path_status(std::string const & path) +get_path_status(string const & path) { fs::path p(path, fs::native); if (!fs::exists(p)) @@ -158,7 +160,7 @@ static bool } static bool -rename_clobberingly_impl(std::string const & from, std::string const & to) +rename_clobberingly_impl(string const & from, string const & to) { // MoveFileEx is only available on NT-based systems. We will revert to a // more compatible DeleteFile/MoveFile pair as a compatibility fall-back. @@ -186,7 +188,7 @@ void } void -rename_clobberingly(std::string const & from, std::string const & to) +rename_clobberingly(string const & from, string const & to) { static const int renameAttempts = 16; DWORD sleepTime = 1; ============================================================ --- win32/get_system_flavour.cc dd8415ec8a86d475603b5445dce3f3d18c662582 +++ win32/get_system_flavour.cc 8efb6bd99f6d609941294ce7d55a608a9cc94940 @@ -9,6 +9,8 @@ #define WIN32_LEAN_AND_MEAN #include +using std::string; + struct table_entry { unsigned long key; @@ -18,13 +20,13 @@ key_to_string(unsigned long key, void key_to_string(unsigned long key, table_entry * table, - std::string & str, - std::string const & def) + string & str, + string const & def) { while (table->val != 0) { if (table->key == key) { - str = std::string(table->val); + str = string(table->val); return; } ++table; @@ -120,7 +122,7 @@ void }; void -get_system_flavour(std::string & ident) +get_system_flavour(string & ident) { SYSTEM_INFO si; OSVERSIONINFO vi; @@ -130,7 +132,7 @@ get_system_flavour(std::string & ident) GetSystemInfo(&si); I(GetVersionEx(&vi)); - std::string family, processor; + string family, processor; key_to_string(vi.dwPlatformId, families, family, "unknown"); ============================================================ --- win32/inodeprint.cc fa81e7a6c6f6d55b7b29c55f74ce5de6fbc4e697 +++ win32/inodeprint.cc 59fe4edc9c3dd1e42ff9f6dd0cef5572fe900d79 @@ -10,6 +10,8 @@ #include "platform.hh" #include "sanity.hh" +using std::string; + inline double difftime(FILETIME now, FILETIME then) { @@ -36,7 +38,7 @@ bool } bool -inodeprint_file(std::string const & file, inodeprint_calculator & calc) +inodeprint_file(string const & file, inodeprint_calculator & calc) { struct _stati64 st; if (_stati64(file.c_str(), &st) < 0) ============================================================ --- win32/os_strerror.cc 72cc1d13dee3316d38a42a93ec1c74d66ced8424 +++ win32/os_strerror.cc 59239fd3668421bc3a3c79d6e789a207a8ae2980 @@ -9,7 +9,9 @@ #include "sanity.hh" #include "platform.hh" -std::string +using std::string; + +string os_strerror(os_err_t errnum) { LPTSTR tstr; @@ -20,12 +22,12 @@ os_strerror(os_err_t errnum) static_cast(0)); if (len == 0) return (F("unknown error code %d") % errnum).str(); - std::string errstr = tstr; + string errstr = tstr; LocalFree(tstr); // clobber trailing newlines. - std::string::size_type end = errstr.find_last_not_of("\r\n"); - if (end != std::string::npos) + string::size_type end = errstr.find_last_not_of("\r\n"); + if (end != string::npos) errstr.erase(end + 1); return errstr; } ============================================================ --- win32/process.cc de8d8551026653552c48a3c5c1cb2a45b99939f9 +++ win32/process.cc ee730c09564abfbe59c02bf647d5b33dc5c5f865 @@ -11,15 +11,18 @@ #include "sanity.hh" #include "platform.hh" -static std::string -munge_inner_argument(std::string arg) +using std::string; +using std::vector; + +static string +munge_inner_argument(string arg) { - std::string result; + string result; bool has_space = false; unsigned quotes = 0; bool space_outside_quote = false; - for (std::string::const_iterator it = arg.begin(); + for (string::const_iterator it = arg.begin(); it != arg.end(); ++it) { switch (*it) @@ -47,7 +50,7 @@ munge_inner_argument(std::string arg) else { // escape inner quotes - for (std::string::const_iterator it = arg.begin(); + for (string::const_iterator it = arg.begin(); it != arg.end(); ++it) { if (*it == '"' && it != arg.begin() && it != arg.end() - 1) @@ -63,8 +66,8 @@ munge_inner_argument(std::string arg) return result; } -static std::string -munge_argument(std::string arg) +static string +munge_argument(string arg) { // handle DOS-style '/file:c:\path to\file.txt' by splitting at the colon // and handling the last part as a standard argument, then reassembling @@ -73,12 +76,12 @@ munge_argument(std::string arg) return "\"\""; else if (arg[0] == '/') { - std::string result; - std::string::size_type dos_cmd = arg.find(':'); - if (dos_cmd != std::string::size_type) + string result; + string::size_type dos_cmd = arg.find(':'); + if (dos_cmd != string::size_type) { result += arg.substr(0, dos_cmd + 1); - result += munge_inner_argument(std::string(dos_cmd + 1)); + result += munge_inner_argument(string(dos_cmd + 1)); } else result += arg; @@ -88,14 +91,14 @@ munge_argument(std::string arg) return munge_inner_argument(arg); } -std::string +string munge_argv_into_cmdline(char const * const argv[]) { - std::string cmdline; + string cmdline; for (int i = 0; argv[i]; ++i) { - cmdline += munge_argument(std::string(argv[i])); + cmdline += munge_argument(string(argv[i])); cmdline += " "; } @@ -125,7 +128,7 @@ process_spawn(char const * const argv[]) pid_t process_spawn(char const * const argv[]) { - std::vector realexe; + vector realexe; realexe.resize(strlen(argv[0]) + 1 + MAXPATH); L(FL("searching for exe: %s\n") % realexe); @@ -138,7 +141,7 @@ process_spawn(char const * const argv[]) return -1; } - std::string cmd = munge_argv_into_cmdline(argv); + string cmd = munge_argv_into_cmdline(argv); L(FL("spawning command: '%s' '%s'\n") % &*realexe.begin() % cmd); STARTUPINFO si; ============================================================ --- win32/read_password.cc 2367156ff1a6fe6ec68b0281f835578391ba25e2 +++ win32/read_password.cc cf6800617aeed302e364567daa9aa61da6e047d0 @@ -12,8 +12,12 @@ #include "sanity.hh" +using std::cin; +using std::cout; +using std::string; + void -read_password(std::string const & prompt, char * buf, size_t bufsz) +read_password(string const & prompt, char * buf, size_t bufsz) { HANDLE mt_stdin; DWORD origmode, pwmode = 0; @@ -39,22 +43,22 @@ read_password(std::string const & prompt pwmode = origmode & (~ENABLE_ECHO_INPUT); memset(buf, 0, bufsz); - std::cout << prompt; - std::cout.flush(); + cout << prompt; + cout.flush(); if (mt_stdin != NULL) { I(SetConsoleMode(mt_stdin, pwmode) != 0); - std::cin.getline(buf, bufsz, '\n'); + cin.getline(buf, bufsz, '\n'); I(SetConsoleMode(mt_stdin, origmode) != 0); } else { - std::cout << "\x1B\x37\x1B[30;40m"; - std::cout.flush(); + cout << "\x1B\x37\x1B[30;40m"; + cout.flush(); fgets(buf, bufsz, stdin); /* Sorry, but cin.getline just doesn't work under MinGW's rxvt */ - std::cout << "\x1B[0m\x1B\x38"; - std::cout.flush(); + cout << "\x1B[0m\x1B\x38"; + cout.flush(); /* ...and fgets gives us an LF we don't want */ size_t bufend = strlen(buf) - 1; ============================================================ --- win32/terminal.cc 5f926f20442ec159cb0444079b324927dcf48bdd +++ win32/terminal.cc 374a0405faee0b84777b8192386f954efab1b433 @@ -12,10 +12,12 @@ #include "platform.hh" +using std::string; + bool have_smart_terminal() { - std::string term; + string term; if (char const * term_cstr = getenv("TERM")) term = term_cstr; else