diff options
Diffstat (limited to 'src/include/mime-inputsource.h')
-rw-r--r-- | src/include/mime-inputsource.h | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/src/include/mime-inputsource.h b/src/include/mime-inputsource.h index e37d508..8ff97f4 100644 --- a/src/include/mime-inputsource.h +++ b/src/include/mime-inputsource.h @@ -8,6 +8,7 @@ #define mime_inputsource_h_included #include <string.h> + #include <unistd.h> namespace Binc { @@ -50,9 +51,7 @@ namespace Binc { seek(start); } - inline MimeInputSource::~MimeInputSource(void) - { - } + inline MimeInputSource::~MimeInputSource(void) {} inline bool MimeInputSource::fillInputBuffer(void) { @@ -67,18 +66,18 @@ namespace Binc { const char c = raw[i]; if (c == '\r') { if (lastChar == '\r') { - data[tail++ & (0x4000-1)] = '\r'; - data[tail++ & (0x4000-1)] = '\n'; + data[tail++ & (0x4000 - 1)] = '\r'; + data[tail++ & (0x4000 - 1)] = '\n'; } } else if (c == '\n') { - data[tail++ & (0x4000-1)] = '\r'; - data[tail++ & (0x4000-1)] = '\n'; + data[tail++ & (0x4000 - 1)] = '\r'; + data[tail++ & (0x4000 - 1)] = '\n'; } else { if (lastChar == '\r') { - data[tail++ & (0x4000-1)] = '\r'; - data[tail++ & (0x4000-1)] = '\n'; + data[tail++ & (0x4000 - 1)] = '\r'; + data[tail++ & (0x4000 - 1)] = '\n'; } - data[tail++ & (0x4000-1)] = c; + data[tail++ & (0x4000 - 1)] = c; } lastChar = c; @@ -92,15 +91,13 @@ namespace Binc { offset = head = tail = 0; lastChar = '\0'; - if (fd != -1) - lseek(fd, 0, SEEK_SET); + if (fd != -1) lseek(fd, 0, SEEK_SET); } inline void MimeInputSource::seek(unsigned int seekToOffset) { - if (offset > seekToOffset) - reset(); - + if (offset > seekToOffset) reset(); + char c; int n = 0; while (seekToOffset > offset) { @@ -111,10 +108,9 @@ namespace Binc { inline bool MimeInputSource::getChar(char *c) { - if (head == tail && !fillInputBuffer()) - return false; + if (head == tail && !fillInputBuffer()) return false; - *c = data[head++ & (0x4000-1)]; + *c = data[head++ & (0x4000 - 1)]; ++offset; return true; } |