diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2010-02-12 16:56:44 +0100 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2010-02-12 16:56:44 +0100 |
commit | db02ac8b89b8ec1e3d84f2676665667916582423 (patch) | |
tree | 55446fdc25ea149952589d200fb6b4224a6996f8 /shell | |
parent | ae19e5feff59f578d3f8de6fe9c27f9a57ba63d1 (diff) |
changefileheader2: #i10000#: convert files with CR/LF characters to CR only
Diffstat (limited to 'shell')
-rw-r--r-- | shell/inc/internal/basereader.hxx | 2 | ||||
-rw-r--r-- | shell/inc/internal/contentreader.hxx | 2 | ||||
-rw-r--r-- | shell/inc/internal/metainforeader.hxx | 2 | ||||
-rw-r--r-- | shell/inc/internal/types.hxx | 4 | ||||
-rw-r--r-- | shell/inc/internal/zipfile.hxx | 12 | ||||
-rw-r--r-- | shell/source/all/ooofilereader/basereader.cxx | 16 | ||||
-rw-r--r-- | shell/source/all/ooofilereader/contentreader.cxx | 42 | ||||
-rw-r--r-- | shell/source/all/ooofilereader/metainforeader.cxx | 84 | ||||
-rw-r--r-- | shell/source/all/zipfile/makefile.mk | 2 | ||||
-rw-r--r-- | shell/source/all/zipfile/zipfile.cxx | 32 | ||||
-rw-r--r-- | shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx | 400 | ||||
-rw-r--r-- | shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx | 52 |
12 files changed, 325 insertions, 325 deletions
diff --git a/shell/inc/internal/basereader.hxx b/shell/inc/internal/basereader.hxx index 8aef93528806..fcdf1cdd7dff 100644 --- a/shell/inc/internal/basereader.hxx +++ b/shell/inc/internal/basereader.hxx @@ -47,7 +47,7 @@ public: protected: // protected because its only an implementation relevant class CBaseReader( const std::string& DocumentName ); - CBaseReader( void* stream, zlib_filefunc_def* fa );
+ CBaseReader( void* stream, zlib_filefunc_def* fa ); virtual void start_document(); diff --git a/shell/inc/internal/contentreader.hxx b/shell/inc/internal/contentreader.hxx index b4ed30970c46..63b0c550c534 100644 --- a/shell/inc/internal/contentreader.hxx +++ b/shell/inc/internal/contentreader.hxx @@ -40,7 +40,7 @@ public: //CContentReader( const std::string& DocumentName ); CContentReader( const std::string& DocumentName, LocaleSet_t const & DocumentLocale ); - CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa );
+ CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa ); /** Get the chunkbuffer. diff --git a/shell/inc/internal/metainforeader.hxx b/shell/inc/internal/metainforeader.hxx index e936acc71d41..ea29dff07c80 100644 --- a/shell/inc/internal/metainforeader.hxx +++ b/shell/inc/internal/metainforeader.hxx @@ -43,7 +43,7 @@ public: CMetaInfoReader( const std::string& DocumentName ); - CMetaInfoReader( void* stream, zlib_filefunc_def* fa);
+ CMetaInfoReader( void* stream, zlib_filefunc_def* fa); /** check if the Tag is in the target meta.xml file. diff --git a/shell/inc/internal/types.hxx b/shell/inc/internal/types.hxx index d636595537e4..c11692912aec 100644 --- a/shell/inc/internal/types.hxx +++ b/shell/inc/internal/types.hxx @@ -33,8 +33,8 @@ #include <utility> #include <vector> #include <stack> -#include <external/zlib/zlib.h>
-#include <external/zlib/ioapi.h>
+#include <external/zlib/zlib.h> +#include <external/zlib/ioapi.h> typedef std::vector<std::wstring> StringList_t; diff --git a/shell/inc/internal/zipfile.hxx b/shell/inc/internal/zipfile.hxx index d349f0294d11..a3e3575082c0 100644 --- a/shell/inc/internal/zipfile.hxx +++ b/shell/inc/internal/zipfile.hxx @@ -32,9 +32,9 @@ #define _WINDOWS #endif -
-#include <external/zlib/unzip.h>
-
+ +#include <external/zlib/unzip.h> + #include <string> #include <vector> @@ -68,7 +68,7 @@ public: */ static bool IsZipFile(const std::string& FileName); - static bool IsZipFile(void* stream);
+ static bool IsZipFile(void* stream); /** Returns wheter the version of the specified zip file may be uncompressed with the @@ -88,7 +88,7 @@ public: */ static bool IsValidZipFileVersionNumber(const std::string& FileName); - static bool IsValidZipFileVersionNumber(void* stream);
+ static bool IsValidZipFileVersionNumber(void* stream); public: @@ -106,7 +106,7 @@ public: */ ZipFile(const std::string& FileName); - ZipFile(void* stream, zlib_filefunc_def* fa);
+ ZipFile(void* stream, zlib_filefunc_def* fa); /** Destroys a zip file diff --git a/shell/source/all/ooofilereader/basereader.cxx b/shell/source/all/ooofilereader/basereader.cxx index 17c35268680e..2fc4a0c79297 100644 --- a/shell/source/all/ooofilereader/basereader.cxx +++ b/shell/source/all/ooofilereader/basereader.cxx @@ -47,14 +47,14 @@ m_ZipFile( DocumentName ) // //------------------------------ -CBaseReader::CBaseReader(void * sw, zlib_filefunc_def* fa):
-m_ZipFile( sw , fa )
-{
-}
-
-//------------------------------
-//
-//------------------------------
+CBaseReader::CBaseReader(void * sw, zlib_filefunc_def* fa): +m_ZipFile( sw , fa ) +{ +} + +//------------------------------ +// +//------------------------------ CBaseReader::~CBaseReader() { diff --git a/shell/source/all/ooofilereader/contentreader.cxx b/shell/source/all/ooofilereader/contentreader.cxx index 9cb841eef0fc..4afb278ff2c8 100644 --- a/shell/source/all/ooofilereader/contentreader.cxx +++ b/shell/source/all/ooofilereader/contentreader.cxx @@ -58,27 +58,27 @@ CBaseReader( DocumentName ) } } -CContentReader::CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa ) :
-CBaseReader( stream, fa )
-{
-try
- {
- m_DefaultLocale = DocumentLocale;
- Initialize( DOC_CONTENT_NAME );
- }
- catch(xml_parser_exception&
- #if OSL_DEBUG_LEVEL > 0
- ex
- #endif
- )
- {
- ENSURE(false, ex.what());
- }
- catch(...)
- {
- ENSURE(false, "Unknown error");
- }
-}
+CContentReader::CContentReader( void* stream, LocaleSet_t const & DocumentLocale, zlib_filefunc_def* fa ) : +CBaseReader( stream, fa ) +{ +try + { + m_DefaultLocale = DocumentLocale; + Initialize( DOC_CONTENT_NAME ); + } + catch(xml_parser_exception& + #if OSL_DEBUG_LEVEL > 0 + ex + #endif + ) + { + ENSURE(false, ex.what()); + } + catch(...) + { + ENSURE(false, "Unknown error"); + } +} /** destructor. diff --git a/shell/source/all/ooofilereader/metainforeader.cxx b/shell/source/all/ooofilereader/metainforeader.cxx index ba61c031660c..24e59f6845da 100644 --- a/shell/source/all/ooofilereader/metainforeader.cxx +++ b/shell/source/all/ooofilereader/metainforeader.cxx @@ -77,48 +77,48 @@ CBaseReader( DocumentName ) } } -CMetaInfoReader::CMetaInfoReader( void* stream, zlib_filefunc_def* fa) :
-CBaseReader( stream, fa)
-{
-try
- {
- m_pKeywords_Builder = new CKeywordsTag( );
- m_pSimple_Builder = new CSimpleTag( );
- m_pDummy_Builder = new CDummyTag( );
-
- //retrieve all infomation that is useful
- m_AllMetaInfo[META_INFO_AUTHOR] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_TITLE] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_SUBJECT] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_KEYWORDS] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_DESCRIPTION] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_DOCUMENT_STATISTIC] = EMPTY_XML_TAG;
-
- m_AllMetaInfo[META_INFO_GENERATOR] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_CREATION] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_CREATOR] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_MODIFIED] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_LANGUAGE] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_DOCUMENT_NUMBER] = EMPTY_XML_TAG;
- m_AllMetaInfo[META_INFO_EDITING_TIME] = EMPTY_XML_TAG;
-
- Initialize( META_CONTENT_NAME );
- }
- catch(xml_parser_exception&
- #if OSL_DEBUG_LEVEL > 0
- ex
- #endif
- )
- {
- ENSURE(false, ex.what());
- }
- catch(...)
- {
- ENSURE(false, "Unknown error");
- }
-
-}
-
+CMetaInfoReader::CMetaInfoReader( void* stream, zlib_filefunc_def* fa) : +CBaseReader( stream, fa) +{ +try + { + m_pKeywords_Builder = new CKeywordsTag( ); + m_pSimple_Builder = new CSimpleTag( ); + m_pDummy_Builder = new CDummyTag( ); + + //retrieve all infomation that is useful + m_AllMetaInfo[META_INFO_AUTHOR] = EMPTY_XML_TAG; + m_AllMetaInfo[META_INFO_TITLE] = EMPTY_XML_TAG; + m_AllMetaInfo[META_INFO_SUBJECT] = EMPTY_XML_TAG; + m_AllMetaInfo[META_INFO_KEYWORDS] = EMPTY_XML_TAG; + m_AllMetaInfo[META_INFO_DESCRIPTION] = EMPTY_XML_TAG; + m_AllMetaInfo[META_INFO_DOCUMENT_STATISTIC] = EMPTY_XML_TAG; + + m_AllMetaInfo[META_INFO_GENERATOR] = EMPTY_XML_TAG; + m_AllMetaInfo[META_INFO_CREATION] = EMPTY_XML_TAG; + m_AllMetaInfo[META_INFO_CREATOR] = EMPTY_XML_TAG; + m_AllMetaInfo[META_INFO_MODIFIED] = EMPTY_XML_TAG; + m_AllMetaInfo[META_INFO_LANGUAGE] = EMPTY_XML_TAG; + m_AllMetaInfo[META_INFO_DOCUMENT_NUMBER] = EMPTY_XML_TAG; + m_AllMetaInfo[META_INFO_EDITING_TIME] = EMPTY_XML_TAG; + + Initialize( META_CONTENT_NAME ); + } + catch(xml_parser_exception& + #if OSL_DEBUG_LEVEL > 0 + ex + #endif + ) + { + ENSURE(false, ex.what()); + } + catch(...) + { + ENSURE(false, "Unknown error"); + } + +} + /** destructor. */ diff --git a/shell/source/all/zipfile/makefile.mk b/shell/source/all/zipfile/makefile.mk index 2b77e5c3ae2b..9e16a7afe4dc 100644 --- a/shell/source/all/zipfile/makefile.mk +++ b/shell/source/all/zipfile/makefile.mk @@ -29,7 +29,7 @@ PRJ=..$/..$/.. PRJNAME=shell TARGET=zipfile ENABLE_EXCEPTIONS=TRUE -EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE diff --git a/shell/source/all/zipfile/zipfile.cxx b/shell/source/all/zipfile/zipfile.cxx index d4ff929c7788..96dd7922ec08 100644 --- a/shell/source/all/zipfile/zipfile.cxx +++ b/shell/source/all/zipfile/zipfile.cxx @@ -76,10 +76,10 @@ bool ZipFile::IsZipFile(const std::string& /*FileName*/) return true; } -bool ZipFile::IsZipFile(void* /*stream*/)
-{
- return true;
-}
+bool ZipFile::IsZipFile(void* /*stream*/) +{ + return true; +} /** Returns wheter the version of the specified zip file may be uncompressed with the @@ -102,10 +102,10 @@ bool ZipFile::IsValidZipFileVersionNumber(const std::string& /*FileName*/) return true; } -bool ZipFile::IsValidZipFileVersionNumber(void* /* stream*/)
-{
- return true;
-}
+bool ZipFile::IsValidZipFileVersionNumber(void* /* stream*/) +{ + return true; +} /** Constructs a zip file from a zip file @@ -128,14 +128,14 @@ ZipFile::ZipFile(const std::string& FileName) throw IOException(-1); } -ZipFile::ZipFile(void* stream, zlib_filefunc_def* fa)
-{
- fa->opaque = stream;
- m_uzFile = unzOpen2((const char *)NULL, fa);
-
- if (0 == m_uzFile)
- throw IOException(-1);
-}
+ZipFile::ZipFile(void* stream, zlib_filefunc_def* fa) +{ + fa->opaque = stream; + m_uzFile = unzOpen2((const char *)NULL, fa); + + if (0 == m_uzFile) + throw IOException(-1); +} /** Destroys a zip file diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx index 0cfc8eaaae01..d04f98e537b6 100644 --- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx +++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx @@ -75,8 +75,8 @@ #include <ntquery.h> #include "assert.h" #include "ooofilt.hxx" -#include <objidl.h>
-#include <stdio.h>
+#include <objidl.h> +#include <stdio.h> #include "propspec.hxx" #ifdef __MINGW32__ #include <algorithm> @@ -117,7 +117,7 @@ COooFilter::COooFilter() : m_ChunkPosition(0), m_cAttributes(0), m_pAttributes(0), - m_pStream(NULL)
+ m_pStream(NULL) { InterlockedIncrement( &g_lInstances ); @@ -173,8 +173,8 @@ SCODE STDMETHODCALLTYPE COooFilter::QueryInterface( pUnkTemp = (IUnknown *)(IPersistFile *)this; else if ( IID_IPersist == riid ) pUnkTemp = (IUnknown *)(IPersist *)(IPersistFile *)this; - else if (IID_IPersistStream == riid)
- pUnkTemp = (IUnknown *)(IPersistStream *)this;
+ else if (IID_IPersistStream == riid) + pUnkTemp = (IUnknown *)(IPersistStream *)this; else if ( IID_IUnknown == riid ) pUnkTemp = (IUnknown *)(IPersist *)(IPersistFile *)this; else @@ -717,99 +717,99 @@ SCODE STDMETHODCALLTYPE COooFilter::SaveCompleted(LPCWSTR /*pszFileName*/) return S_OK; } -//M-------------------------------------------------------------------------
-//
-// Method: COooFilter::Load (IPersistStream::Load)
-//
-// Summary: Initializes an object from the stream where it was previously saved
-//
-// Arguments: pStm
-// [in] Pointer to stream from which object should be loaded
-//
-//
-// Returns: S_OK
-// E_OUTOFMEMORY
-// E_FAIL
-//
-//
-//--------------------------------------------------------------------------
-SCODE STDMETHODCALLTYPE COooFilter::Load(IStream *pStm)
-{
-
- // These next few lines work around the "Seek pointer" bug found on Vista.
-
- char buf[20];
- unsigned long count;
- HRESULT hr;
- ULARGE_INTEGER NewPosition;
- LARGE_INTEGER Move;
- Move.QuadPart = 0;
- hr = pStm->Seek (Move, STREAM_SEEK_SET, &NewPosition);
- hr = pStm->Read (buf, 20, &count);
-
- zlib_filefunc_def z_filefunc;
- fill_stream_filefunc (&z_filefunc);
- z_filefunc.opaque = (void*)pStm;
-
- m_pStream = pStm;
-
- try
- {
- if (m_pMetaInfoReader)
- delete m_pMetaInfoReader;
- m_pMetaInfoReader = new CMetaInfoReader((void*)m_pStream, &z_filefunc);
-
- if (m_pContentReader)
- delete m_pContentReader;
- m_pContentReader = new CContentReader((void*)m_pStream, m_pMetaInfoReader->getDefaultLocale(), &z_filefunc);
- }
- catch (const std::exception&)
- {
- return E_FAIL;
- }
- return S_OK;
-}
-
-//M-------------------------------------------------------------------------
-//
-// Method: COooFilter::GetSizeMax (IPersistStream::GetSizeMax)
-//
-// Summary: Returns the size in bytes of the stream neede to save the object.
-//
-// Arguments: pcbSize
-// [out] Pointer to a 64 bit unsigned int indicating the size needed
-//
-// Returns: E_NOTIMPL
-//
-//
-//--------------------------------------------------------------------------
-SCODE STDMETHODCALLTYPE COooFilter::GetSizeMax(ULARGE_INTEGER * /*pcbSize*/)
-{
- //
- return E_NOTIMPL;
-}
-
-//M-------------------------------------------------------------------------
-//
-// Method: COooFilter::Save (IPersistStream::Save)
-//
-// Summary: Save object to specified stream
-//
-// Arguments: pStm
-// [in] Pointer to stream
-//
-// fClearDirty
-// [in] Indicates whether to clear dirty flag
-//
-// Returns: E_NOTIMPL
-//
-//
-//--------------------------------------------------------------------------
-SCODE STDMETHODCALLTYPE COooFilter::Save(IStream * /*pStm*/, BOOL )
-{
- //
- return E_NOTIMPL;
-}
+//M------------------------------------------------------------------------- +// +// Method: COooFilter::Load (IPersistStream::Load) +// +// Summary: Initializes an object from the stream where it was previously saved +// +// Arguments: pStm +// [in] Pointer to stream from which object should be loaded +// +// +// Returns: S_OK +// E_OUTOFMEMORY +// E_FAIL +// +// +//-------------------------------------------------------------------------- +SCODE STDMETHODCALLTYPE COooFilter::Load(IStream *pStm) +{ + + // These next few lines work around the "Seek pointer" bug found on Vista. + + char buf[20]; + unsigned long count; + HRESULT hr; + ULARGE_INTEGER NewPosition; + LARGE_INTEGER Move; + Move.QuadPart = 0; + hr = pStm->Seek (Move, STREAM_SEEK_SET, &NewPosition); + hr = pStm->Read (buf, 20, &count); + + zlib_filefunc_def z_filefunc; + fill_stream_filefunc (&z_filefunc); + z_filefunc.opaque = (void*)pStm; + + m_pStream = pStm; + + try + { + if (m_pMetaInfoReader) + delete m_pMetaInfoReader; + m_pMetaInfoReader = new CMetaInfoReader((void*)m_pStream, &z_filefunc); + + if (m_pContentReader) + delete m_pContentReader; + m_pContentReader = new CContentReader((void*)m_pStream, m_pMetaInfoReader->getDefaultLocale(), &z_filefunc); + } + catch (const std::exception&) + { + return E_FAIL; + } + return S_OK; +} + +//M------------------------------------------------------------------------- +// +// Method: COooFilter::GetSizeMax (IPersistStream::GetSizeMax) +// +// Summary: Returns the size in bytes of the stream neede to save the object. +// +// Arguments: pcbSize +// [out] Pointer to a 64 bit unsigned int indicating the size needed +// +// Returns: E_NOTIMPL +// +// +//-------------------------------------------------------------------------- +SCODE STDMETHODCALLTYPE COooFilter::GetSizeMax(ULARGE_INTEGER * /*pcbSize*/) +{ + // + return E_NOTIMPL; +} + +//M------------------------------------------------------------------------- +// +// Method: COooFilter::Save (IPersistStream::Save) +// +// Summary: Save object to specified stream +// +// Arguments: pStm +// [in] Pointer to stream +// +// fClearDirty +// [in] Indicates whether to clear dirty flag +// +// Returns: E_NOTIMPL +// +// +//-------------------------------------------------------------------------- +SCODE STDMETHODCALLTYPE COooFilter::Save(IStream * /*pStm*/, BOOL ) +{ + // + return E_NOTIMPL; +} //M------------------------------------------------------------------------- // @@ -1244,13 +1244,13 @@ namespace /* private */ if (!SetRegistryKey(HKEY_CLASSES_ROOT, ClsidEntry_Persist.c_str(), "", "OpenOffice.org Persistent Handler")) return E_FAIL; - // Add missing entry
- std::string ClsidEntry_Persist_Entry = CLSID_PERSIST_ENTRY;
- SubstitutePlaceholder(ClsidEntry_Persist_Entry,
- GUID_PLACEHOLDER,
- ClsidToString(PersistentGuid));
-
- if (!SetRegistryKey(HKEY_CLASSES_ROOT, ClsidEntry_Persist_Entry.c_str(), "", ClsidToString(PersistentGuid).c_str()));
+ // Add missing entry + std::string ClsidEntry_Persist_Entry = CLSID_PERSIST_ENTRY; + SubstitutePlaceholder(ClsidEntry_Persist_Entry, + GUID_PLACEHOLDER, + ClsidToString(PersistentGuid)); + + if (!SetRegistryKey(HKEY_CLASSES_ROOT, ClsidEntry_Persist_Entry.c_str(), "", ClsidToString(PersistentGuid).c_str())); std::string ClsidEntry_Persist_Addin = CLSID_GUID_PERSIST_ADDIN_ENTRY; @@ -1502,99 +1502,99 @@ STDAPI DllUnregisterServer() return S_OK; } -extern "C" {
-
- // IStream callback
- voidpf ZCALLBACK cb_sopen (voidpf opaque, const char* filename, int mode) {
- return opaque;
- }
-
- uLong ZCALLBACK cb_sread (voidpf opaque, voidpf stream, void* buf, uLong size) {
- unsigned long newsize;
- HRESULT hr;
-
- hr = ((IStream *)stream)->Read (buf, size, &newsize);
- if (hr == S_OK){
- return (unsigned long)newsize;
- }
- else {
- return (uLong)0;
- }
- }
-
- long ZCALLBACK cb_sseek (voidpf opaque, voidpf stream, uLong offset, int origin) {
- // IStream::Seek parameters
- HRESULT hr;
- LARGE_INTEGER Move;
- DWORD dwOrigin;
- Move.QuadPart = (__int64)offset;
-
- switch (origin) {
- case SEEK_CUR:
- dwOrigin = STREAM_SEEK_CUR;
- break;
- case SEEK_END:
- dwOrigin = STREAM_SEEK_END;
- break;
- case SEEK_SET:
- dwOrigin = STREAM_SEEK_SET;
- break;
- default:
- return -1;
- }
-
- hr = ((IStream*)stream)->Seek (Move, dwOrigin, NULL);
- if (hr == S_OK){
- return 0;
- }
- else {
- return -1;
- }
- }
-
- long ZCALLBACK cb_stell (voidpf opaque, voidpf stream) {
- // IStream::Seek parameters
- HRESULT hr;
- LARGE_INTEGER Move;
- ULARGE_INTEGER NewPosition;
- Move.QuadPart = 0;
- NewPosition.QuadPart = 0;
-
- hr = ((IStream*)stream)->Seek (Move, STREAM_SEEK_CUR, &NewPosition);
- if (hr == S_OK){
- return (long) NewPosition.QuadPart;
- }
- else {
- return -1;
- }
- }
-
- int ZCALLBACK cb_sclose (voidpf opaque, voidpf stream) {
- return 0;
- }
-
- int ZCALLBACK cb_serror (voidpf opaque, voidpf stream) {
- return 0; //RJK - for now
- }
-
- uLong ZCALLBACK cb_swrite (voidpf opaque, voidpf stream, const void* buf, uLong size) {
- HRESULT hr;
- unsigned long writecount;
- hr = ((IStream*)stream)->Write (buf, size, &writecount);
- if (hr == S_OK)
- return (unsigned int)writecount;
- else
- return (uLong)0;
- }
-
- void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def) {
- pzlib_filefunc_def->zopen_file = cb_sopen;
- pzlib_filefunc_def->zread_file = cb_sread;
- pzlib_filefunc_def->zwrite_file = cb_swrite;
- pzlib_filefunc_def->ztell_file = cb_stell;
- pzlib_filefunc_def->zseek_file = cb_sseek;
- pzlib_filefunc_def->zclose_file = cb_sclose;
- pzlib_filefunc_def->zerror_file = cb_serror;
- }
-}
+extern "C" { + + // IStream callback + voidpf ZCALLBACK cb_sopen (voidpf opaque, const char* filename, int mode) { + return opaque; + } + + uLong ZCALLBACK cb_sread (voidpf opaque, voidpf stream, void* buf, uLong size) { + unsigned long newsize; + HRESULT hr; + + hr = ((IStream *)stream)->Read (buf, size, &newsize); + if (hr == S_OK){ + return (unsigned long)newsize; + } + else { + return (uLong)0; + } + } + + long ZCALLBACK cb_sseek (voidpf opaque, voidpf stream, uLong offset, int origin) { + // IStream::Seek parameters + HRESULT hr; + LARGE_INTEGER Move; + DWORD dwOrigin; + Move.QuadPart = (__int64)offset; + + switch (origin) { + case SEEK_CUR: + dwOrigin = STREAM_SEEK_CUR; + break; + case SEEK_END: + dwOrigin = STREAM_SEEK_END; + break; + case SEEK_SET: + dwOrigin = STREAM_SEEK_SET; + break; + default: + return -1; + } + + hr = ((IStream*)stream)->Seek (Move, dwOrigin, NULL); + if (hr == S_OK){ + return 0; + } + else { + return -1; + } + } + + long ZCALLBACK cb_stell (voidpf opaque, voidpf stream) { + // IStream::Seek parameters + HRESULT hr; + LARGE_INTEGER Move; + ULARGE_INTEGER NewPosition; + Move.QuadPart = 0; + NewPosition.QuadPart = 0; + + hr = ((IStream*)stream)->Seek (Move, STREAM_SEEK_CUR, &NewPosition); + if (hr == S_OK){ + return (long) NewPosition.QuadPart; + } + else { + return -1; + } + } + + int ZCALLBACK cb_sclose (voidpf opaque, voidpf stream) { + return 0; + } + + int ZCALLBACK cb_serror (voidpf opaque, voidpf stream) { + return 0; //RJK - for now + } + + uLong ZCALLBACK cb_swrite (voidpf opaque, voidpf stream, const void* buf, uLong size) { + HRESULT hr; + unsigned long writecount; + hr = ((IStream*)stream)->Write (buf, size, &writecount); + if (hr == S_OK) + return (unsigned int)writecount; + else + return (uLong)0; + } + + void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def) { + pzlib_filefunc_def->zopen_file = cb_sopen; + pzlib_filefunc_def->zread_file = cb_sread; + pzlib_filefunc_def->zwrite_file = cb_swrite; + pzlib_filefunc_def->ztell_file = cb_stell; + pzlib_filefunc_def->zseek_file = cb_sseek; + pzlib_filefunc_def->zclose_file = cb_sclose; + pzlib_filefunc_def->zerror_file = cb_serror; + } +} diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx index 8e14141d7e02..a661609eb803 100644 --- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx +++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx @@ -93,7 +93,7 @@ enum FilterState FilteringContent, // Filtering the content property FilteringProperty // Filtering the pseudo property }; -class COooFilter : public IFilter, public IPersistFile, public IPersistStream
+class COooFilter : public IFilter, public IPersistFile, public IPersistStream { public: // From IUnknown @@ -140,16 +140,16 @@ public: virtual SCODE STDMETHODCALLTYPE GetCurFile( LPWSTR * ppszFileName); - // From IPersistStream
- virtual SCODE STDMETHODCALLTYPE Load(
- IStream *pStm);
-
- virtual SCODE STDMETHODCALLTYPE Save(
- IStream *pStm,
- BOOL fClearDirty);
-
- virtual SCODE STDMETHODCALLTYPE GetSizeMax(
- ULARGE_INTEGER *pcbSize);
+ // From IPersistStream + virtual SCODE STDMETHODCALLTYPE Load( + IStream *pStm); + + virtual SCODE STDMETHODCALLTYPE Save( + IStream *pStm, + BOOL fClearDirty); + + virtual SCODE STDMETHODCALLTYPE GetSizeMax( + ULARGE_INTEGER *pcbSize); private: @@ -174,7 +174,7 @@ private: ULONG m_ChunkPosition; // Chunk pointer to specify the current Chunk; ULONG m_cAttributes; // Count of attributes CFullPropSpec * m_pAttributes; // Attributes to filter - IStream * m_pStream;
+ IStream * m_pStream; }; @@ -217,20 +217,20 @@ private: long m_lRefs; // Reference count }; -extern "C" {
-
- voidpf ZCALLBACK cb_sopen OF((voidpf opaque, const char * filename, int mode));
- uLong ZCALLBACK cb_sread OF((voidpf opaque, voidpf stream, void* vuf, uLong size));
- uLong ZCALLBACK cb_swrite OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
- long ZCALLBACK cb_stell OF((voidpf opaque, voidpf stream));
- long ZCALLBACK cb_sseek OF((voidpf opaque, voidpf stream, uLong offset, int origin));
- int ZCALLBACK cb_sclose OF((voidpf opaque, voidpf stream));
- int ZCALLBACK cb_serror OF((voidpf opaque, voidpf stream));
-
- void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def);
-
-}
-
+extern "C" { + + voidpf ZCALLBACK cb_sopen OF((voidpf opaque, const char * filename, int mode)); + uLong ZCALLBACK cb_sread OF((voidpf opaque, voidpf stream, void* vuf, uLong size)); + uLong ZCALLBACK cb_swrite OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); + long ZCALLBACK cb_stell OF((voidpf opaque, voidpf stream)); + long ZCALLBACK cb_sseek OF((voidpf opaque, voidpf stream, uLong offset, int origin)); + int ZCALLBACK cb_sclose OF((voidpf opaque, voidpf stream)); + int ZCALLBACK cb_serror OF((voidpf opaque, voidpf stream)); + + void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def); + +} + |