Minor refactoring of the Win32 file write code.
* file_io/win32/readwrite.c
(apr_file_write): Invert the if-else clauses to test against the
positive condition.
Patch by: Evgeny Kotkov <evgeny.kotkov {at} visualsvn.com>
@@ -371,7 +371,11 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a
}
return rv;
} else {
- if (!thefile->pipe) {
+ if (thefile->pipe) {
+ rv = WriteFile(thefile->filehand, buf, (DWORD)*nbytes, &bwrote,
+ thefile->pOverlapped);
+ }
+ else {
if (thefile->append) {
apr_off_t offset = 0;
@@ -406,10 +410,6 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a
apr_thread_mutex_unlock(thefile->mutex);
}
}
- else {
- rv = WriteFile(thefile->filehand, buf, (DWORD)*nbytes, &bwrote,
- thefile->pOverlapped);
- }
if (rv) {
*nbytes = bwrote;
rv = APR_SUCCESS;
