From: Mikko Rasa Date: Mon, 1 Apr 2013 18:32:19 +0000 (+0300) Subject: Fix 64-bit compilation X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=5e168bbd5b545732e10513aaed59412e934efa5b;p=libs%2Fnet.git Fix 64-bit compilation --- diff --git a/source/http/message.cpp b/source/http/message.cpp index 5d5dd21..21d2c4b 100644 --- a/source/http/message.cpp +++ b/source/http/message.cpp @@ -51,8 +51,8 @@ unsigned Message::parse_content(const string &d) HeaderMap::const_iterator i = headers.find("Content-Length"); if(i!=headers.end()) { - unsigned needed = lexical_cast(i->second)-content.size(); - unsigned len = min(needed, d.size()); + string::size_type needed = lexical_cast(i->second)-content.size(); + string::size_type len = min(needed, d.size()); content.append(d, 0, len); @@ -65,12 +65,12 @@ unsigned Message::parse_content(const string &d) i = headers.find("Transfer-Encoding"); if(i!=headers.end() && strcasecmp(i->second, "chunked")==0) { - unsigned pos = 0; + string::size_type pos = 0; while(!complete && pos(strip(d.substr(pos, lf-pos)), "x"); @@ -80,7 +80,7 @@ unsigned Message::parse_content(const string &d) } else { - unsigned len = min(chunk_length, d.size()-pos); + string::size_type len = min(chunk_length, d.size()-pos); content.append(d, pos, len); chunk_length -= len; if((pos = d.find('\n', pos+len))!=string::npos) @@ -100,7 +100,7 @@ unsigned Message::parse_headers(const string &d) unsigned start = 0; while(1) { - unsigned lf = d.find('\n', start); + string::size_type lf = d.find('\n', start); if(lf==string::npos) throw invalid_argument("Message::parse_headers"); if(lf==start || (d[start]=='\r' && lf==start+1)) diff --git a/source/http/message.h b/source/http/message.h index 4d23102..e525360 100644 --- a/source/http/message.h +++ b/source/http/message.h @@ -17,7 +17,7 @@ protected: Version http_version; HeaderMap headers; std::string content; - unsigned chunk_length; + std::string::size_type chunk_length; bool complete; Variant user_data; diff --git a/source/http/utils.cpp b/source/http/utils.cpp index 281be80..41fabef 100644 --- a/source/http/utils.cpp +++ b/source/http/utils.cpp @@ -123,7 +123,7 @@ Query parse_query(const std::string &str) Query query; for(vector::const_iterator i=parts.begin(); i!=parts.end(); ++i) { - unsigned equals = i->find('='); + string::size_type equals = i->find('='); string &value = query[urldecode(i->substr(0, equals))]; if(equals!=string::npos) value = urldecode(i->substr(equals+1)); diff --git a/source/net/resolve.cpp b/source/net/resolve.cpp index 8f5c97b..097fea3 100644 --- a/source/net/resolve.cpp +++ b/source/net/resolve.cpp @@ -56,13 +56,13 @@ SockAddr *resolve(const string &str, Family family) { unsigned bracket = str.find(']'); host = str.substr(1, bracket-1); - unsigned colon = str.find(':', bracket); + string::size_type colon = str.find(':', bracket); if(colon!=string::npos) serv = str.substr(colon+1); } else { - unsigned colon = str.find(':'); + string::size_type colon = str.find(':'); if(colon!=string::npos) { host = str.substr(0, colon);