Revision 23d154a3
Von aquamaniac vor fast 22 Jahren hinzugefügt
src/io/bufferedio.c | ||
---|---|---|
|
||
int GWEN_BufferedIO_ReadBufferEmpty(GWEN_BUFFEREDIO *bt) {
|
||
assert(bt);
|
||
return ((bt->readerBuffer==0) || !bt->readerBufferFilled);
|
||
return ((bt->readerBuffer==0) ||
|
||
!bt->readerBufferFilled ||
|
||
bt->readerBufferPos>=bt->readerBufferFilled);
|
||
}
|
||
|
||
|
||
|
||
int GWEN_BufferedIO_WriteBufferEmpty(GWEN_BUFFEREDIO *bt) {
|
||
assert(bt);
|
||
return ((bt->writerBuffer==0) || !bt->writerBufferFilled);
|
||
return ((bt->writerBuffer==0) ||
|
||
!bt->writerBufferFilled ||
|
||
bt->writerBufferPos>=bt->writerBufferFilled);
|
||
}
|
||
|
||
|
||
... | ... | |
/* buffer not empty, so read from the buffer first */
|
||
int i;
|
||
|
||
i=bt->readerBufferPos<bt->readerBufferFilled;
|
||
i=bt->readerBufferFilled-bt->readerBufferPos;
|
||
if (i>*bsize)
|
||
i=*bsize;
|
||
DBG_INFO(0, "Reading rest from buffer (%d at %d of %d)",
|
||
i,bt->readerBufferPos, bt->readerBufferFilled);
|
||
|
||
if (i) {
|
||
/* copy as much bytes as needed, advance pointer */
|
||
... | ... | |
bt->readerBufferPos+=i;
|
||
}
|
||
*bsize=i;
|
||
DBG_INFO(0, "Read %d bytes from buffer", i);
|
||
return 0;
|
||
}
|
||
else {
|
||
... | ... | |
GWEN_ERRORCODE err;
|
||
int i;
|
||
|
||
DBG_INFO(0, "Reading directly from source");
|
||
assert(bt->readPtr);
|
||
i=*bsize;
|
||
err=bt->readPtr(bt,
|
||
... | ... | |
}
|
||
bt->readerEOF=(i==0);
|
||
*bsize=i;
|
||
DBG_INFO(0, "Read %d bytes from source", i);
|
||
}
|
||
if (bt->readerEOF) {
|
||
DBG_DEBUG(0, "EOF now met");
|
||
... | ... | |
GWEN_BUFFEREDIO_ERROR_READ);
|
||
}
|
||
|
||
DBG_DEBUG(0, "Reading ok");
|
||
DBG_DEBUG(0, "Reading ok (%d bytes)", *size);
|
||
return 0;
|
||
}
|
||
|
Auch abrufbar als: Unified diff
- started debugging several modules (mostly IPC and msgEngine)
git-svn-id: https://devel.aqbanking.de/svn/gwenhywfar/trunk@21 70169cfe-8b10-0410-8925-dcb4b91034d8