102 size_t toread = buflen <
sizeof(ctx->
buf) ? buflen :
sizeof(ctx->
buf);
105 got = fread(ctx->
buf, 1, toread, ctx->
fp);
108 for (i = 0; i < got; i++)
157 ch = (
unsigned char) *
buf;
190 return fflush(ctx->
fp) == 0;
void * ws_calloc(size_t num, size_t size)
#define WS_STREAM_BUFFER_SIZE
static size_t file_input(void *context, WsUInt32 *buf, size_t buflen)
WsStream * ws_stream_new(void *context, WsStreamIOProc io, WsStreamFlushProc flush, WsStreamCloseProc close)
static size_t file_output(void *context, WsUInt32 *buf, size_t buflen)
static void file_close(void *context)
WsStream * ws_stream_new_file(FILE *fp, WsBool output, WsBool close)
unsigned char buf[WS_STREAM_BUFFER_SIZE]
static WsBool file_flush(void *context)