From f84d2253b2250ed5760398c189bfc8bf8dff1f69 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 4 Nov 2011 22:27:58 +0900 Subject: [PATCH] Rewritten util::split and added its iterator version. Iterator based functions util::startsWith, util::endsWith, util::streq, util::strieq were added. --- src/AbstractCommand.cc | 19 +- src/Cookie.h | 24 ++ src/CookieStorage.cc | 28 ++- src/FtpConnection.cc | 9 +- src/FtpNegotiationCommand.cc | 4 +- src/HttpHeader.h | 18 ++ src/HttpHeaderProcessor.cc | 11 +- src/HttpRequest.cc | 5 +- src/HttpResponse.cc | 8 +- src/HttpServer.cc | 37 +-- src/Metalink2RequestGroup.cc | 9 +- src/MultiUrlRequestInfo.cc | 4 +- src/Netrc.cc | 45 ++-- src/Netrc.h | 24 ++ src/NsCookieParser.cc | 38 +-- src/ParameterizedStringParser.cc | 4 +- src/ServerStatMan.cc | 8 +- src/SessionSerializer.cc | 3 +- src/Sqlite3CookieParser.cc | 11 +- src/UriListParser.cc | 3 +- src/bittorrent_helper.cc | 10 +- src/cookie_helper.cc | 8 - src/cookie_helper.h | 2 - src/json.cc | 37 +-- src/magnet.cc | 16 +- src/uri.cc | 9 +- src/util.cc | 56 +++-- src/util.h | 188 +++++++++++++-- test/UtilTest.cc | 397 +++++++++++++++++++++++++++++-- 29 files changed, 841 insertions(+), 194 deletions(-) diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc index d31d610c..9dd0ac39 100644 --- a/src/AbstractCommand.cc +++ b/src/AbstractCommand.cc @@ -589,16 +589,19 @@ namespace { bool inNoProxy(const SharedHandle& req, const std::string& noProxy) { - std::vector entries; - util::split(noProxy, std::back_inserter(entries), ",", true); + std::vector entries; + util::splitIter(noProxy.begin(), noProxy.end(), std::back_inserter(entries), + ',', true); if(entries.empty()) { return false; } - for(std::vector::const_iterator i = entries.begin(), + for(std::vector::const_iterator i = entries.begin(), eoi = entries.end(); i != eoi; ++i) { - std::string::size_type slashpos = (*i).find('/'); - if(slashpos == std::string::npos) { - if(util::noProxyDomainMatch(req->getHost(), *i)) { + std::string::const_iterator slashpos = + std::find((*i).first, (*i).second, '/'); + if(slashpos == (*i).second) { + if(util::noProxyDomainMatch + (req->getHost(), std::string((*i).first, (*i).second))) { return true; } } else { @@ -606,9 +609,9 @@ bool inNoProxy(const SharedHandle& req, // implementation is that we should first resolve // hostname(which may result in several IP addresses) and // evaluates against all of them - std::string ip = (*i).substr(0, slashpos); + std::string ip((*i).first, slashpos); uint32_t bits; - if(!util::parseUIntNoThrow(bits, (*i).begin()+slashpos+1, (*i).end())) { + if(!util::parseUIntNoThrow(bits, slashpos+1, (*i).second)) { continue; } if(util::inSameCidrBlock(ip, req->getHost(), bits)) { diff --git a/src/Cookie.h b/src/Cookie.h index 5462891d..e571225d 100644 --- a/src/Cookie.h +++ b/src/Cookie.h @@ -97,6 +97,12 @@ public: void setName(const std::string& name); + template + void setName(InputIterator first, InputIterator last) + { + name_.assign(first, last); + } + const std::string& getValue() const { return value_; @@ -104,6 +110,12 @@ public: void setValue(const std::string& value); + template + void setValue(InputIterator first, InputIterator last) + { + value_.assign(first, last); + } + time_t getExpiryTime() const { return expiryTime_; @@ -131,6 +143,12 @@ public: void setDomain(const std::string& domain); + template + void setDomain(InputIterator first, InputIterator last) + { + domain_.assign(first, last); + } + bool getHostOnly() const { return hostOnly_; @@ -148,6 +166,12 @@ public: void setPath(const std::string& path); + template + void setPath(InputIterator first, InputIterator last) + { + path_.assign(first, last); + } + bool getSecure() const { return secure_; diff --git a/src/CookieStorage.cc b/src/CookieStorage.cc index ed8e24da..a09e70f9 100644 --- a/src/CookieStorage.cc +++ b/src/CookieStorage.cc @@ -210,11 +210,19 @@ bool CookieStorage::parseAndStore struct CookiePathDivider { Cookie cookie_; int pathDepth_; - CookiePathDivider(const Cookie& cookie):cookie_(cookie) + CookiePathDivider(const Cookie& cookie):cookie_(cookie), pathDepth_(0) { - std::vector paths; - util::split(cookie_.getPath(), std::back_inserter(paths), A2STR::SLASH_C); - pathDepth_ = paths.size(); + const std::string& path = cookie_.getPath(); + if(!path.empty()) { + for(size_t i = 1, len = path.size(); i < len; ++i) { + if(path[i] == '/' && path[i-1] != '/') { + ++pathDepth_; + } + } + if(path[path.size()-1] != '/') { + ++pathDepth_; + } + } } }; @@ -302,14 +310,14 @@ std::vector CookieStorage::criteriaFind (requestHost, domains_.begin(), domains_.end(), std::back_inserter(res), requestHost, requestPath, now, secure); } else { - std::vector levels; - util::split(requestHost, std::back_inserter(levels),A2STR::DOT_C); - std::reverse(levels.begin(), levels.end()); + std::vector levels; + util::splitIter(requestHost.begin(), requestHost.end(), + std::back_inserter(levels), '.'); std::string domain; - for(std::vector::const_iterator i = - levels.begin(), eoi = levels.end(); + for(std::vector::const_reverse_iterator i = + levels.rbegin(), eoi = levels.rend(); i != eoi; ++i, domain.insert(domain.begin(), '.')) { - domain.insert(domain.begin(), (*i).begin(), (*i).end()); + domain.insert(domain.begin(), (*i).first, (*i).second); searchCookieByDomainSuffix (domain, domains_.begin(), domains_.end(), std::back_inserter(res), requestHost, requestPath, now, secure); diff --git a/src/FtpConnection.cc b/src/FtpConnection.cc index 9a2bbaa7..dcc38e39 100644 --- a/src/FtpConnection.cc +++ b/src/FtpConnection.cc @@ -487,12 +487,13 @@ unsigned int FtpConnection::receiveEpsvResponse(uint16_t& port) leftParen > rightParen) { return response.first; } - std::vector rd; - util::split(response.second.substr(leftParen+1, rightParen-(leftParen+1)), - std::back_inserter(rd), "|", true, true); + std::vector rd; + util::splitIter(response.second.begin()+leftParen+1, + response.second.begin()+rightParen, + std::back_inserter(rd), '|', true, true); uint32_t portTemp = 0; if(rd.size() == 5 && - util::parseUIntNoThrow(portTemp, rd[3].begin(), rd[3].end())) { + util::parseUIntNoThrow(portTemp, rd[3].first, rd[3].second)) { if(0 < portTemp && portTemp <= UINT16_MAX) { port = portTemp; } diff --git a/src/FtpNegotiationCommand.cc b/src/FtpNegotiationCommand.cc index 3a527477..4d2bc719 100644 --- a/src/FtpNegotiationCommand.cc +++ b/src/FtpNegotiationCommand.cc @@ -270,9 +270,9 @@ bool FtpNegotiationCommand::sendCwdPrep() { // Calling setReadCheckSocket() is needed when the socket is reused, setReadCheckSocket(getSocket()); - util::split(getRequest()->getDir(), std::back_inserter(cwdDirs_), - A2STR::SLASH_C); cwdDirs_.push_front(ftp_->getBaseWorkingDir()); + util::split(getRequest()->getDir().begin(), getRequest()->getDir().end(), + std::back_inserter(cwdDirs_), '/'); sequence_ = SEQ_SEND_CWD; return true; } diff --git a/src/HttpHeader.h b/src/HttpHeader.h index a9be6660..776fcdbd 100644 --- a/src/HttpHeader.h +++ b/src/HttpHeader.h @@ -95,6 +95,12 @@ public: void setVersion(const std::string& version); + template + void setVersion(InputIterator first, InputIterator last) + { + version_.assign(first, last); + } + const std::string& getMethod() const { return method_; @@ -102,6 +108,12 @@ public: void setMethod(const std::string& method); + template + void setMethod(InputIterator first, InputIterator last) + { + method_.assign(first, last); + } + const std::string& getRequestPath() const { return requestPath_; @@ -109,6 +121,12 @@ public: void setRequestPath(const std::string& requestPath); + template + void setRequestPath(InputIterator first, InputIterator last) + { + requestPath_.assign(first, last); + } + void fill (std::string::const_iterator first, std::string::const_iterator last); diff --git a/src/HttpHeaderProcessor.cc b/src/HttpHeaderProcessor.cc index 6cfce918..d196f6be 100644 --- a/src/HttpHeaderProcessor.cc +++ b/src/HttpHeaderProcessor.cc @@ -139,16 +139,17 @@ SharedHandle HttpHeaderProcessor::getHttpRequestHeader() delimpos < 14) { throw DL_RETRY_EX(EX_NO_STATUS_HEADER); } - std::vector firstLine; - util::split(buf_.substr(0, delimpos), std::back_inserter(firstLine)," ",true); + std::vector firstLine; + util::splitIter(buf_.begin(), buf_.begin()+delimpos, + std::back_inserter(firstLine), ' ', true); if(firstLine.size() != 3) { throw DL_ABORT_EX2("Malformed HTTP request header.", error_code::HTTP_PROTOCOL_ERROR); } SharedHandle httpHeader(new HttpHeader()); - httpHeader->setMethod(firstLine[0]); - httpHeader->setRequestPath(firstLine[1]); - httpHeader->setVersion(firstLine[2]); + httpHeader->setMethod(firstLine[0].first, firstLine[0].second); + httpHeader->setRequestPath(firstLine[1].first, firstLine[1].second); + httpHeader->setVersion(firstLine[2].first, firstLine[2].second); if((delimpos = buf_.find("\r\n\r\n")) == std::string::npos && (delimpos = buf_.find("\n\n")) == std::string::npos) { delimpos = buf_.size(); diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc index e4079a26..19a0ddfa 100644 --- a/src/HttpRequest.cc +++ b/src/HttpRequest.cc @@ -317,9 +317,8 @@ void HttpRequest::disableContentEncoding() void HttpRequest::addHeader(const std::string& headersString) { - std::vector headers; - util::split(headersString, std::back_inserter(headers), "\n", true); - headers_.insert(headers_.end(), headers.begin(), headers.end()); + util::split(headersString.begin(), headersString.end(), + std::back_inserter(headers_), '\n', true); } void HttpRequest::clearHeader() diff --git a/src/HttpResponse.cc b/src/HttpResponse.cc index 460227b4..9264a008 100644 --- a/src/HttpResponse.cc +++ b/src/HttpResponse.cc @@ -378,8 +378,12 @@ void HttpResponse::getMetalinKHttpEntries if(!result.empty()) { std::vector locs; if(option->defined(PREF_METALINK_LOCATION)) { - util::split(util::toLower(option->get(PREF_METALINK_LOCATION)), - std::back_inserter(locs), ",", true); + const std::string& loc = option->get(PREF_METALINK_LOCATION); + util::split(loc.begin(), loc.end(), std::back_inserter(locs), ',', true); + for(std::vector::iterator i = locs.begin(), eoi = locs.end(); + i != eoi; ++i) { + util::lowercase(*i); + } } for(std::vector::iterator i = result.begin(), eoi = result.end(); i != eoi; ++i) { diff --git a/src/HttpServer.cc b/src/HttpServer.cc index 67116c32..919ea228 100644 --- a/src/HttpServer.cc +++ b/src/HttpServer.cc @@ -49,6 +49,7 @@ #include "fmt.h" #include "SocketRecvBuffer.h" #include "TimeA2.h" +#include "array_fun.h" namespace aria2 { @@ -99,12 +100,20 @@ SharedHandle HttpServer::receiveRequest() (lastRequestHeader_->getVersion() == HttpHeader::HTTP_1_1 || connection.find("keep-alive") != std::string::npos); - std::vector acceptEncodings; - util::split(lastRequestHeader_->getFirst(HttpHeader::ACCEPT_ENCODING), - std::back_inserter(acceptEncodings), A2STR::COMMA_C, true); - acceptsGZip_ = - std::find(acceptEncodings.begin(), acceptEncodings.end(), "gzip") - != acceptEncodings.end(); + std::vector acceptEncodings; + const std::string& acceptEnc = + lastRequestHeader_->getFirst(HttpHeader::ACCEPT_ENCODING); + util::splitIter(acceptEnc.begin(), acceptEnc.end(), + std::back_inserter(acceptEncodings), ',', true); + const char A2_GZIP[] = "gzip"; + acceptsGZip_ = false; + for(std::vector::const_iterator i = acceptEncodings.begin(), + eoi = acceptEncodings.end(); i != eoi; ++i) { + if(util::streq((*i).first, (*i).second, A2_GZIP, vend(A2_GZIP)-1)) { + acceptsGZip_ = true; + break; + } + } return header; } else { socketRecvBuffer_->clearBuffer(); @@ -209,20 +218,18 @@ bool HttpServer::authenticate() } std::pair p; util::divide(p, authHeader.begin(), authHeader.end(), ' '); - const char authMethod[] = "Basic"; - if(!std::distance(p.first.first, p.first.second) == sizeof(authMethod) || - !std::equal(p.first.first, p.first.second, &authMethod[0])) { + const char A2_AUTHMETHOD[] = "Basic"; + if(!util::streq(p.first.first, p.first.second, + A2_AUTHMETHOD, vend(A2_AUTHMETHOD)-1)) { return false; } std::string userpass = Base64::decode(std::string(p.second.first, p.second.second)); util::divide(p, userpass.begin(), userpass.end(), ':'); - return username_.size() == - static_cast(std::distance(p.first.first, p.first.second)) && - std::equal(username_.begin(), username_.end(), p.first.first) && - password_.size() == - static_cast(std::distance(p.second.first, p.second.second)) && - std::equal(password_.begin(), password_.end(), p.second.first); + return util::streq(p.first.first, p.first.second, + username_.begin(), username_.end()) && + util::streq(p.second.first, p.second.second, + password_.begin(), password_.end()); } void HttpServer::setUsernamePassword diff --git a/src/Metalink2RequestGroup.cc b/src/Metalink2RequestGroup.cc index 70c5d049..f56883cc 100644 --- a/src/Metalink2RequestGroup.cc +++ b/src/Metalink2RequestGroup.cc @@ -156,8 +156,13 @@ Metalink2RequestGroup::createRequestGroup } std::vector locations; if(optionTemplate->defined(PREF_METALINK_LOCATION)) { - util::split(util::toLower(optionTemplate->get(PREF_METALINK_LOCATION)), - std::back_inserter(locations), ",", true); + const std::string& loc = optionTemplate->get(PREF_METALINK_LOCATION); + util::split(loc.begin(), loc.end(), + std::back_inserter(locations), ',', true); + for(std::vector::iterator i = locations.begin(), + eoi = locations.end(); i != eoi; ++i) { + util::lowercase(*i); + } } std::string preferredProtocol; if(optionTemplate->get(PREF_METALINK_PREFERRED_PROTOCOL) != V_NONE) { diff --git a/src/MultiUrlRequestInfo.cc b/src/MultiUrlRequestInfo.cc index 4d43ec5d..c00678d5 100644 --- a/src/MultiUrlRequestInfo.cc +++ b/src/MultiUrlRequestInfo.cc @@ -99,9 +99,9 @@ namespace { ares_addr_node* parseAsyncDNSServers(const std::string& serversOpt) { std::vector servers; - util::split(serversOpt, + util::split(serversOpt.begin(), serversOpt.end(), std::back_inserter(servers), - A2STR::COMMA_C, + ',', true /* doStrip */); ares_addr_node root; root.next = 0; diff --git a/src/Netrc.cc b/src/Netrc.cc index 29306a71..d362daed 100644 --- a/src/Netrc.cc +++ b/src/Netrc.cc @@ -43,6 +43,7 @@ #include "A2STR.h" #include "util.h" #include "BufferedFile.h" +#include "array_fun.h" namespace aria2 { @@ -152,44 +153,58 @@ void Netrc::parse(const std::string& path) if(util::startsWith(line, "#")) { continue; } - std::vector tokens; - util::split(line, std::back_inserter(tokens), " \t", true); - for(std::vector::const_iterator iter = tokens.begin(), + std::vector tokens; + const char A2_DELIMS[] = " \t"; + util::splitIterM(line.begin(), line.end(), std::back_inserter(tokens), + A2_DELIMS, vend(A2_DELIMS)-1, true); + const char A2_MACHINE[] = "machine"; + const char A2_DEFAULT[] = "default"; + const char A2_LOGIN[] = "login"; + const char A2_PASSWORD[] = "password"; + const char A2_ACCOUNT[] = "account"; + const char A2_MACDEF[] = "macdef"; + for(std::vector::const_iterator iter = tokens.begin(), eoi = tokens.end(); iter != eoi; ++iter) { - const std::string& token = *iter; if(state == GET_TOKEN) { - if(token == "machine") { + if(util::streq((*iter).first, (*iter).second, + A2_MACHINE, vend(A2_MACHINE)-1)) { storeAuthenticator(authenticator); authenticator.reset(new Authenticator()); state = SET_MACHINE; - } else if(token == "default") { + } else if(util::streq((*iter).first, (*iter).second, + A2_DEFAULT, vend(A2_DEFAULT)-1)) { storeAuthenticator(authenticator); authenticator.reset(new DefaultAuthenticator()); } else { if(!authenticator) { throw DL_ABORT_EX (fmt("Netrc:parse error. %s encounterd where 'machine'" - " or 'default' expected.", token.c_str())); + " or 'default' expected.", + std::string((*iter).first, (*iter).second).c_str())); } - if(token == "login") { + if(util::streq((*iter).first, (*iter).second, + A2_LOGIN, vend(A2_LOGIN)-1)) { state = SET_LOGIN; - } else if(token == "password") { + } else if(util::streq((*iter).first, (*iter).second, + A2_PASSWORD, vend(A2_PASSWORD)-1)) { state = SET_PASSWORD; - } else if(token == "account") { + } else if(util::streq((*iter).first, (*iter).second, + A2_ACCOUNT, vend(A2_ACCOUNT)-1)) { state = SET_ACCOUNT; - } else if(token == "macdef") { + } else if(util::streq((*iter).first, (*iter).second, + A2_MACDEF, vend(A2_MACDEF)-1)) { state = SET_MACDEF; } } } else { if(state == SET_MACHINE) { - authenticator->setMachine(token); + authenticator->setMachine((*iter).first, (*iter).second); } else if(state == SET_LOGIN) { - authenticator->setLogin(token); + authenticator->setLogin((*iter).first, (*iter).second); } else if(state == SET_PASSWORD) { - authenticator->setPassword(token); + authenticator->setPassword((*iter).first, (*iter).second); } else if(state == SET_ACCOUNT) { - authenticator->setAccount(token); + authenticator->setAccount((*iter).first, (*iter).second); } else if(state == SET_MACDEF) { skipMacdef(fp); } diff --git a/src/Netrc.h b/src/Netrc.h index 720822fd..f97a4b8b 100644 --- a/src/Netrc.h +++ b/src/Netrc.h @@ -76,6 +76,12 @@ public: void setMachine(const std::string& machine); + template + void setMachine(InputIterator first, InputIterator last) + { + machine_.assign(first, last); + } + const std::string& getLogin() const { return login_; @@ -83,6 +89,12 @@ public: void setLogin(const std::string& login); + template + void setLogin(InputIterator first, InputIterator last) + { + login_.assign(first, last); + } + const std::string& getPassword() const { return password_; @@ -90,12 +102,24 @@ public: void setPassword(const std::string& password); + template + void setPassword(InputIterator first, InputIterator last) + { + password_.assign(first, last); + } + const std::string& getAccount() const { return account_; } void setAccount(const std::string& account); + + template + void setAccount(InputIterator first, InputIterator last) + { + account_.assign(first, last); + } }; class DefaultAuthenticator : public Authenticator { diff --git a/src/NsCookieParser.cc b/src/NsCookieParser.cc index ef8620c5..8e942c58 100644 --- a/src/NsCookieParser.cc +++ b/src/NsCookieParser.cc @@ -45,6 +45,7 @@ #include "Cookie.h" #include "cookie_helper.h" #include "BufferedFile.h" +#include "array_fun.h" namespace aria2 { @@ -52,26 +53,23 @@ NsCookieParser::NsCookieParser() {} NsCookieParser::~NsCookieParser() {} -namespace { -const std::string C_TRUE("TRUE"); -} // namespace - namespace { bool parseNsCookie (Cookie& cookie, const std::string& nsCookieStr, time_t creationTime) { - std::vector vs; - util::split(nsCookieStr, std::back_inserter(vs), "\t", true); + std::vector vs; + util::splitIter(nsCookieStr.begin(), nsCookieStr.end(), + std::back_inserter(vs), '\t', true); if(vs.size() < 6) { return false; } - std::string cookieDomain = cookie::removePrecedingDots(vs[0]); - if(vs[5].empty() || cookieDomain.empty() || - !cookie::goodPath(vs[2].begin(), vs[2].end())) { + vs[0].first = util::lstripIter(vs[0].first, vs[0].second, '.'); + if(vs[5].first == vs[5].second || vs[0].first == vs[0].second || + !cookie::goodPath(vs[2].first, vs[2].second)) { return false; } int64_t expiryTime; - if(!util::parseLLIntNoThrow(expiryTime, vs[4].begin(), vs[4].end())) { + if(!util::parseLLIntNoThrow(expiryTime, vs[4].first, vs[4].second)) { return false; } if(std::numeric_limits::max() < expiryTime) { @@ -79,16 +77,24 @@ bool parseNsCookie } else if(std::numeric_limits::min() > expiryTime) { expiryTime = std::numeric_limits::min(); } - cookie.setName(vs[5]); - cookie.setValue(vs.size() >= 7? vs[6]:A2STR::NIL); + cookie.setName(vs[5].first, vs[5].second); + if(vs.size() >= 7) { + cookie.setValue(vs[6].first, vs[6].second); + } else { + cookie.setValue(A2STR::NIL.begin(), A2STR::NIL.end()); + } cookie.setExpiryTime(expiryTime == 0? std::numeric_limits::max():expiryTime); // aria2 treats expiryTime == 0 means session cookie. cookie.setPersistent(expiryTime != 0); - cookie.setDomain(cookieDomain); - cookie.setHostOnly(util::isNumericHost(cookieDomain) || vs[1] != C_TRUE); - cookie.setPath(vs[2]); - cookie.setSecure(vs[3] == C_TRUE); + cookie.setDomain(vs[0].first, vs[0].second); + const char C_TRUE[] = "TRUE"; + cookie.setHostOnly(util::isNumericHost(cookie.getDomain()) || + !util::streq(vs[1].first, vs[1].second, + C_TRUE, vend(C_TRUE)-1)); + cookie.setPath(vs[2].first, vs[2].second); + cookie.setSecure(util::streq(vs[3].first, vs[3].second, + C_TRUE, vend(C_TRUE)-1)); cookie.setCreationTime(creationTime); return true; } diff --git a/src/ParameterizedStringParser.cc b/src/ParameterizedStringParser.cc index 72e31566..2b80d41b 100644 --- a/src/ParameterizedStringParser.cc +++ b/src/ParameterizedStringParser.cc @@ -92,8 +92,8 @@ ParameterizedStringParser::createSelect(const std::string& src, int& offset) throw DL_ABORT_EX("Missing '}' in the parameterized string."); } std::vector values; - util::split(src.substr(offset, rightParenIndex-offset), - std::back_inserter(values), ",", true); + util::split(src.begin()+offset, src.begin()+rightParenIndex, + std::back_inserter(values), ',', true); if(values.empty()) { throw DL_ABORT_EX("Empty {} is not allowed."); } diff --git a/src/ServerStatMan.cc b/src/ServerStatMan.cc index cacb2f7e..2c4b9f76 100644 --- a/src/ServerStatMan.cc +++ b/src/ServerStatMan.cc @@ -155,13 +155,13 @@ bool ServerStatMan::load(const std::string& filename) continue; } std::string line(p.first, p.second); - std::vector items; - util::split(line, std::back_inserter(items), ","); + std::vector items; + util::splitIter(line.begin(), line.end(), std::back_inserter(items), ','); std::map m; - for(std::vector::const_iterator i = items.begin(), + for(std::vector::const_iterator i = items.begin(), eoi = items.end(); i != eoi; ++i) { std::pair p; - util::divide(p, (*i).begin(), (*i).end(), '='); + util::divide(p, (*i).first, (*i).second, '='); m[std::string(p.first.first, p.first.second)] = std::string(p.second.first, p.second.second); } diff --git a/src/SessionSerializer.cc b/src/SessionSerializer.cc index 3634a250..59a955b8 100644 --- a/src/SessionSerializer.cc +++ b/src/SessionSerializer.cc @@ -85,8 +85,9 @@ bool writeOption(BufferedFile& fp, const SharedHandle