From 14ab6909f328eec34a5ff62e14808fe31fa05b18 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Wed, 19 Aug 2015 13:32:44 +0200 Subject: [PATCH] Get rid of dead/unused code + use xapian posix include files --- src/bincimapmime/iodevice.cc | 322 ---------------------- src/bincimapmime/iodevice.h | 401 ---------------------------- src/bincimapmime/iofactory.cc | 87 ------ src/bincimapmime/iofactory.h | 69 ----- src/bincimapmime/mime-inputsource.h | 14 +- src/bincimapmime/mime-printbody.cc | 38 --- src/bincimapmime/trbinc.cc | 4 +- 7 files changed, 12 insertions(+), 923 deletions(-) delete mode 100644 src/bincimapmime/iodevice.cc delete mode 100644 src/bincimapmime/iodevice.h delete mode 100644 src/bincimapmime/iofactory.cc delete mode 100644 src/bincimapmime/iofactory.h diff --git a/src/bincimapmime/iodevice.cc b/src/bincimapmime/iodevice.cc deleted file mode 100644 index 6561f0ca..00000000 --- a/src/bincimapmime/iodevice.cc +++ /dev/null @@ -1,322 +0,0 @@ -/*-*-mode:c++-*-*/ -/* -------------------------------------------------------------------- - * Filename: - * src/iodevice.cc - * - * Description: - * Implementation of the IODevice class. - * -------------------------------------------------------------------- - * Copyright 2002, 2003 Andreas Aardal Hanssen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * -------------------------------------------------------------------- - */ -#include "iodevice.h" -#include "convert.h" // BincStream -//#include "session.h" // getEnv/hasEnv - -#include -#include - -#ifndef NO_NAMESPACES -using namespace ::std; -using namespace ::Binc; -#endif /* NO_NAMESPACES */ - -//------------------------------------------------------------------------ -IODevice::IODevice(int f) : flags(f | IsEnabled), - maxInputBufferSize(0), - maxOutputBufferSize(0), - timeout(0), - readCount(0), writeCount(0), - outputLevel(ErrorLevel), - outputLevelLimit(ErrorLevel), - error(Unknown), errorString("Unknown error"), - dumpfd(0) -{ -} - -//------------------------------------------------------------------------ -IODevice::~IODevice(void) -{ -} - -//------------------------------------------------------------------------ -IODevice &IODevice::operator <<(ostream &(*source)(ostream &)) -{ - if (!(flags & IsEnabled) || outputLevel > outputLevelLimit) - return *this; - - static std::ostream &(*endl_funcptr)(ostream &) = endl; - - if (source != endl_funcptr) - return *this; - - outputBuffer << "\r\n"; - - if (dumpfd) - ::write(dumpfd, "\r\n", 2); - - if (flags & FlushesOnEndl) - flush(); - else if (flags & HasOutputLimit) - if (outputBuffer.getSize() > maxOutputBufferSize) - flush(); - - return *this; -} - -//------------------------------------------------------------------------ -bool IODevice::canRead(void) const -{ - return false; -} - -//------------------------------------------------------------------------ -void IODevice::clear() -{ - if (!(flags & IsEnabled)) - return; - - inputBuffer.clear(); - outputBuffer.clear(); -} - -//------------------------------------------------------------------------ -bool IODevice::flush() -{ - if (!(flags & IsEnabled)) - return true; - - WriteResult writeResult = WriteWait; - do { - unsigned int s = outputBuffer.getSize(); - if (s == 0) - break; - - if (!waitForWrite()) - return false; - - writeResult = write(); - if (writeResult == WriteError) - return false; - - writeCount += s - outputBuffer.getSize(); - } while (outputBuffer.getSize() > 0 && writeResult == WriteWait); - - outputBuffer.clear(); - return true; -} - -//------------------------------------------------------------------------ -void IODevice::setFlags(unsigned int f) -{ - flags |= f; -} - -//------------------------------------------------------------------------ -void IODevice::clearFlags(unsigned int f) -{ - flags &= ~f; -} - -//------------------------------------------------------------------------ -void IODevice::setMaxInputBufferSize(unsigned int max) -{ - maxInputBufferSize = max; -} - -//------------------------------------------------------------------------ -void IODevice::setMaxOutputBufferSize(unsigned int max) -{ - maxOutputBufferSize = max; -} - -//------------------------------------------------------------------------ -void IODevice::setTimeout(unsigned int t) -{ - timeout = t; - - if (t) - flags |= HasTimeout; - else - flags &= ~HasTimeout; -} - -//------------------------------------------------------------------------ -unsigned int IODevice::getTimeout(void) const -{ - return timeout; -} - -//------------------------------------------------------------------------ -void IODevice::setOutputLevel(LogLevel level) -{ - outputLevel = level; -} - -//------------------------------------------------------------------------ -IODevice::LogLevel IODevice::getOutputLevel(void) const -{ - return outputLevel; -} - -//------------------------------------------------------------------------ -void IODevice::setOutputLevelLimit(LogLevel level) -{ - outputLevelLimit = level; -} - -//------------------------------------------------------------------------ -IODevice::LogLevel IODevice::getOutputLevelLimit(void) const -{ - return outputLevelLimit; -} - -//------------------------------------------------------------------------ -bool IODevice::readStr(string *dest, unsigned int max) -{ - // If max is 0, fill the input buffer once only if it's empty. - if (!max && inputBuffer.getSize() == 0 && !fillInputBuffer()) - return false; - - // If max is != 0, wait until we have max. - while (max && inputBuffer.getSize() < max) { - if (!fillInputBuffer()) - return false; - } - - unsigned int bytesToRead = max ? max : inputBuffer.getSize(); - *dest += inputBuffer.str().substr(0, bytesToRead); - if (dumpfd) { - ::write(dumpfd, inputBuffer.str().substr(0, bytesToRead).c_str(), - bytesToRead); - } - - inputBuffer.popString(bytesToRead); - readCount += bytesToRead; - return true; -} - -//------------------------------------------------------------------------ -bool IODevice::readChar(char *dest) -{ - if (inputBuffer.getSize() == 0 && !fillInputBuffer()) - return false; - - char c = inputBuffer.popChar(); - if (dest) - *dest = c; - if (dumpfd) - ::write(dumpfd, &c, 1); - - ++readCount; - return true; -} - -//------------------------------------------------------------------------ -void IODevice::unreadChar(char c) -{ - inputBuffer.unpopChar(c); -} - -//------------------------------------------------------------------------ -void IODevice::unreadStr(const string &s) -{ - inputBuffer.unpopStr(s); -} - -//------------------------------------------------------------------------ -bool IODevice::skipTo(char c) -{ - char dest = '\0'; - do { - if (!readChar(&dest)) - return false; - if (dumpfd) - ::write(dumpfd, &dest, 1); - } while (c != dest); - - return true; -} - -//------------------------------------------------------------------------ -string IODevice::service(void) const -{ - return "nul"; -} - -//------------------------------------------------------------------------ -bool IODevice::waitForWrite(void) const -{ - return false; -} - -//------------------------------------------------------------------------ -bool IODevice::waitForRead(void) const -{ - return false; -} - -//------------------------------------------------------------------------ -IODevice::WriteResult IODevice::write(void) -{ - return WriteError; -} - -//------------------------------------------------------------------------ -bool IODevice::fillInputBuffer(void) -{ - return false; -} - -//------------------------------------------------------------------------ -IODevice::Error IODevice::getLastError(void) const -{ - return error; -} - -//------------------------------------------------------------------------ -string IODevice::getLastErrorString(void) const -{ - return errorString; -} - -//------------------------------------------------------------------------ -unsigned int IODevice::getReadCount(void) const -{ - return readCount; -} - -//------------------------------------------------------------------------ -unsigned int IODevice::getWriteCount(void) const -{ - return writeCount; -} - -//------------------------------------------------------------------------ -void IODevice::enableProtocolDumping(void) -{ -#if 0 - BincStream ss; - ss << "/tmp/bincimap-dump-" << (int) time(0) << "-" - << Session::getInstance().getIP() << "-XXXXXX"; - char *safename = strdup(ss.str().c_str()); - dumpfd = mkstemp(safename); - if (dumpfd == -1) - dumpfd = 0; - delete safename; -#endif -} diff --git a/src/bincimapmime/iodevice.h b/src/bincimapmime/iodevice.h deleted file mode 100644 index a7bd0528..00000000 --- a/src/bincimapmime/iodevice.h +++ /dev/null @@ -1,401 +0,0 @@ -/*-*-mode:c++;c-basic-offset:2-*-*/ -/* -------------------------------------------------------------------- - * Filename: - * src/iodevice.h - * - * Description: - * Declaration of the IODevice class. - * -------------------------------------------------------------------- - * Copyright 2002, 2003 Andreas Aardal Hanssen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * -------------------------------------------------------------------- - */ -#ifndef iodevice_h_included -#define iodevice_h_included -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "convert.h" // BincStream -#include -#include // ::write - -namespace Binc { - /*! - \class IODevice - \brief The IODevice class provides a framework for reading and - writing to device. - - Implement new devices by inheriting this class and overloading all - virtual methods. - - service() returns the service that the specific device is used - for. Two values are "log" and "client". - - \sa IOFactory, MultilogDevice, SyslogDevice, StdIODevice, SSLDevice - */ - class IODevice { - public: - /*! - Standard options for an IODevice. - */ - enum Flags { - None = 0, - FlushesOnEndl = 1 << 0, - HasInputLimit = 1 << 1, - HasOutputLimit = 1 << 2, - IsEnabled = 1 << 3, - HasTimeout = 1 << 4 - }; - - /*! - Errors from when an operation returned false. - */ - enum Error { - Unknown, - Timeout - }; - - /*! - Constructs an invalid IODevice. - - Instances of IODevice perform no operations, and all boolean - functions always return false. This constructor is only useful - if called from a subclass that reimplements all virtual methods. - */ - IODevice(int f = 0); - - /*! - Destructs an IODevice; does nothing. - */ - virtual ~IODevice(void); - - /*! - Clears all data in the input and output buffers. - */ - void clear(void); - - /*! - Sets one or more flags. - \param f A bitwise OR of flags from the Flags enum. - */ - void setFlags(unsigned int f); - - /*! - Clears one or more flags. - \param f A bitwise OR of flags from the Flags enum. - */ - void clearFlags(unsigned int f); - - /*! - Sets the maximum allowed input buffer size. If this size is - non-zero and exceeded, reading from the device will fail. This - functionality is used to prevent clients from forcing this class - to consume so much memory that the program crashes. - - Setting the max input buffer size to 0 disables the input size - limit. - - \param max The maximum input buffer size in bytes. - */ - void setMaxInputBufferSize(unsigned int max); - - /*! - Sets the maximum allowed output buffer size. If this size is - non-zero and exceeded, flush() is called implicitly. - - Setting the max output buffer size to 0 disables the output size - limit. This is generally discouraged. - - As a contrast to setMaxInputBufferSize(), this function is used - to bundle up consequent write calls, allowing more efficient use - of the underlying device as larger blocks of data are written at - a time. - - \param max The maximum output buffer size in bytes. - */ - void setMaxOutputBufferSize(unsigned int max); - - /*! - Sets the device's internal timeout in seconds. This timeout is - used both when waiting for data to read and for waiting for the - ability to write. - - If this timeout is exceeded, the read or write function that - triggered the timeout will fail. - - Setting the timeout to 0 disables the timeout. - - \param t The timeout in seconds. - \sa getTimeout() - */ - void setTimeout(unsigned int t); - - /*! - Returns the timeout in seconds, or 0 if there is no timeout. - - \sa setTimeout() - */ - unsigned int getTimeout(void) const; - - enum LogLevel { - ErrorLevel, - InfoLevel, - WarningLevel, - DebugLevel - }; - - /*! - Sets the output level for the following write operations on this - device. - - The output level is a number which gives the following write - operations a priority. You can use setOutputLevelLimit() to - filter the write operations valid for different operating modes. - This enables you to have certain write operations ignored. - - For instance, if the output level is set to 0, then "Hello" is - written, and the output level is set to 1, followed by writing - "Daisy", the output level limit value will decive wether only - "Hello" is written, or if also "Daisy" is written. - - A low value of the level gives higher priority, and a high level - will give low priority. The default value is 0, and write - operations that are done with output level 0 are never ignored. - - \param level The output level - \sa getOutputLevel(), setOutputLevelLimit() - */ - void setOutputLevel(LogLevel level); - - /*! - Returns the current output level. - - \sa setOutputLevel() - */ - LogLevel getOutputLevel(void) const; - - /*! - Sets the current output level limit. Write operations with a - level higher than the output level limit are ignored. - - \param level The output level limit - \sa setOutputLevel() - */ - void setOutputLevelLimit(LogLevel level); - - /*! - Returns the current output level limit. - - \sa setOutputLevelLimit() - */ - LogLevel getOutputLevelLimit(void) const; - - /*! - Returns the number of bytes that have been read from this device - since it was created. - */ - unsigned int getReadCount(void) const; - - /*! - Returns the number of bytes that have been written to this - device since it was created. - */ - unsigned int getWriteCount(void) const; - - /*! - Calling this function enables the built-in protocol dumping feature in - the device. All input and output to this device will be dumped to a file - in /tmp. - */ - void enableProtocolDumping(void); - - /*! - Writes data to the device. Depending on the value of the max - output buffer size, the data may not be written immediately. - - \sa setMaxOutputBufferSize() - */ - template IODevice &operator <<(const T &source); - - /*! - Writes data to the device. This function specializes on standard - ostream derivates, such as std::endl. - */ - IODevice &operator <<(std::ostream &(*source)(std::ostream &)); - - /*! - Returns true if data can be read from the device; otherwise - returns false. - */ - virtual bool canRead(void) const; - - /*! - Reads data from the device, and stores this in a string. Returns - true on success; otherwise returns false. - - \param dest The incoming data is stored in this string. - \param max No more than this number of bytes is read from the - device. - */ - bool readStr(std::string *dest, unsigned int max = 0); - - /*! - Reads exactly one byte from the device and stores this in a - char. Returns true on success; otherwise returns false. - - \param dest The incoming byte is stored in this char. - */ - bool readChar(char *dest = 0); - - /*! - FIXME: add docs - */ - void unreadChar(char c); - - /*! - FIXME: add docs - */ - void unreadStr(const std::string &s); - - /*! - Reads characters from the device, until and including one - certain character is found. All read characters are discarded. - - This function can be used to skip to the beginning of a line, - with the terminating character being '\n'. - - \param The certain character. - */ - bool skipTo(char c); - - /*! - Flushes the output buffer. Writes all data in the output buffer - to the device. - */ - bool flush(void); - - /*! - Returns the type of error that most recently occurred. - */ - Error getLastError(void) const; - - /*! - Returns a human readable description of the error that most - recently occurred. If no known error has occurred, this method - returns "Unknown error". - */ - std::string getLastErrorString(void) const; - - /*! - Returns the type of service provided by this device. Two valid - return values are "client" and "log". - */ - virtual std::string service(void) const; - - protected: - /*! - Waits until data can be written to the device. If the timeout is - 0, this function waits indefinitely. Otherwise, it waits until - the timeout has expired. - - If this function returns true, data can be written to the - device; otherwise, getLastError() must be checked to determine - whether a timeout occurred or whether an error with the device - prevents further writing. - */ - virtual bool waitForWrite(void) const; - - /*! - Waits until data can be read from the device. - - \sa waitForWrite() - */ - virtual bool waitForRead(void) const; - - /*! - Types of results from a write. - */ - enum WriteResult { - WriteWait = 0, - WriteDone = 1 << 0, - WriteError = 1 << 1 - }; - - /*! - Writes as much data as possible to the device. If some but not - all data was written, returns WriteWait. If all data was - written, returns WriteDone. If an error occurred, returns - WriteError. - */ - virtual WriteResult write(void); - - /*! - Reads data from the device, and stores it in the input buffer. - Returns true on success; otherwise returns false. - - This method will fail if there is no more data available, if a - timeout occurred or if an error with the device prevents more - data from being read. - - The number of bytes read from the device is undefined. - */ - virtual bool fillInputBuffer(void); - - BincStream inputBuffer; - BincStream outputBuffer; - - protected: - unsigned int flags; - unsigned int maxInputBufferSize; - unsigned int maxOutputBufferSize; - - unsigned int timeout; - - unsigned int readCount; - unsigned int writeCount; - - LogLevel outputLevel; - LogLevel outputLevelLimit; - - mutable Error error; - mutable std::string errorString; - - int dumpfd; - }; - - //---------------------------------------------------------------------- - template IODevice &IODevice::operator <<(const T &source) - { - if ((flags & IsEnabled) && outputLevel <= outputLevelLimit) { - outputBuffer << source; - - if (dumpfd) { - BincStream ss; - ss << source; - ::write(dumpfd, ss.str().c_str(), ss.getSize()); - } - - if (flags & HasInputLimit) - if (outputBuffer.getSize() > maxOutputBufferSize) - flush(); - } - - return *this; - } -} - -#endif diff --git a/src/bincimapmime/iofactory.cc b/src/bincimapmime/iofactory.cc deleted file mode 100644 index 04b6999e..00000000 --- a/src/bincimapmime/iofactory.cc +++ /dev/null @@ -1,87 +0,0 @@ -/*-*-mode:c++-*-*/ -/* -------------------------------------------------------------------- - * Filename: - * src/iofactory.cc - * - * Description: - * Implementation of the IOFactory class. - * -------------------------------------------------------------------- - * Copyright 2002, 2003 Andreas Aardal Hanssen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * -------------------------------------------------------------------- - */ -#include "iofactory.h" -#include "iodevice.h" - -#ifndef NO_NAMESPACES -using namespace ::Binc; -using namespace ::std; -#endif /* NO_NAMESPACES */ - -//------------------------------------------------------------------------ -IOFactory::IOFactory(void) -{ -} - -//------------------------------------------------------------------------ -IOFactory::~IOFactory(void) -{ -} - -//------------------------------------------------------------------------ -IOFactory &IOFactory::getInstance(void) -{ - static IOFactory ioFactory; - return ioFactory; -} - -//------------------------------------------------------------------------ -void IOFactory::addDevice(IODevice *dev) -{ - IODevice *ioDevice = IOFactory::getInstance().devices[dev->service()]; - - // FIXME: Delete correct object. Now, only IODevice's destructor is - // called, and only IODevice's memory is freed. - if (ioDevice) - delete ioDevice; - - IOFactory::getInstance().devices[dev->service()] = dev; -} - -//------------------------------------------------------------------------ -IODevice &IOFactory::getClient(void) -{ - static IODevice nulDevice; - - IOFactory &ioFactory = IOFactory::getInstance(); - - if (ioFactory.devices.find("client") != ioFactory.devices.end()) - return *ioFactory.devices["client"]; - - return nulDevice; -} - -//------------------------------------------------------------------------ -IODevice &IOFactory::getLogger(void) -{ - static IODevice nulDevice; - - IOFactory &ioFactory = IOFactory::getInstance(); - - if (ioFactory.devices.find("log") != ioFactory.devices.end()) - return *ioFactory.devices["log"]; - return nulDevice; -} diff --git a/src/bincimapmime/iofactory.h b/src/bincimapmime/iofactory.h deleted file mode 100644 index 2c7b8157..00000000 --- a/src/bincimapmime/iofactory.h +++ /dev/null @@ -1,69 +0,0 @@ -/*-*-mode:c++-*-*/ -/* -------------------------------------------------------------------- - * Filename: - * src/iofactory.h - * - * Description: - * Declaration of the IOFactory class. - * -------------------------------------------------------------------- - * Copyright 2002, 2003 Andreas Aardal Hanssen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * -------------------------------------------------------------------- - */ -#ifndef IOFACTORY_H_INCLUDED -#define IOFACTORY_H_INCLUDED -#include -#include - -#include "iodevice.h" - -namespace Binc { - class IOFactory { - public: - ~IOFactory(void); - - static void addDevice(IODevice *dev); - static IOFactory &getInstance(void); - static IODevice &getClient(void); - static IODevice &getLogger(void); - - private: - IOFactory(void); - - std::map devices; - }; -} - -#define bincClient \ - IOFactory::getClient() - -#if !defined (DEBUG) -#define bincError if (false) std::cout -#define bincWarning if (false) std::cout -#define bincDebug if (false) std::cout -#else -#define bincError \ - IOFactory::getLogger().setOutputLevel(IODevice::ErrorLevel);IOFactory::getLogger() -#define bincWarning \ - IOFactory::getLogger().setOutputLevel(IODevice::WarningLevel);IOFactory::getLogger() -#define bincDebug \ - IOFactory::getLogger().setOutputLevel(IODevice::DebugLevel);IOFactory::getLogger() -#endif - -#define bincInfo \ - IOFactory::getLogger().setOutputLevel(IODevice::InfoLevel);IOFactory::getLogger() - -#endif diff --git a/src/bincimapmime/mime-inputsource.h b/src/bincimapmime/mime-inputsource.h index 49752b39..2e507e4a 100644 --- a/src/bincimapmime/mime-inputsource.h +++ b/src/bincimapmime/mime-inputsource.h @@ -26,12 +26,18 @@ #ifndef mime_inputsource_h_included #define mime_inputsource_h_included -#ifdef HAVE_CONFIG_H -#include -#endif +// Data source for MIME parser + +// Note about large files: we might want to change the unsigned int +// used for offsets into an off_t for intellectual satisfaction, but +// in the context of recoll, we could only get into trouble if a +// *single message* exceeded 2GB, which seems rather unlikely. When +// parsing a mailbox files, we read each message in memory and use the +// stream input source (from a memory buffer, no file offsets). When +// parsing a raw message file, it's only one message. #include -#include +#include "safeunistd.h" #include diff --git a/src/bincimapmime/mime-printbody.cc b/src/bincimapmime/mime-printbody.cc index 39d5b650..6f8268f6 100644 --- a/src/bincimapmime/mime-printbody.cc +++ b/src/bincimapmime/mime-printbody.cc @@ -23,52 +23,14 @@ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. * -------------------------------------------------------------------- */ -#ifdef HAVE_CONFIG_H -#include -#endif #include "mime.h" #include "mime-utils.h" #include "mime-inputsource.h" -#include "convert.h" -#include "iodevice.h" -#include "iofactory.h" - #include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef NO_NAMESPACES using namespace ::std; -#endif /* NO_NAMESPACES */ - -//------------------------------------------------------------------------ -void Binc::MimePart::printBody(IODevice &output, - unsigned int startoffset, - unsigned int length) const -{ - mimeSource->reset(); - mimeSource->seek(bodystartoffsetcrlf + startoffset); - - if (startoffset + length > bodylength) - length = bodylength - startoffset; - - char c = '\0'; - for (unsigned int i = 0; i < length; ++i) { - if (!mimeSource->getChar(&c)) - break; - - output << (char)c; - } -} void Binc::MimePart::getBody(string &s, unsigned int startoffset, diff --git a/src/bincimapmime/trbinc.cc b/src/bincimapmime/trbinc.cc index 8dcf33bb..fe2db3d1 100644 --- a/src/bincimapmime/trbinc.cc +++ b/src/bincimapmime/trbinc.cc @@ -17,10 +17,10 @@ #include #include -#include #include +#include "safefcntl.h" +#include "safeunistd.h" #include -#include #include