"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "force_io.c" between
mtools-4.0.35.tar.bz2 and mtools-4.0.36.tar.bz2

About: Mtools is a collection of utilities to access MS-DOS disks from Unix without mounting them.

force_io.c  (mtools-4.0.35.tar.bz2):force_io.c  (mtools-4.0.36.tar.bz2)
skipping to change at line 30 skipping to change at line 30
* *
* Alain L. Knaff * Alain L. Knaff
* alain@knaff.lu * alain@knaff.lu
* *
*/ */
#include "sysincludes.h" #include "sysincludes.h"
#include "msdos.h" #include "msdos.h"
#include "stream.h" #include "stream.h"
static ssize_t force_io(Stream_t *Stream, static ssize_t force_pio(Stream_t *Stream,
char *buf, mt_off_t start, size_t len, char *buf, mt_off_t start, size_t len,
ssize_t (*io)(Stream_t *, char *, mt_off_t, size_t)) ssize_t (*io)(Stream_t *, char *, mt_off_t, size_t))
{ {
ssize_t ret; ssize_t ret;
int done=0; int done=0;
while(len){ while(len){
ret = io(Stream, buf, start, len); ret = io(Stream, buf, start, len);
if ( ret <= 0 ){ if ( ret <= 0 ){
if (done) if (done)
return done; return done;
else else
skipping to change at line 54 skipping to change at line 54
} }
assert((size_t)ret <= len); assert((size_t)ret <= len);
start += (size_t) ret; start += (size_t) ret;
done += ret; done += ret;
len -= (size_t) ret; len -= (size_t) ret;
buf += ret; buf += ret;
} }
return done; return done;
} }
ssize_t force_write(Stream_t *Stream, char *buf, mt_off_t start, size_t len) static ssize_t write_wrapper(Stream_t *Stream, char *buf,
mt_off_t start UNUSEDP, size_t len)
{ {
return force_io(Stream, buf, start, len, return Stream->Class->write(Stream, buf, len);
Stream->Class->write);
} }
ssize_t force_read(Stream_t *Stream, char *buf, mt_off_t start, size_t len) ssize_t force_write(Stream_t *Stream, char *buf, size_t len)
{ {
return force_io(Stream, buf, start, len, return force_pio(Stream, buf, 0, len, write_wrapper);
Stream->Class->read); }
ssize_t force_pwrite(Stream_t *Stream, char *buf, mt_off_t start, size_t len)
{
return force_pio(Stream, buf, start, len,
Stream->Class->pwrite);
}
ssize_t force_pread(Stream_t *Stream, char *buf, mt_off_t start, size_t len)
{
return force_pio(Stream, buf, start, len,
Stream->Class->pread);
} }
 End of changes. 5 change blocks. 
9 lines changed or deleted 20 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)