diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-09-27 23:51:34 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-09-27 23:51:34 +0200 |
commit | a7a285eb61dd83afc892bc1d64ffe14b9f1426a3 (patch) | |
tree | 08d2efcaec46e5f5702d9e336a0e8ba7e636aff9 /src/Client | |
parent | b40ba0cf91603b695f1f2380cbd39966a458f22f (diff) | |
download | mad-a7a285eb61dd83afc892bc1d64ffe14b9f1426a3.tar mad-a7a285eb61dd83afc892bc1d64ffe14b9f1426a3.zip |
Completely migrate to Unicode String class
Diffstat (limited to 'src/Client')
-rw-r--r-- | src/Client/Authenticators/ChallengeResponseAuthenticator.cpp | 4 | ||||
-rw-r--r-- | src/Client/Authenticators/PasswordAuthenticator.cpp | 6 | ||||
-rw-r--r-- | src/Client/InformationManager.cpp | 2 | ||||
-rw-r--r-- | src/Client/PasswordReader.cpp | 19 | ||||
-rw-r--r-- | src/Client/SystemCommands.cpp | 8 | ||||
-rw-r--r-- | src/Client/UserCommands.cpp | 108 | ||||
-rw-r--r-- | src/Client/UserListCommands.cpp | 2 | ||||
-rw-r--r-- | src/Client/XLSReader.cpp | 4 | ||||
-rw-r--r-- | src/Client/XLSSheet.cpp | 2 |
9 files changed, 75 insertions, 80 deletions
diff --git a/src/Client/Authenticators/ChallengeResponseAuthenticator.cpp b/src/Client/Authenticators/ChallengeResponseAuthenticator.cpp index 7ccaa63..92ced08 100644 --- a/src/Client/Authenticators/ChallengeResponseAuthenticator.cpp +++ b/src/Client/Authenticators/ChallengeResponseAuthenticator.cpp @@ -40,7 +40,7 @@ void ChallengeResponseAuthenticator::ChallengeResponseAuthRequest::sendRequest() void ChallengeResponseAuthenticator::ChallengeResponseAuthRequest::handlePacket(boost::shared_ptr<const Common::XmlData> packet) { if(packet->getType() == "Error") { - signalFinished(Core::Exception(packet->get<const Core::String&>("Where").extract(), static_cast<Core::Exception::ErrorCode>(packet->get<long>("ErrorCode")), + signalFinished(Core::Exception(packet->get<const Core::String&>("Where"), static_cast<Core::Exception::ErrorCode>(packet->get<long>("ErrorCode")), packet->get<long>("SubCode"), packet->get<long>("SubSubCode"))); return; } @@ -115,7 +115,7 @@ void ChallengeResponseAuthenticator::authenticate(Common::Application *applicati throw Core::Exception(Core::Exception::NOT_AVAILABLE); } - application->logf(Core::Logger::LOG_VERBOSE, "Authenticating with method 'Challenge-Response' using hash '%s'...", hash.extract().c_str()); + application->logf(Core::Logger::LOG_VERBOSE, "Authenticating with method 'Challenge-Response' using hash '%s'...", hash.toLocale().c_str()); boost::shared_ptr<ChallengeResponseAuthRequest> request(new ChallengeResponseAuthRequest(application, username, password, hash)); diff --git a/src/Client/Authenticators/PasswordAuthenticator.cpp b/src/Client/Authenticators/PasswordAuthenticator.cpp index 2ac9d68..ac01d44 100644 --- a/src/Client/Authenticators/PasswordAuthenticator.cpp +++ b/src/Client/Authenticators/PasswordAuthenticator.cpp @@ -38,7 +38,7 @@ void PasswordAuthenticator::PasswordAuthRequest::sendRequest() { if(hash == "Clear") { - std::string passwordStr = password.extractUTF8(); + std::string passwordStr = password.toUTF8(); packet.set("data", std::vector<boost::uint8_t>(passwordStr.begin(), passwordStr.end())); } else { @@ -50,7 +50,7 @@ void PasswordAuthenticator::PasswordAuthRequest::sendRequest() { void PasswordAuthenticator::PasswordAuthRequest::handlePacket(boost::shared_ptr<const Common::XmlData> packet) { if(packet->getType() == "Error") { - signalFinished(Core::Exception(packet->get<const Core::String&>("Where").extract(), static_cast<Core::Exception::ErrorCode>(packet->get<long>("ErrorCode")), + signalFinished(Core::Exception(packet->get<const Core::String&>("Where"), static_cast<Core::Exception::ErrorCode>(packet->get<long>("ErrorCode")), packet->get<long>("SubCode"), packet->get<long>("SubSubCode"))); return; } @@ -98,7 +98,7 @@ void PasswordAuthenticator::authenticate(Common::Application *application, Commo throw Core::Exception(Core::Exception::NOT_AVAILABLE); } - application->logf(Core::Logger::LOG_VERBOSE, "Authenticating with method 'Password' using hash '%s'...", hash.extract().c_str()); + application->logf(Core::Logger::LOG_VERBOSE, "Authenticating with method 'Password' using hash '%s'...", hash.toLocale().c_str()); boost::shared_ptr<PasswordAuthRequest> request(new PasswordAuthRequest(application, username, password, hash)); diff --git a/src/Client/InformationManager.cpp b/src/Client/InformationManager.cpp index e66f43d..8872834 100644 --- a/src/Client/InformationManager.cpp +++ b/src/Client/InformationManager.cpp @@ -84,7 +84,7 @@ void InformationManager::daemonListRequestFinished(boost::shared_ptr<const Commo for(Common::XmlData::List::const_iterator entry = list->begin(); entry != list->end(); ++entry) { Common::HostInfo info; info.setName(entry->get<const Core::String&>("name")); - info.setIP(entry->get<const Core::String&>("address").extract()); + info.setIP(entry->get<const Core::String&>("address").toString()); info.setState(static_cast<Common::HostInfo::State>(entry->get<long>("state"))); daemons.insert(std::make_pair(info.getName(), info)); diff --git a/src/Client/PasswordReader.cpp b/src/Client/PasswordReader.cpp index 8d549f5..cb77ad5 100644 --- a/src/Client/PasswordReader.cpp +++ b/src/Client/PasswordReader.cpp @@ -33,20 +33,11 @@ namespace Mad { namespace Client { Core::String PasswordReader::readPassword(const Core::String &prompt) { - std::string password; - #ifdef _WIN32 DWORD mode; HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); GetConsoleMode(handle, &mode); SetConsoleMode(handle, mode & ~(ENABLE_ECHO_INPUT)); - - std::cout << prompt.extract() << std::flush; - std::getline(std::cin, password); - std::cout << std::endl; - - SetConsoleMode(handle, mode); - #else struct termios termold, termnew; @@ -55,15 +46,19 @@ Core::String PasswordReader::readPassword(const Core::String &prompt) { termnew = termold; termnew.c_lflag &= ~ECHO; tcsetattr(STDIN_FILENO, TCSAFLUSH, &termnew); +#endif - std::cout << prompt.extract() << std::flush; - std::getline(std::cin, password); + std::cout << prompt << std::flush; + Core::String password = Core::String::getline(std::cin); std::cout << std::endl; +#ifdef _WIN32 + SetConsoleMode(handle, mode); +#else tcsetattr(STDIN_FILENO, TCSAFLUSH, &termold); #endif - return password.c_str(); + return password; } } diff --git a/src/Client/SystemCommands.cpp b/src/Client/SystemCommands.cpp index d33441f..2151071 100644 --- a/src/Client/SystemCommands.cpp +++ b/src/Client/SystemCommands.cpp @@ -80,8 +80,8 @@ void SystemCommands::printFSInfo(boost::shared_ptr<const Common::XmlData> &packe float percent = 100*used/(used+available); if(percent > 100) percent = 100; - std::printf("\t%s%.*f%s", nameString.extract().c_str(), (used < 10) ? 2 : 1, used, (usedUnit == totalUnit) ? "" : Core::String(" " + units[usedUnit]).extract().c_str()); - std::printf("/%.*f %s (%.1f%%)\n", (total < 10) ? 2 : 1, total, units[totalUnit].extract().c_str(), percent); + std::printf("\t%s%.*f%s", nameString.toLocale().c_str(), (used < 10) ? 2 : 1, used, (usedUnit == totalUnit) ? "" : Core::String(" " + units[usedUnit]).toLocale().c_str()); + std::printf("/%.*f %s (%.1f%%)\n", (total < 10) ? 2 : 1, total, units[totalUnit].toLocale().c_str(), percent); } } @@ -126,7 +126,7 @@ void SystemCommands::printHostStatus(boost::shared_ptr<const Common::XmlData> &p usedMem /= 1024; } - std::printf("\tMemory usage:\t%.*f/%.*f %s", (usedMem < 10) ? 2 : 1, usedMem, (totalMem < 10) ? 2 : 1, totalMem, units[unit].extract().c_str()); + std::printf("\tMemory usage:\t%.*f/%.*f %s", (usedMem < 10) ? 2 : 1, usedMem, (totalMem < 10) ? 2 : 1, totalMem, units[unit].toLocale().c_str()); std::printf(" (%.1f%%)\n", usedMem*100.0f/totalMem); totalMem = packet->get<unsigned long>("totalSwap"); @@ -142,7 +142,7 @@ void SystemCommands::printHostStatus(boost::shared_ptr<const Common::XmlData> &p usedMem /= 1024; } - std::printf("\tSwap usage:\t%.*f/%.*f %s", (usedMem < 10) ? 2 : 1, usedMem, (totalMem < 10) ? 2 : 1, totalMem, units[unit].extract().c_str()); + std::printf("\tSwap usage:\t%.*f/%.*f %s", (usedMem < 10) ? 2 : 1, usedMem, (totalMem < 10) ? 2 : 1, totalMem, units[unit].toLocale().c_str()); std::printf(" (%.1f%%)\n", usedMem*100.0f/totalMem); } diff --git a/src/Client/UserCommands.cpp b/src/Client/UserCommands.cpp index 5e55534..fe5343c 100644 --- a/src/Client/UserCommands.cpp +++ b/src/Client/UserCommands.cpp @@ -107,7 +107,7 @@ void UserCommands::userInfoCommand(CommandParser *commandParser, const std::vect try { char *endptr; - unsigned long uid = std::strtoul(args[1].extract().c_str(), &endptr, 10); + unsigned long uid = std::strtoul(args[1].toString().c_str(), &endptr, 10); boost::shared_ptr<const Common::UserInfo> userInfo; @@ -160,19 +160,19 @@ void UserCommands::listGroupsCommand(CommandParser *commandParser, const std::ve void UserCommands::groupInfoCommand(CommandParser *commandParser, const std::vector<Core::String> &args) { if(args.size() == 1) { - std::cerr << args[0].extract() << ": No group id given." << std::endl; + std::cerr << args[0] << ": No group id given." << std::endl; commandParser->printUsage("group_info"); return; } if(args.size() > 2) { - std::cerr << args[0].extract() << ": Too many arguments." << std::endl; + std::cerr << args[0] << ": Too many arguments." << std::endl; commandParser->printUsage("group_info"); return; } try { char *endptr; - unsigned long gid = std::strtoul(args[1].extract().c_str(), &endptr, 10); + unsigned long gid = std::strtoul(args[1].toString().c_str(), &endptr, 10); boost::shared_ptr<const Common::GroupInfo> groupInfo; @@ -182,7 +182,7 @@ void UserCommands::groupInfoCommand(CommandParser *commandParser, const std::vec else groupInfo = commandParser->application->getUserManager()->getGroupInfo(gid); - std::cout << " Group name: " << groupInfo->getName().extract() << " (" << groupInfo->getGid() << ")" << std::endl << std::endl; + std::cout << " Group name: " << groupInfo->getName() << " (" << groupInfo->getGid() << ")" << std::endl << std::endl; boost::shared_ptr<const std::set<unsigned long> > users = commandParser->application->getUserManager()->getGroupUserList(groupInfo->getGid()); @@ -191,7 +191,7 @@ void UserCommands::groupInfoCommand(CommandParser *commandParser, const std::vec for(std::set<unsigned long>::const_iterator user = users->begin(); user != users->end(); ++user) - std::cout << " " << getUserName(commandParser, *user, true).extract() << std::endl; + std::cout << " " << getUserName(commandParser, *user, true) << std::endl; std::cout << std::endl; } @@ -203,27 +203,27 @@ void UserCommands::groupInfoCommand(CommandParser *commandParser, const std::vec void UserCommands::addUserCommand(CommandParser *commandParser, const std::vector<Core::String> &args) { if(args.size() < 5) { - std::cerr << args[0].extract() << ": Too few arguments." << std::endl; + std::cerr << args[0] << ": Too few arguments." << std::endl; commandParser->printUsage("add_user"); return; } if(args.size() > 5) { - std::cerr << args[0].extract() << ": Too many arguments." << std::endl; + std::cerr << args[0] << ": Too many arguments." << std::endl; commandParser->printUsage("add_user"); return; } char *endptr; - unsigned long uid = std::strtoul(args[1].extract().c_str(), &endptr, 10); + unsigned long uid = std::strtoul(args[1].toString().c_str(), &endptr, 10); if(args[1].isEmpty() || *endptr != '\0') { - std::cerr << args[0].extract() << ": Unable to parse user id." << std::endl; + std::cerr << args[0] << ": Unable to parse user id." << std::endl; commandParser->printUsage("add_user"); return; } - unsigned long gid = std::strtoul(args[2].extract().c_str(), &endptr, 10); + unsigned long gid = std::strtoul(args[2].toString().c_str(), &endptr, 10); if(args[2].isEmpty() || *endptr != '\0') { - std::cerr << args[0].extract() << ": Unable to parse group id." << std::endl; + std::cerr << args[0] << ": Unable to parse group id." << std::endl; commandParser->printUsage("add_user"); return; } @@ -244,34 +244,34 @@ void UserCommands::addUserCommand(CommandParser *commandParser, const std::vecto void UserCommands::updateUserCommand(CommandParser *commandParser, const std::vector<Core::String> &args) { if(args.size() < 6) { - std::cerr << args[0].extract() << ": Too few arguments." << std::endl; + std::cerr << args[0] << ": Too few arguments." << std::endl; commandParser->printUsage("update_user"); return; } if(args.size() > 6) { - std::cerr << args[0].extract() << ": Too many arguments." << std::endl; + std::cerr << args[0] << ": Too many arguments." << std::endl; commandParser->printUsage("update_user"); return; } char *endptr; - unsigned long origUid = std::strtoul(args[1].extract().c_str(), &endptr, 10); + unsigned long origUid = std::strtoul(args[1].toString().c_str(), &endptr, 10); if(args[1].isEmpty() || *endptr != '\0') { - std::cerr << args[0].extract() << ": Unable to parse the old user id." << std::endl; + std::cerr << args[0] << ": Unable to parse the old user id." << std::endl; commandParser->printUsage("update_user"); return; } - unsigned long uid = std::strtoul(args[2].extract().c_str(), &endptr, 10); + unsigned long uid = std::strtoul(args[2].toString().c_str(), &endptr, 10); if(args[2].isEmpty() || *endptr != '\0') { - std::cerr << args[0].extract() << ": Unable to parse the new user id." << std::endl; + std::cerr << args[0] << ": Unable to parse the new user id." << std::endl; commandParser->printUsage("update_user"); return; } - unsigned long gid = std::strtoul(args[3].extract().c_str(), &endptr, 10); + unsigned long gid = std::strtoul(args[3].toString().c_str(), &endptr, 10); if(args[3].isEmpty() || *endptr != '\0') { - std::cerr << args[0].extract() << ": Unable to parse group id." << std::endl; + std::cerr << args[0] << ": Unable to parse group id." << std::endl; commandParser->printUsage("update_user"); return; } @@ -292,20 +292,20 @@ void UserCommands::updateUserCommand(CommandParser *commandParser, const std::ve void UserCommands::deleteUserCommand(CommandParser *commandParser, const std::vector<Core::String> &args) { if(args.size() < 2) { - std::cerr << args[0].extract() << ": No user id given." << std::endl; + std::cerr << args[0] << ": No user id given." << std::endl; commandParser->printUsage("delete_user"); return; } if(args.size() > 2) { - std::cerr << args[0].extract() << ": Too many arguments." << std::endl; + std::cerr << args[0] << ": Too many arguments." << std::endl; commandParser->printUsage("delete_user"); return; } char *endptr; - unsigned long uid = std::strtoul(args[1].extract().c_str(), &endptr, 10); + unsigned long uid = std::strtoul(args[1].toString().c_str(), &endptr, 10); if(args[1].isEmpty() || *endptr != '\0') { - std::cerr << args[0].extract() << ": Unable to parse user id." << std::endl; + std::cerr << args[0] << ": Unable to parse user id." << std::endl; commandParser->printUsage("delete_user"); return; } @@ -322,20 +322,20 @@ void UserCommands::deleteUserCommand(CommandParser *commandParser, const std::ve void UserCommands::addGroupCommand(CommandParser *commandParser, const std::vector<Core::String> &args) { if(args.size() < 3) { - std::cerr << args[0].extract() << ": Too few arguments." << std::endl; + std::cerr << args[0] << ": Too few arguments." << std::endl; commandParser->printUsage("add_group"); return; } if(args.size() > 3) { - std::cerr << args[0].extract() << ": Too many arguments." << std::endl; + std::cerr << args[0] << ": Too many arguments." << std::endl; commandParser->printUsage("add_group"); return; } char *endptr; - unsigned long gid = std::strtoul(args[1].extract().c_str(), &endptr, 10); + unsigned long gid = std::strtoul(args[1].toString().c_str(), &endptr, 10); if(args[2].isEmpty() || *endptr != '\0') { - std::cerr << args[0].extract() << ": Unable to parse group id." << std::endl; + std::cerr << args[0] << ": Unable to parse group id." << std::endl; commandParser->printUsage("add_group"); return; } @@ -352,27 +352,27 @@ void UserCommands::addGroupCommand(CommandParser *commandParser, const std::vect void UserCommands::updateGroupCommand(CommandParser *commandParser, const std::vector<Core::String> &args) { if(args.size() < 4) { - std::cerr << args[0].extract() << ": Too few arguments." << std::endl; + std::cerr << args[0] << ": Too few arguments." << std::endl; commandParser->printUsage("update_group"); return; } if(args.size() > 4) { - std::cerr << args[0].extract() << ": Too many arguments." << std::endl; + std::cerr << args[0] << ": Too many arguments." << std::endl; commandParser->printUsage("update_group"); return; } char *endptr; - unsigned long origGid = std::strtoul(args[1].extract().c_str(), &endptr, 10); + unsigned long origGid = std::strtoul(args[1].toString().c_str(), &endptr, 10); if(args[1].isEmpty() || *endptr != '\0') { - std::cerr << args[0].extract() << ": Unable to parse the old group id." << std::endl; + std::cerr << args[0] << ": Unable to parse the old group id." << std::endl; commandParser->printUsage("update_group"); return; } - unsigned long gid = std::strtoul(args[2].extract().c_str(), &endptr, 10); + unsigned long gid = std::strtoul(args[2].toString().c_str(), &endptr, 10); if(args[2].isEmpty() || *endptr != '\0') { - std::cerr << args[0].extract() << ": Unable to parse the new group id." << std::endl; + std::cerr << args[0] << ": Unable to parse the new group id." << std::endl; commandParser->printUsage("update_group"); return; } @@ -389,20 +389,20 @@ void UserCommands::updateGroupCommand(CommandParser *commandParser, const std::v void UserCommands::deleteGroupCommand(CommandParser *commandParser, const std::vector<Core::String> &args) { if(args.size() < 2) { - std::cerr << args[0].extract() << ": No group id given." << std::endl; + std::cerr << args[0] << ": No group id given." << std::endl; commandParser->printUsage("delete_group"); return; } if(args.size() > 2) { - std::cerr << args[0].extract() << ": Too many arguments." << std::endl; + std::cerr << args[0] << ": Too many arguments." << std::endl; commandParser->printUsage("delete_group"); return; } char *endptr; - unsigned long gid = std::strtoul(args[1].extract().c_str(), &endptr, 10); + unsigned long gid = std::strtoul(args[1].toString().c_str(), &endptr, 10); if(args[1].isEmpty() || *endptr != '\0') { - std::cerr << args[0].extract() << ": Unable to parse group id." << std::endl; + std::cerr << args[0] << ": Unable to parse group id." << std::endl; commandParser->printUsage("delete_group"); return; } @@ -419,27 +419,27 @@ void UserCommands::deleteGroupCommand(CommandParser *commandParser, const std::v void UserCommands::addUserToGroupCommand(CommandParser *commandParser, const std::vector<Core::String> &args) { if(args.size() < 3) { - std::cerr << args[0].extract() << ": Too few arguments." << std::endl; + std::cerr << args[0] << ": Too few arguments." << std::endl; commandParser->printUsage("add_user_to_group"); return; } if(args.size() > 3) { - std::cerr << args[0].extract() << ": Too many arguments." << std::endl; + std::cerr << args[0] << ": Too many arguments." << std::endl; commandParser->printUsage("add_user_to_group"); return; } char *endptr; - unsigned long uid = std::strtoul(args[1].extract().c_str(), &endptr, 10); + unsigned long uid = std::strtoul(args[1].toString().c_str(), &endptr, 10); if(args[1].isEmpty() || *endptr != '\0') { - std::cerr << args[0].extract() << ": Unable to parse user id." << std::endl; + std::cerr << args[0] << ": Unable to parse user id." << std::endl; commandParser->printUsage("add_user_to_group"); return; } - unsigned long gid = std::strtoul(args[2].extract().c_str(), &endptr, 10); + unsigned long gid = std::strtoul(args[2].toString().c_str(), &endptr, 10); if(args[2].isEmpty() || *endptr != '\0') { - std::cerr << args[0].extract() << ": Unable to parse group id." << std::endl; + std::cerr << args[0] << ": Unable to parse group id." << std::endl; commandParser->printUsage("add_user_to_group"); return; } @@ -456,27 +456,27 @@ void UserCommands::addUserToGroupCommand(CommandParser *commandParser, const std void UserCommands::deleteUserFromGroupCommand(CommandParser *commandParser, const std::vector<Core::String> &args) { if(args.size() < 3) { - std::cerr << args[0].extract() << ": Too few arguments." << std::endl; + std::cerr << args[0] << ": Too few arguments." << std::endl; commandParser->printUsage("delete_user_from_group"); return; } if(args.size() > 3) { - std::cerr << args[0].extract() << ": Too many arguments." << std::endl; + std::cerr << args[0] << ": Too many arguments." << std::endl; commandParser->printUsage("delete_user_from_group"); return; } char *endptr; - unsigned long uid = std::strtoul(args[1].extract().c_str(), &endptr, 10); + unsigned long uid = std::strtoul(args[1].toString().c_str(), &endptr, 10); if(args[1].isEmpty() || *endptr != '\0') { - std::cerr << args[0].extract() << ": Unable to parse user id." << std::endl; + std::cerr << args[0] << ": Unable to parse user id." << std::endl; commandParser->printUsage("delete_user_from_group"); return; } - unsigned long gid = std::strtoul(args[2].extract().c_str(), &endptr, 10); + unsigned long gid = std::strtoul(args[2].toString().c_str(), &endptr, 10); if(args[2].isEmpty() || *endptr != '\0') { - std::cerr << args[0].extract() << ": Unable to parse group id." << std::endl; + std::cerr << args[0] << ": Unable to parse group id." << std::endl; commandParser->printUsage("delete_user_from_group"); return; } @@ -493,20 +493,20 @@ void UserCommands::deleteUserFromGroupCommand(CommandParser *commandParser, cons void UserCommands::setPasswordCommand(CommandParser *commandParser, const std::vector<Core::String> &args) { if(args.size() < 2) { - std::cerr << args[0].extract() << ": Too few arguments." << std::endl; + std::cerr << args[0] << ": Too few arguments." << std::endl; commandParser->printUsage("set_password"); return; } if(args.size() > 2) { - std::cerr << args[0].extract() << ": Too many arguments." << std::endl; + std::cerr << args[0] << ": Too many arguments." << std::endl; commandParser->printUsage("set_password"); return; } char *endptr; - unsigned long uid = std::strtoul(args[1].extract().c_str(), &endptr, 10); + unsigned long uid = std::strtoul(args[1].toString().c_str(), &endptr, 10); if(args[1].isEmpty() || *endptr != '\0') { - std::cerr << args[0].extract() << ": Unable to parse user id." << std::endl; + std::cerr << args[0] << ": Unable to parse user id." << std::endl; commandParser->printUsage("set_password"); return; } diff --git a/src/Client/UserListCommands.cpp b/src/Client/UserListCommands.cpp index 947cbc1..d602579 100644 --- a/src/Client/UserListCommands.cpp +++ b/src/Client/UserListCommands.cpp @@ -196,7 +196,7 @@ void UserListCommands::importCommand(CommandParser* /*commandParser*/, const std } else if(args.size() == 3) { try { - XLSReader reader(args[2].extract()); + XLSReader reader(args[2].toLocale()); const std::list<boost::shared_ptr<XLSSheet> > &sheets = reader.getSheets(); if(sheets.empty()) { diff --git a/src/Client/XLSReader.cpp b/src/Client/XLSReader.cpp index 27ff2f5..68065b6 100644 --- a/src/Client/XLSReader.cpp +++ b/src/Client/XLSReader.cpp @@ -32,7 +32,7 @@ xmlNodePtr XLSReader::findNode(xmlNodePtr parent, const Core::String &name) { return 0; for(xmlNodePtr entry = parent->children; entry != 0; entry = entry->next) { - if(entry->type == XML_ELEMENT_NODE && !xmlStrcmp(entry->name, (xmlChar*)name.extractUTF8().c_str())) { + if(entry->type == XML_ELEMENT_NODE && !xmlStrcmp(entry->name, (xmlChar*)name.toUTF8().c_str())) { return entry; } } @@ -49,7 +49,7 @@ XLSReader::XLSReader(const std::string &filename) throw (Core::Exception) { std::string escapedFilename = boost::regex_replace(filename, r, "\\\\'", boost::match_default); - std::FILE *stream = popen((XLHTML_EXEC + " '" + escapedFilename + "' 2>&1").c_str(), "r"); + std::FILE *stream = popen((XLHTML_EXEC + " '" + escapedFilename + "' 2>/dev/null").c_str(), "r"); std::string data; diff --git a/src/Client/XLSSheet.cpp b/src/Client/XLSSheet.cpp index 9c4b5a9..96bf16c 100644 --- a/src/Client/XLSSheet.cpp +++ b/src/Client/XLSSheet.cpp @@ -93,7 +93,7 @@ void XLSSheet::readRows() { XLSSheet::XLSSheet(boost::shared_ptr<xmlDoc> doc0, xmlNodePtr node0) : doc(doc0), node(node0), firstRowColNames(false) { title = getSheetLevelField("pagetitle"); - colCount = std::strtoul(getSheetLevelField("lastcol").extract().c_str(), 0, 10)+1-std::strtoul(getSheetLevelField("firstcol").extract().c_str(), 0, 10); + colCount = std::strtoul(getSheetLevelField("lastcol").toString().c_str(), 0, 10)+1-std::strtoul(getSheetLevelField("firstcol").toString().c_str(), 0, 10); for(unsigned col = 0; col < colCount; ++col) { std::ostringstream stream; |