7#ifndef mime_inputsource_h_included
8#define mime_inputsource_h_included
21 virtual inline void reset(
void);
23 inline void seek(
unsigned int offset);
28 inline unsigned int getOffset(
void)
const;
48 memset(data,
'\0',
sizeof(data));
60 ssize_t nbytes = read(fd, raw,
sizeof(raw));
66 for (ssize_t i = 0; i < nbytes; ++i) {
67 const char c = raw[i];
69 if (lastChar ==
'\r') {
70 data[tail++ & (0x4000-1)] =
'\r';
71 data[tail++ & (0x4000-1)] =
'\n';
73 }
else if (c ==
'\n') {
74 data[tail++ & (0x4000-1)] =
'\r';
75 data[tail++ & (0x4000-1)] =
'\n';
77 if (lastChar ==
'\r') {
78 data[tail++ & (0x4000-1)] =
'\r';
79 data[tail++ & (0x4000-1)] =
'\n';
81 data[tail++ & (0x4000-1)] = c;
92 offset = head = tail = 0;
96 lseek(fd, 0, SEEK_SET);
101 if (offset > seekToOffset)
106 while (seekToOffset > offset) {
117 *c = data[head++ & (0x4000-1)];