1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Removed an unused variable and one do-while loop that wasn't used either.

Added a few comments while at it.
This commit is contained in:
Daniel Stenberg 2008-05-09 12:53:42 +00:00
parent e2b82b4325
commit 6d5cca5ed0

View File

@ -377,7 +377,6 @@ CURLcode Curl_readwrite(struct connectdata *conn,
return CURLE_SEND_ERROR; return CURLE_SEND_ERROR;
} }
do {
/* We go ahead and do a read if we have a readable socket or if /* We go ahead and do a read if we have a readable socket or if
the stream was rewound (in which case we have data in a the stream was rewound (in which case we have data in a
buffer) */ buffer) */
@ -1415,14 +1414,12 @@ CURLcode Curl_readwrite(struct connectdata *conn,
} /* if( read from socket ) */ } /* if( read from socket ) */
/* If we still have writing to do, we check if we have a writable /* If we still have writing to do, we check if we have a writable socket. */
socket. */
if((k->keepon & KEEP_WRITE) && (select_res & CURL_CSELECT_OUT)) { if((k->keepon & KEEP_WRITE) && (select_res & CURL_CSELECT_OUT)) {
/* write */ /* write */
ssize_t i, si; ssize_t i, si;
ssize_t bytes_written; ssize_t bytes_written;
bool writedone=TRUE;
if((k->bytecount == 0) && (k->writebytecount == 0)) if((k->bytecount == 0) && (k->writebytecount == 0))
Curl_pgrsTime(data, TIMER_STARTTRANSFER); Curl_pgrsTime(data, TIMER_STARTTRANSFER);
@ -1474,7 +1471,6 @@ CURLcode Curl_readwrite(struct connectdata *conn,
else if(nread<=0) { else if(nread<=0) {
/* done */ /* done */
k->keepon &= ~KEEP_WRITE; /* we're done writing */ k->keepon &= ~KEEP_WRITE; /* we're done writing */
writedone = TRUE;
if(conn->bits.rewindaftersend) { if(conn->bits.rewindaftersend) {
result = Curl_readrewind(conn); result = Curl_readrewind(conn);
@ -1490,10 +1486,11 @@ CURLcode Curl_readwrite(struct connectdata *conn,
/* convert LF to CRLF if so asked */ /* convert LF to CRLF if so asked */
#ifdef CURL_DO_LINEEND_CONV #ifdef CURL_DO_LINEEND_CONV
/* always convert if we're FTPing in ASCII mode */ /* always convert if we're FTPing in ASCII mode */
if((data->set.crlf) || (data->set.prefer_ascii)) { if((data->set.crlf) || (data->set.prefer_ascii))
#else #else
if(data->set.crlf) { if(data->set.crlf)
#endif /* CURL_DO_LINEEND_CONV */ #endif /* CURL_DO_LINEEND_CONV */
{
if(data->state.scratch == NULL) if(data->state.scratch == NULL)
data->state.scratch = malloc(2*BUFSIZE); data->state.scratch = malloc(2*BUFSIZE);
if(data->state.scratch == NULL) { if(data->state.scratch == NULL) {
@ -1531,7 +1528,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
data->req.upload_present = nread; data->req.upload_present = nread;
} }
} }
} } /* if 0 == data->req.upload_present */
else { else {
/* We have a partial buffer left from a previous "round". Use /* We have a partial buffer left from a previous "round". Use
that instead of reading more data */ that instead of reading more data */
@ -1560,8 +1557,6 @@ CURLcode Curl_readwrite(struct connectdata *conn,
/* advance the pointer where to find the buffer when the next send /* advance the pointer where to find the buffer when the next send
is to happen */ is to happen */
data->req.upload_fromhere += bytes_written; data->req.upload_fromhere += bytes_written;
writedone = TRUE; /* we are done, stop the loop */
} }
else { else {
/* we've uploaded that buffer now */ /* we've uploaded that buffer now */
@ -1571,19 +1566,16 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if(k->upload_done) { if(k->upload_done) {
/* switch off writing, we're done! */ /* switch off writing, we're done! */
k->keepon &= ~KEEP_WRITE; /* we're done writing */ k->keepon &= ~KEEP_WRITE; /* we're done writing */
writedone = TRUE;
} }
} }
k->writebytecount += bytes_written; k->writebytecount += bytes_written;
Curl_pgrsSetUploadCounter(data, k->writebytecount); Curl_pgrsSetUploadCounter(data, k->writebytecount);
} while(!writedone); /* loop until we're done writing! */
}
} while(0); /* just to break out from! */ } while(0); /* just to break out from! */
} /* if(something to write) */
k->now = Curl_tvnow(); k->now = Curl_tvnow();
if(didwhat) { if(didwhat) {
/* Update read/write counters */ /* Update read/write counters */
@ -1679,7 +1671,8 @@ CURLcode Curl_readwrite(struct connectdata *conn,
} }
/* Now update the "done" boolean we return */ /* Now update the "done" boolean we return */
*done = (bool)(0 == (k->keepon&(KEEP_READ|KEEP_WRITE|KEEP_READ_PAUSE|KEEP_WRITE_PAUSE))); *done = (bool)(0 == (k->keepon&(KEEP_READ|KEEP_WRITE|
KEEP_READ_PAUSE|KEEP_WRITE_PAUSE)));
return CURLE_OK; return CURLE_OK;
} }