changed method: void PostMultiParser::ReadContentToFileLoop()

previous version was not clean


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@634 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2010-08-11 15:47:44 +00:00
parent c7f6d2727c
commit c3fac2e83f
1 changed files with 11 additions and 5 deletions

View File

@ -265,16 +265,22 @@ void PostMultiParser::ReadContentToFileLoop()
bool has_boundary = false;
while( last!=-1 && !(has_boundary=HasBoundary()) )
while( last!=-1 )
{
content += last;
content_len += 1;
ReadChar();
if( content.size() > WINIX_POSTMULTI_OUTPUT_BUFFER + boundary.size() + 2 ) // +2 for the new line character
if( HasBoundary() )
{
tmp_file.write(content.c_str(), WINIX_POSTMULTI_OUTPUT_BUFFER);
content.erase(0, WINIX_POSTMULTI_OUTPUT_BUFFER);
has_boundary = true;
break;
}
if( content.size() >= WINIX_POSTMULTI_OUTPUT_BUFFER )
{
tmp_file.write(content.c_str(), content.size());
content.clear();
}
if( config->post_file_max != 0 && content_len > (size_t)config->post_file_max )
@ -303,7 +309,7 @@ void PostMultiParser::ReadContentToFile()
time_t t1, t2;
content.clear();
content.reserve(WINIX_POSTMULTI_OUTPUT_BUFFER + boundary.size());
content.reserve(WINIX_POSTMULTI_OUTPUT_BUFFER);
content_len = 0;
t1 = time(0);