fix some bugs

This commit is contained in:
an-tao 2018-06-01 14:07:34 +08:00
parent 2875656d82
commit 0a80323f84
6 changed files with 14 additions and 13 deletions

View File

@ -44,7 +44,7 @@ static std::string& replace_all(std::string& str,const std::string& old_
}
return str;
}
static void parseCxxLine(std::ofstream &oSrcFile,const std::string line,const std::string streamName,const std::string viewDataName)
static void parseCxxLine(std::ofstream &oSrcFile,const std::string& line,const std::string& streamName,const std::string& viewDataName)
{
if(line.length()>0)

View File

@ -78,7 +78,7 @@ void HttpRequestImpl::parsePremeter()
if(epos != std::string::npos) {
std::string key = coo.substr(0, epos);
std::string::size_type cpos=0;
while(isspace(key[cpos])&&cpos<key.length())
while(cpos<key.length()&&isspace(key[cpos]))
cpos++;
key=key.substr(cpos);
std::string pvalue = coo.substr(epos + 1);
@ -99,7 +99,7 @@ void HttpRequestImpl::parsePremeter()
if(epos != std::string::npos) {
std::string key = coo.substr(0, epos);
std::string::size_type cpos=0;
while(isspace(key[cpos])&&cpos<key.length())
while(cpos<key.length()&&isspace(key[cpos]))
cpos++;
key=key.substr(cpos);
std::string pvalue = coo.substr(epos + 1);

View File

@ -48,7 +48,8 @@ namespace drogon
HttpRequestImpl()
: method_(kInvalid),
version_(kUnknown)
version_(kUnknown),
contentLen(0)
{
}
@ -203,7 +204,7 @@ namespace drogon
if(epos != std::string::npos) {
std::string cookie_name = coo.substr(0, epos);
std::string::size_type cpos=0;
while(isspace(cookie_name[cpos])&&cpos<cookie_name.length())
while(cpos<cookie_name.length()&&isspace(cookie_name[cpos]))
cpos++;
cookie_name=cookie_name.substr(cpos);
std::string cookie_value = coo.substr(epos + 1);
@ -218,7 +219,7 @@ namespace drogon
if(epos != std::string::npos) {
std::string cookie_name = coo.substr(0, epos);
std::string::size_type cpos=0;
while(isspace(cookie_name[cpos])&&cpos<cookie_name.length())
while(cpos<cookie_name.length()&&isspace(cookie_name[cpos]))
cpos++;
cookie_name=cookie_name.substr(cpos);
std::string cookie_value = coo.substr(epos + 1);
@ -309,7 +310,7 @@ namespace drogon
SessionPtr _sessionPtr;
protected:
std::string content_;
size_t contentLen;
ssize_t contentLen;
};

View File

@ -191,7 +191,7 @@ void HttpResponseImpl::appendToBuffer(MsgBuffer* output) const
output->append(buf);
output->append(statusMessage_);
output->append("\r\n");
snprintf(buf, sizeof buf, "Content-Length: %zd\r\n", body_.size());
snprintf(buf, sizeof buf, "Content-Length: %lu\r\n", body_.size());
output->append(buf);
if (closeConnection_) {
output->append("Connection: close\r\n");

View File

@ -146,7 +146,7 @@ namespace drogon
if(epos != std::string::npos) {
std::string cookie_name = coo.substr(0, epos);
std::string::size_type cpos=0;
while(isspace(cookie_name[cpos])&&cpos<cookie_name.length())
while(cpos<cookie_name.length()&&isspace(cookie_name[cpos]))
cpos++;
cookie_name=cookie_name.substr(cpos);
std::string cookie_value = coo.substr(epos + 1);
@ -161,7 +161,7 @@ namespace drogon
if(epos != std::string::npos) {
std::string cookie_name = coo.substr(0, epos);
std::string::size_type cpos=0;
while(isspace(cookie_name[cpos])&&cpos<cookie_name.length())
while(cpos<cookie_name.length()&&isspace(cookie_name[cpos]))
cpos++;
cookie_name=cookie_name.substr(cpos);
std::string cookie_value = coo.substr(epos + 1);
@ -224,8 +224,8 @@ namespace drogon
std::string statusMessage_;
bool closeConnection_;
std::string body_;
size_t left_body_length_;
size_t current_chunk_length_;
ssize_t left_body_length_;
ssize_t current_chunk_length_;
uint8_t contentType_=CT_TEXT_HTML;
//trantor::Date receiveTime_;

@ -1 +1 @@
Subproject commit 96684718bfb171dc392c1e35fc381b82e0838011
Subproject commit 8cafcd2ab9720ac21f4cd0af9b3af3ea79385d3b