build/win32/libmspub.dsp | 8 --- build/win32/libmspub.vcproj | 8 --- build/win32/libmspub.vcxproj | 2 src/lib/MSPUBInternalStream.cpp | 102 ---------------------------------------- src/lib/MSPUBInternalStream.h | 76 ----------------------------- src/lib/MSPUBParser.cpp | 11 +--- src/lib/Makefile.am | 2 7 files changed, 5 insertions(+), 204 deletions(-)
New commits: commit 3d6a550b7a2b1481a65373ab9acc191340375786 Author: Fridrich Å trba <fridrich.st...@bluewin.ch> Date: Fri May 10 13:48:59 2013 +0200 Use the stream returning WPXBinaryData method rather diff --git a/build/win32/libmspub.dsp b/build/win32/libmspub.dsp index 70986b9..4421e1b 100644 --- a/build/win32/libmspub.dsp +++ b/build/win32/libmspub.dsp @@ -111,10 +111,6 @@ SOURCE=..\..\src\lib\MSPUBDocument.cpp # End Source File # Begin Source File -SOURCE=..\..\src\lib\MSPUBInternalStream.cpp -# End Source File -# Begin Source File - SOURCE=..\..\src\lib\MSPUBParser.cpp # End Source File # Begin Source File @@ -239,10 +235,6 @@ SOURCE=..\..\src\lib\MSPUBDocument.h # End Source File # Begin Source File -SOURCE=..\..\src\lib\MSPUBInternalStream.h -# End Source File -# Begin Source File - SOURCE=..\..\src\lib\MSPUBParser.h # End Source File # Begin Source File diff --git a/build/win32/libmspub.vcproj b/build/win32/libmspub.vcproj index 4196582..b88d14c 100644 --- a/build/win32/libmspub.vcproj +++ b/build/win32/libmspub.vcproj @@ -197,10 +197,6 @@ > </File> <File - RelativePath="..\..\src\lib\MSPUBInternalStream.cpp" - > - </File> - <File RelativePath="..\..\src\lib\MSPUBParser.cpp" > </File> @@ -326,10 +322,6 @@ > </File> <File - RelativePath="..\..\src\lib\MSPUBInternalStream.h" - > - </File> - <File RelativePath="..\..\src\lib\MSPUBParser.h" > </File> diff --git a/build/win32/libmspub.vcxproj b/build/win32/libmspub.vcxproj index 3076a81..c233331 100644 --- a/build/win32/libmspub.vcxproj +++ b/build/win32/libmspub.vcxproj @@ -32,7 +32,6 @@ <ClInclude Include="..\..\src\lib\MSPUBConstants.h" /> <ClInclude Include="..\..\src\lib\MSPUBContentChunkType.h" /> <ClInclude Include="..\..\src\lib\MSPUBDocument.h" /> - <ClInclude Include="..\..\src\lib\MSPUBInternalStream.h" /> <ClInclude Include="..\..\src\lib\MSPUBParser.h" /> <ClInclude Include="..\..\src\lib\MSPUBParser2k.h" /> <ClInclude Include="..\..\src\lib\MSPUBParser97.h" /> @@ -59,7 +58,6 @@ <ClCompile Include="..\..\src\lib\libmspub_utils.cpp" /> <ClCompile Include="..\..\src\lib\MSPUBCollector.cpp" /> <ClCompile Include="..\..\src\lib\MSPUBDocument.cpp" /> - <ClCompile Include="..\..\src\lib\MSPUBInternalStream.cpp" /> <ClCompile Include="..\..\src\lib\MSPUBParser.cpp" /> <ClCompile Include="..\..\src\lib\MSPUBParser2k.cpp" /> <ClCompile Include="..\..\src\lib\MSPUBParser97.cpp" /> diff --git a/src/lib/MSPUBInternalStream.cpp b/src/lib/MSPUBInternalStream.cpp deleted file mode 100644 index 594e184..0000000 --- a/src/lib/MSPUBInternalStream.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* libvisio - * Version: MPL 1.1 / GPLv2+ / LGPLv2+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * Major Contributor(s): - * Copyright (C) 2011 Fridrich Strba <fridrich.st...@bluewin.ch> - * Copyright (C) 2011 Eilidh McAdam <tibbylic...@gmail.com> - * - * - * All Rights Reserved. - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPLv2+"), or - * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"), - * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable - * instead of those above. - */ - - -#include <string.h> -#include "MSPUBInternalStream.h" - - -libmspub::MSPUBInternalStream::MSPUBInternalStream(const unsigned char *buffer, size_t bufferLength) : - WPXInputStream(), - m_offset(0), - m_buffer(bufferLength) -{ - memcpy(&m_buffer[0], buffer, bufferLength); -} - -const unsigned char *libmspub::MSPUBInternalStream::read(unsigned long numBytes, unsigned long &numBytesRead) -{ - numBytesRead = 0; - - if (numBytes == 0) - return 0; - - int numBytesToRead; - - if ((m_offset+numBytes) < m_buffer.size()) - numBytesToRead = numBytes; - else - numBytesToRead = m_buffer.size() - m_offset; - - numBytesRead = numBytesToRead; - - if (numBytesToRead == 0) - return 0; - - long oldOffset = m_offset; - m_offset += numBytesToRead; - - return &m_buffer[oldOffset]; -} - -int libmspub::MSPUBInternalStream::seek(long offset, WPX_SEEK_TYPE seekType) -{ - if (seekType == WPX_SEEK_CUR) - m_offset += offset; - else if (seekType == WPX_SEEK_SET) - m_offset = offset; - - if (m_offset < 0) - { - m_offset = 0; - return 1; - } - if ((long)m_offset > (long)m_buffer.size()) - { - m_offset = m_buffer.size(); - return 1; - } - - return 0; -} - -long libmspub::MSPUBInternalStream::tell() -{ - return m_offset; -} - -bool libmspub::MSPUBInternalStream::atEOS() -{ - if ((long)m_offset >= (long)m_buffer.size()) - return true; - - return false; -} -/* vim:set shiftwidth=2 softtabstop=2 expandtab: */ diff --git a/src/lib/MSPUBInternalStream.h b/src/lib/MSPUBInternalStream.h deleted file mode 100644 index 2f648cd..0000000 --- a/src/lib/MSPUBInternalStream.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* libvisio - * Version: MPL 1.1 / GPLv2+ / LGPLv2+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * Major Contributor(s): - * Copyright (C) 2011 Fridrich Strba <fridrich.st...@bluewin.ch> - * Copyright (C) 2011 Eilidh McAdam <tibbylic...@gmail.com> - * - * - * All Rights Reserved. - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPLv2+"), or - * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"), - * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable - * instead of those above. - */ - - -#ifndef __MSPUBINTERNALSTREAM_H__ -#define __MSPUBINTERNALSTREAM_H__ - -#include <stddef.h> -#include <vector> -#include <libwpd-stream/libwpd-stream.h> - -namespace libmspub -{ - -class MSPUBInternalStream : public WPXInputStream -{ -public: - MSPUBInternalStream(const unsigned char *buffer, size_t bufferLength); - ~MSPUBInternalStream() {} - - bool isOLEStream() - { - return false; - } - WPXInputStream *getDocumentOLEStream(const char *) - { - return 0; - } - - const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead); - int seek(long offset, WPX_SEEK_TYPE seekType); - long tell(); - bool atEOS(); - unsigned long getSize() const - { - return m_buffer.size(); - }; - -private: - volatile long m_offset; - std::vector<unsigned char> m_buffer; - MSPUBInternalStream(const MSPUBInternalStream &); - MSPUBInternalStream &operator=(const MSPUBInternalStream &); -}; - -} // namespace libmspub - -#endif -/* vim:set shiftwidth=2 softtabstop=2 expandtab: */ diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp index 77437d4..7449040 100644 --- a/src/lib/MSPUBParser.cpp +++ b/src/lib/MSPUBParser.cpp @@ -39,7 +39,6 @@ #include "MSPUBBlockType.h" #include "MSPUBContentChunkType.h" #include "MSPUBConstants.h" -#include "MSPUBInternalStream.h" #include "EscherContainerType.h" #include "EscherFieldIds.h" #include "libmspub_utils.h" @@ -271,7 +270,7 @@ bool libmspub::MSPUBParser::parseEscherDelay(WPXInputStream *input) { // Reconstruct BMP header // cf. http://en.wikipedia.org/wiki/BMP_file_format , accessed 2012-5-31 - MSPUBInternalStream buf(img.getDataBuffer(), img.size()); + WPXInputStream *buf = const_cast<WPXInputStream *>(img.getDataStream()); if (img.size() < 0x2E + 4) { ++m_lastAddedImage; @@ -279,10 +278,10 @@ bool libmspub::MSPUBParser::parseEscherDelay(WPXInputStream *input) input->seek(info.contentsOffset + info.contentsLength, WPX_SEEK_SET); continue; } - buf.seek(0x0E, WPX_SEEK_SET); - unsigned short bitsPerPixel = readU16(&buf); - buf.seek(0x20, WPX_SEEK_SET); - unsigned numPaletteColors = readU32(&buf); + buf->seek(0x0E, WPX_SEEK_SET); + unsigned short bitsPerPixel = readU16(buf); + buf->seek(0x20, WPX_SEEK_SET); + unsigned numPaletteColors = readU32(buf); if (numPaletteColors == 0 && bitsPerPixel <= 8) { numPaletteColors = 1; diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 4913493..a7f6be6 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -18,7 +18,6 @@ libmspub_@MSPUB_MAJOR_VERSION@_@MSPUB_MINOR_VERSION@_la_DEPENDENCIES = @LIBMSPUB libmspub_@MSPUB_MAJOR_VERSION@_@MSPUB_MINOR_VERSION@_la_LDFLAGS = $(version_info) -export-dynamic -no-undefined libmspub_@MSPUB_MAJOR_VERSION@_@MSPUB_MINOR_VERSION@_la_SOURCES = \ MSPUBCollector.cpp \ - MSPUBInternalStream.cpp \ MSPUBDocument.cpp \ MSPUBParser.cpp \ MSPUBParser2k.cpp \ @@ -41,7 +40,6 @@ libmspub_@MSPUB_MAJOR_VERSION@_@MSPUB_MINOR_VERSION@_la_SOURCES = \ MSPUBCollector.h \ MSPUBConstants.h \ MSPUBContentChunkType.h \ - MSPUBInternalStream.h \ MSPUBParser.h \ MSPUBParser2k.h \ MSPUBSVGGenerator.h \
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits