tdf#123936 Formatting files in module shell with clang-format

Change-Id: Iba0c34cff0e04b18a3b4c5b7bb2aa42e14aedb81
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105707
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
This commit is contained in:
Philipp Hofer
2020-11-12 13:16:05 +01:00
committed by Christian Lohmaier
parent 02d65d7a19
commit 7c9a2c4b97
18 changed files with 111 additions and 176 deletions

View File

@@ -10,10 +10,8 @@
#ifndef INCLUDED_SHELL_INC_INTERNAL_FILEPATH_HXX #ifndef INCLUDED_SHELL_INC_INTERNAL_FILEPATH_HXX
#define INCLUDED_SHELL_INC_INTERNAL_FILEPATH_HXX #define INCLUDED_SHELL_INC_INTERNAL_FILEPATH_HXX
// typedefs to allow using Unicode paths on Windows // typedefs to allow using Unicode paths on Windows
#include <string> #include <string>
#if defined _WIN32 #if defined _WIN32

View File

@@ -21,7 +21,7 @@
#define INCLUDED_SHELL_INC_INTERNAL_GLOBAL_HXX #define INCLUDED_SHELL_INC_INTERNAL_GLOBAL_HXX
#if !defined WIN32_LEAN_AND_MEAN #if !defined WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#include <windows.h> #include <windows.h>

View File

@@ -22,7 +22,6 @@
#include <string> #include <string>
/* Converts ISO 8601 compliant date/time /* Converts ISO 8601 compliant date/time
representation to the representation representation to the representation
conforming to the current locale, conforming to the current locale,
@@ -30,7 +29,6 @@
*/ */
std::wstring iso8601_date_to_local_date(const std::wstring& iso8601date); std::wstring iso8601_date_to_local_date(const std::wstring& iso8601date);
/* Converts ISO 8601 compliant duration /* Converts ISO 8601 compliant duration
representation to the representation representation to the representation
conforming to the current locale conforming to the current locale

View File

@@ -35,9 +35,9 @@ class CMetaInfoReader : public CBaseReader
public: public:
virtual ~CMetaInfoReader() override; virtual ~CMetaInfoReader() override;
CMetaInfoReader( const Filepath_t& DocumentName ); CMetaInfoReader(const Filepath_t& DocumentName);
CMetaInfoReader( StreamInterface* stream ); CMetaInfoReader(StreamInterface* stream);
/** check if the Tag is in the target meta.xml file. /** check if the Tag is in the target meta.xml file.
@@ -46,7 +46,6 @@ public:
*/ */
bool hasTag(const std::wstring& TagName) const; bool hasTag(const std::wstring& TagName) const;
/** Get a specific tag content, compound tags will be returned as comma separated list. /** Get a specific tag content, compound tags will be returned as comma separated list.
@param TagName @param TagName
@@ -61,7 +60,7 @@ public:
@param AttributeName @param AttributeName
the name of the attribute. the name of the attribute.
*/ */
bool hasTagAttribute(const std::wstring& TagName, const std::wstring& AttributeName); bool hasTagAttribute(const std::wstring& TagName, const std::wstring& AttributeName);
/** Get a specific attribute content. /** Get a specific attribute content.
@@ -70,14 +69,13 @@ public:
@param AttributeName @param AttributeName
the name of the attribute. the name of the attribute.
*/ */
std::wstring getTagAttribute(const std::wstring& TagName, const std::wstring& AttributeName); std::wstring getTagAttribute(const std::wstring& TagName, const std::wstring& AttributeName);
/** Get the default language of the whole document. /** Get the default language of the whole document.
*/ */
LocaleSet_t getDefaultLocale( ); LocaleSet_t getDefaultLocale();
protected: // protected because its only an implementation relevant class protected: // protected because its only an implementation relevant class
/** start_element occurs when a tag is start. /** start_element occurs when a tag is start.
@param raw_name @param raw_name
@@ -87,10 +85,8 @@ protected: // protected because its only an implementation relevant class
@param attributes @param attributes
attribute structure. attribute structure.
*/ */
virtual void start_element( virtual void start_element(const string_t& raw_name, const string_t& local_name,
const string_t& raw_name, const xml_tag_attribute_container_t& attributes) override;
const string_t& local_name,
const xml_tag_attribute_container_t& attributes) override;
/** end_element occurs when a tag is closed /** end_element occurs when a tag is closed
@@ -99,8 +95,7 @@ protected: // protected because its only an implementation relevant class
@param local_name @param local_name
local name of the tag. local name of the tag.
*/ */
virtual void end_element( virtual void end_element(const string_t& raw_name, const string_t& local_name) override;
const string_t& raw_name, const string_t& local_name) override;
/** characters occurs when receiving characters /** characters occurs when receiving characters
@@ -117,25 +112,24 @@ protected:
@param XmlAttributes @param XmlAttributes
attribute structure of the tag to save in. attribute structure of the tag to save in.
*/ */
ITag* chooseTagReader( ITag* chooseTagReader(const std::wstring& tag_name, const XmlTagAttributes_t& XmlAttributes);
const std::wstring& tag_name, const XmlTagAttributes_t& XmlAttributes );
/** save the received content into structure. /** save the received content into structure.
@param tag_name @param tag_name
the name of the tag. the name of the tag.
*/ */
void saveTagContent( const std::wstring& tag_name ); void saveTagContent(const std::wstring& tag_name);
private: private:
XmlTags_t m_AllMetaInfo; XmlTags_t m_AllMetaInfo;
private: private:
std::stack<ITag*> m_TagBuilderStack; std::stack<ITag*> m_TagBuilderStack;
private: private:
CKeywordsTag* m_pKeywords_Builder; CKeywordsTag* m_pKeywords_Builder;
CDummyTag* m_pDummy_Builder; CDummyTag* m_pDummy_Builder;
CSimpleTag* m_pSimple_Builder; CSimpleTag* m_pSimple_Builder;
}; };

View File

@@ -23,20 +23,20 @@
#include <objbase.h> #include <objbase.h>
// {087B3AE3-E237-4467-B8DB-5A38AB959AC9} // {087B3AE3-E237-4467-B8DB-5A38AB959AC9}
const CLSID CLSID_INFOTIP_HANDLER = const CLSID CLSID_INFOTIP_HANDLER
{0x87b3ae3, 0xe237, 0x4467, {0xb8, 0xdb, 0x5a, 0x38, 0xab, 0x95, 0x9a, 0xc9}}; = { 0x87b3ae3, 0xe237, 0x4467, { 0xb8, 0xdb, 0x5a, 0x38, 0xab, 0x95, 0x9a, 0xc9 } };
// {C52AF81D-F7A0-4aab-8E87-F80A60CCD396} // {C52AF81D-F7A0-4aab-8E87-F80A60CCD396}
const CLSID CLSID_COLUMN_HANDLER = const CLSID CLSID_COLUMN_HANDLER
{ 0xc52af81d, 0xf7a0, 0x4aab, { 0x8e, 0x87, 0xf8, 0xa, 0x60, 0xcc, 0xd3, 0x96 } }; = { 0xc52af81d, 0xf7a0, 0x4aab, { 0x8e, 0x87, 0xf8, 0xa, 0x60, 0xcc, 0xd3, 0x96 } };
// {63542C48-9552-494a-84F7-73AA6A7C99C1} // {63542C48-9552-494a-84F7-73AA6A7C99C1}
const CLSID CLSID_PROPERTYSHEET_HANDLER = const CLSID CLSID_PROPERTYSHEET_HANDLER
{ 0x63542c48, 0x9552, 0x494a, { 0x84, 0xf7, 0x73, 0xaa, 0x6a, 0x7c, 0x99, 0xc1 } }; = { 0x63542c48, 0x9552, 0x494a, { 0x84, 0xf7, 0x73, 0xaa, 0x6a, 0x7c, 0x99, 0xc1 } };
// {3B092F0C-7696-40e3-A80F-68D74DA84210} // {3B092F0C-7696-40e3-A80F-68D74DA84210}
const CLSID CLSID_THUMBVIEWER_HANDLER = const CLSID CLSID_THUMBVIEWER_HANDLER
{ 0x3b092f0c, 0x7696, 0x40e3, { 0xa8, 0xf, 0x68, 0xd7, 0x4d, 0xa8, 0x42, 0x10 } }; = { 0x3b092f0c, 0x7696, 0x40e3, { 0xa8, 0xf, 0x68, 0xd7, 0x4d, 0xa8, 0x42, 0x10 } };
extern HINSTANCE g_hModule; extern HINSTANCE g_hModule;

View File

@@ -28,25 +28,27 @@ struct IStream;
class BufferStream : public StreamInterface class BufferStream : public StreamInterface
{ {
public: public:
BufferStream(IStream *str); BufferStream(IStream* str);
~BufferStream() override; ~BufferStream() override;
unsigned long sread (unsigned char *vuf, unsigned long size) override; unsigned long sread(unsigned char* vuf, unsigned long size) override;
long stell () override; long stell() override;
long sseek (long offset, int origin) override; long sseek(long offset, int origin) override;
private: private:
IStream *stream; IStream* stream;
}; };
class FileStream : public StreamInterface class FileStream : public StreamInterface
{ {
public: public:
FileStream(const Filepath_char_t *filename); FileStream(const Filepath_char_t* filename);
~FileStream() override; ~FileStream() override;
unsigned long sread (unsigned char *buf, unsigned long size) override; unsigned long sread(unsigned char* buf, unsigned long size) override;
long stell () override; long stell() override;
long sseek (long offset, int origin) override; long sseek(long offset, int origin) override;
private: private:
FILE *file; FILE* file;
}; };
#endif #endif

View File

@@ -31,9 +31,9 @@
// XmlTags_t, tags defined with tag name and xml tag. // XmlTags_t, tags defined with tag name and xml tag.
// Contents: Definitions of xml tag used in parser. // Contents: Definitions of xml tag used in parser.
typedef std::map<std::wstring, std::wstring> XmlTagAttributes_t; typedef std::map<std::wstring, std::wstring> XmlTagAttributes_t;
typedef std::pair<std::wstring, XmlTagAttributes_t> XmlTag_t; typedef std::pair<std::wstring, XmlTagAttributes_t> XmlTag_t;
typedef std::map<std::wstring, XmlTag_t> XmlTags_t; typedef std::map<std::wstring, XmlTag_t> XmlTags_t;
const XmlTag_t EMPTY_XML_TAG = std::make_pair(std::wstring(), XmlTagAttributes_t()); const XmlTag_t EMPTY_XML_TAG = std::make_pair(std::wstring(), XmlTagAttributes_t());
@@ -45,14 +45,14 @@ const XmlTag_t EMPTY_XML_TAG = std::make_pair(std::wstring(), XmlTagAttributes_t
typedef ::std::wstring Language_t; typedef ::std::wstring Language_t;
typedef ::std::wstring Country_t; typedef ::std::wstring Country_t;
typedef ::std::pair<Language_t, Country_t > LocaleSet_t; typedef ::std::pair<Language_t, Country_t> LocaleSet_t;
typedef ::std::wstring Content_t; typedef ::std::wstring Content_t;
typedef ::std::pair<LocaleSet_t, Content_t > Chunk_t; typedef ::std::pair<LocaleSet_t, Content_t> Chunk_t;
typedef ::std::vector< Chunk_t > ChunkBuffer_t; typedef ::std::vector<Chunk_t> ChunkBuffer_t;
const LocaleSet_t EMPTY_LOCALE = ::std::make_pair(::std::wstring(), ::std::wstring()); const LocaleSet_t EMPTY_LOCALE = ::std::make_pair(::std::wstring(), ::std::wstring());
const Chunk_t EMPTY_CHUNK = ::std::make_pair( EMPTY_LOCALE, ::std::wstring()); const Chunk_t EMPTY_CHUNK = ::std::make_pair(EMPTY_LOCALE, ::std::wstring());
//+------------------------------------------------------------------------- //+-------------------------------------------------------------------------
// Declare: StyleName_t, style name of a style-locale pair. // Declare: StyleName_t, style name of a style-locale pair.
@@ -60,18 +60,18 @@ const Chunk_t EMPTY_CHUNK = ::std::make_pair( EMPTY_LOCALE, ::std::wstring());
// Contents: Definitions of Style Names. // Contents: Definitions of Style Names.
typedef ::std::wstring StyleName_t; typedef ::std::wstring StyleName_t;
typedef ::std::pair <StyleName_t, LocaleSet_t> StyleLocalePair_t; typedef ::std::pair<StyleName_t, LocaleSet_t> StyleLocalePair_t;
typedef ::std::map<StyleName_t, LocaleSet_t> StyleLocaleMap_t; typedef ::std::map<StyleName_t, LocaleSet_t> StyleLocaleMap_t;
const StyleLocalePair_t EMPTY_STYLELOCALE_PAIR = ::std::make_pair(::std::wstring(), EMPTY_LOCALE ); const StyleLocalePair_t EMPTY_STYLELOCALE_PAIR = ::std::make_pair(::std::wstring(), EMPTY_LOCALE);
class StreamInterface class StreamInterface
{ {
public: public:
virtual ~StreamInterface() {} virtual ~StreamInterface() {}
virtual unsigned long sread (unsigned char* vuf, unsigned long size) = 0; virtual unsigned long sread(unsigned char* vuf, unsigned long size) = 0;
virtual long stell () = 0; virtual long stell() = 0;
virtual long sseek (long offset, int origin) = 0; virtual long sseek(long offset, int origin) = 0;
}; };
#endif #endif

View File

@@ -23,7 +23,7 @@
#include <malloc.h> #include <malloc.h>
#if !defined WIN32_LEAN_AND_MEAN #if !defined WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#include <windows.h> #include <windows.h>
@@ -41,25 +41,21 @@
*/ */
std::wstring StringToWString(const std::string& String); std::wstring StringToWString(const std::string& String);
/** Convert a wstring to a string /** Convert a wstring to a string
using CP_ACP using CP_ACP
*/ */
std::string WStringToString(const std::wstring& String); std::string WStringToString(const std::wstring& String);
/** Convert a string to a wstring /** Convert a string to a wstring
using CP_UTF8 using CP_UTF8
*/ */
std::wstring UTF8ToWString(const std::string& String); std::wstring UTF8ToWString(const std::string& String);
/** Retrieve a string from the /** Retrieve a string from the
resources of this module resources of this module
*/ */
std::wstring GetResString(int ResId); std::wstring GetResString(int ResId);
/** helper function to judge if the string is only has spaces. /** helper function to judge if the string is only has spaces.
@returns @returns
<TRUE>if the provided string contains only but at least one space <TRUE>if the provided string contains only but at least one space
@@ -72,33 +68,27 @@ bool HasOnlySpaces(const std::wstring& String);
Windows Locale Identifier corresponding to input LocaleSet. Windows Locale Identifier corresponding to input LocaleSet.
*/ */
/** Convert a long path name using Windows api call GetShortPathName /** Convert a long path name using Windows api call GetShortPathName
*/ */
std::wstring getShortPathName( const std::wstring& aLongName ); std::wstring getShortPathName(const std::wstring& aLongName);
LCID LocaleSetToLCID( const LocaleSet_t & Locale );
LCID LocaleSetToLCID(const LocaleSet_t& Locale);
#ifdef DEBUG #ifdef DEBUG
inline void OutputDebugStringFormatW( LPCWSTR pFormat, ... ) inline void OutputDebugStringFormatW(LPCWSTR pFormat, ...)
{ {
WCHAR buffer[1024]; WCHAR buffer[1024];
va_list args; va_list args;
va_start( args, pFormat ); va_start(args, pFormat);
StringCchVPrintfW( buffer, sizeof(buffer)/sizeof(*buffer), pFormat, args ); StringCchVPrintfW(buffer, sizeof(buffer) / sizeof(*buffer), pFormat, args);
va_end( args ); va_end(args);
OutputDebugStringW( buffer ); OutputDebugStringW(buffer);
} }
#else #else
static inline void OutputDebugStringFormatW( LPCWSTR, ... ) static inline void OutputDebugStringFormatW(LPCWSTR, ...) {}
{
}
#endif #endif
#endif #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -26,15 +26,12 @@
class xml_parser_exception final : public std::runtime_error class xml_parser_exception final : public std::runtime_error
{ {
public: public:
xml_parser_exception(const std::string& error_msg)
xml_parser_exception( : std::runtime_error(error_msg)
const std::string& error_msg) : {
std::runtime_error(error_msg) }
{}
}; };
// Simple wrapper around expat, the xml parser library // Simple wrapper around expat, the xml parser library
// created by James Clark // created by James Clark
@@ -88,9 +85,9 @@ public:
/** Returns the currently used document handler or null if /** Returns the currently used document handler or null if
no document handler was set before. */ no document handler was set before. */
i_xml_parser_event_handler* get_document_handler() const { return document_handler_;} i_xml_parser_event_handler* get_document_handler() const { return document_handler_; }
private:
private:
void init(); void init();
private: private:

View File

@@ -33,12 +33,11 @@ class StreamInterface;
class ZipFile class ZipFile
{ {
public: public:
typedef std::vector<std::string> Directory_t; typedef std::vector<std::string> Directory_t;
typedef std::unique_ptr<Directory_t> DirectoryPtr_t; typedef std::unique_ptr<Directory_t> DirectoryPtr_t;
typedef std::vector<char> ZipContentBuffer_t; typedef std::vector<char> ZipContentBuffer_t;
public: public:
/** Checks whether a file is a zip file or not /** Checks whether a file is a zip file or not
@precond The given parameter must be a string with length > 0 @precond The given parameter must be a string with length > 0
@@ -52,10 +51,9 @@ public:
IOException if the specified file doesn't exist IOException if the specified file doesn't exist
AccessViolationException if read access to the file is denied AccessViolationException if read access to the file is denied
*/ */
static bool IsZipFile(const Filepath_t &FileName); static bool IsZipFile(const Filepath_t& FileName);
static bool IsZipFile(void *stream);
static bool IsZipFile(void* stream);
/** Returns whether the version of the specified zip file may be uncompressed with the /** Returns whether the version of the specified zip file may be uncompressed with the
currently used zlib version or not currently used zlib version or not
@@ -72,12 +70,11 @@ public:
IOException if the specified file doesn't exist or is no zip file IOException if the specified file doesn't exist or is no zip file
AccessViolationException if read access to the file is denied AccessViolationException if read access to the file is denied
*/ */
static bool IsValidZipFileVersionNumber(const Filepath_t &FileName); static bool IsValidZipFileVersionNumber(const Filepath_t& FileName);
static bool IsValidZipFileVersionNumber(void *stream); static bool IsValidZipFileVersionNumber(void* stream);
public: public:
/** Constructs a zip file from a zip file /** Constructs a zip file from a zip file
@precond The given parameter must be a string with length > 0 @precond The given parameter must be a string with length > 0
@@ -90,10 +87,9 @@ public:
WrongZipVersionException if the zip file cannot be uncompressed WrongZipVersionException if the zip file cannot be uncompressed
with the used zlib version with the used zlib version
*/ */
ZipFile(const Filepath_t &FileName); ZipFile(const Filepath_t& FileName);
ZipFile(StreamInterface *stream);
ZipFile(StreamInterface* stream);
/** Destroys a zip file /** Destroys a zip file
*/ */
@@ -117,7 +113,8 @@ public:
ZipContentMissException if the specified zip content ZipContentMissException if the specified zip content
does not exist in this zip file does not exist in this zip file
*/ */
void GetUncompressedContent(const std::string &ContentName, /*inout*/ ZipContentBuffer_t &ContentBuffer); void GetUncompressedContent(const std::string& ContentName,
/*inout*/ ZipContentBuffer_t& ContentBuffer);
/** Returns a list with the content names contained within this file /** Returns a list with the content names contained within this file
@@ -129,10 +126,9 @@ public:
iterating over a ZipFileDirectory returned by iterating over a ZipFileDirectory returned by
GetDirectory GetDirectory
*/ */
bool HasContent(const std::string &ContentName) const; bool HasContent(const std::string& ContentName) const;
private: private:
/** Returns the length of the longest file name /** Returns the length of the longest file name
in the current zip file in the current zip file
@@ -141,7 +137,7 @@ private:
long GetFileLongestFileNameLength() const; long GetFileLongestFileNameLength() const;
private: private:
StreamInterface *m_pStream; StreamInterface* m_pStream;
bool m_bShouldFree; bool m_bShouldFree;
}; };

View File

@@ -19,8 +19,9 @@
#include "testzipimpl.hxx" #include "testzipimpl.hxx"
TestZipImpl::TestZipImpl(StreamInterface *stream) : TestZipImpl::TestZipImpl(StreamInterface* stream)
zipFile(ZipFile(stream)), expectedContents() : zipFile(ZipFile(stream))
, expectedContents()
{ {
expectedContents.push_back("mimetype"); expectedContents.push_back("mimetype");
expectedContents.push_back("Configurations2/statusbar/"); expectedContents.push_back("Configurations2/statusbar/");
@@ -42,22 +43,17 @@ TestZipImpl::TestZipImpl(StreamInterface *stream) :
sort(expectedContents.begin(), expectedContents.end()); sort(expectedContents.begin(), expectedContents.end());
} }
TestZipImpl::~TestZipImpl() TestZipImpl::~TestZipImpl() {}
{
}
bool TestZipImpl::test_directory() bool TestZipImpl::test_directory()
{ {
ZipFile::DirectoryPtr_t contents = zipFile.GetDirectory(); ZipFile::DirectoryPtr_t contents = zipFile.GetDirectory();
vector<string> &stringVector = *contents; vector<string>& stringVector = *contents;
sort(stringVector.begin(), stringVector.end()); sort(stringVector.begin(), stringVector.end());
return expectedContents == stringVector; return expectedContents == stringVector;
} }
bool TestZipImpl::test_hasContentCaseInSensitive() bool TestZipImpl::test_hasContentCaseInSensitive() { return zipFile.HasContent("mimetype"); }
{
return zipFile.HasContent("mimetype");
}
bool TestZipImpl::test_getContent() bool TestZipImpl::test_getContent()
{ {

View File

@@ -30,11 +30,12 @@ using namespace std;
class TestZipImpl class TestZipImpl
{ {
private: private:
ZipFile zipFile; ZipFile zipFile;
vector<string> expectedContents; vector<string> expectedContents;
public:
explicit TestZipImpl(StreamInterface *stream); public:
explicit TestZipImpl(StreamInterface* stream);
~TestZipImpl(); ~TestZipImpl();
bool test_directory(); bool test_directory();
bool test_hasContentCaseInSensitive(); bool test_hasContentCaseInSensitive();

View File

@@ -18,7 +18,7 @@
*/ */
#if !defined WIN32_LEAN_AND_MEAN #if !defined WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#include <windows.h> #include <windows.h>
#include <ole2.h> #include <ole2.h>
@@ -38,6 +38,7 @@ class Test : public CppUnit::TestFixture
private: private:
wstring documentName; wstring documentName;
LPSTREAM pStream; LPSTREAM pStream;
public: public:
Test(); Test();
void test_file_directory(); void test_file_directory();
@@ -58,7 +59,9 @@ public:
CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_TEST_SUITE_REGISTRATION(Test);
Test::Test() : documentName(), pStream(nullptr) Test::Test()
: documentName()
, pStream(nullptr)
{ {
const wchar_t* pSrcRoot = _wgetenv(L"SRC_ROOT"); const wchar_t* pSrcRoot = _wgetenv(L"SRC_ROOT");
if (pSrcRoot) if (pSrcRoot)
@@ -69,7 +72,8 @@ Test::Test() : documentName(), pStream(nullptr)
documentName.append(L"shell/qa/zip/simpledocument.odt"); documentName.append(L"shell/qa/zip/simpledocument.odt");
// Create an IStream pointer from the file // Create an IStream pointer from the file
HANDLE hFile = CreateFileW(documentName.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, 0, nullptr); HANDLE hFile
= CreateFileW(documentName.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, 0, nullptr);
DWORD dwFileSize = GetFileSize(hFile, nullptr); DWORD dwFileSize = GetFileSize(hFile, nullptr);
HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, dwFileSize); HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, dwFileSize);
@@ -90,7 +94,8 @@ void Test::test_file_directory()
FileStream stream(documentName.c_str()); FileStream stream(documentName.c_str());
TestZipImpl testImpl(&stream); TestZipImpl testImpl(&stream);
bool isPassed = testImpl.test_directory(); bool isPassed = testImpl.test_directory();
CPPUNIT_ASSERT_MESSAGE("FileStream: Content does not match with expected directory names.", isPassed); CPPUNIT_ASSERT_MESSAGE("FileStream: Content does not match with expected directory names.",
isPassed);
} }
void Test::test_file_hasContentCaseInSensitive() void Test::test_file_hasContentCaseInSensitive()
@@ -114,7 +119,8 @@ void Test::test_stream_directory()
BufferStream stream(pStream); BufferStream stream(pStream);
TestZipImpl testImpl(&stream); TestZipImpl testImpl(&stream);
bool isPassed = testImpl.test_directory(); bool isPassed = testImpl.test_directory();
CPPUNIT_ASSERT_MESSAGE("BufferStream: Content does not match with expected directory names.", isPassed); CPPUNIT_ASSERT_MESSAGE("BufferStream: Content does not match with expected directory names.",
isPassed);
} }
void Test::test_stream_hasContentCaseInSensitive() void Test::test_stream_hasContentCaseInSensitive()

View File

@@ -17,27 +17,22 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <stdexcept> #include <stdexcept>
#include "cmdline.hxx" #include "cmdline.hxx"
/** Simple command line abstraction /** Simple command line abstraction
*/ */
// Creation // Creation
CommandLine::CommandLine(size_t argc, char* argv[])
CommandLine::CommandLine(size_t argc, char* argv[]) : : m_argc(argc)
m_argc(argc), , m_argv(argv)
m_argv(argv)
{ {
} }
// Query // Query
/** Returns an argument by name. If there are /** Returns an argument by name. If there are
duplicate argument names in the command line, duplicate argument names in the command line,
the first one wins. the first one wins.
@@ -58,13 +53,13 @@ std::string CommandLine::get_arg(const std::string& ArgumentName) const
{ {
std::string arg_value; std::string arg_value;
size_t i; size_t i;
for ( i = 0; i < m_argc; i++) for (i = 0; i < m_argc; i++)
{ {
std::string arg = m_argv[i]; std::string arg = m_argv[i];
if (ArgumentName == arg && ((i+1) < m_argc) && !is_arg_name(m_argv[i+1])) if (ArgumentName == arg && ((i + 1) < m_argc) && !is_arg_name(m_argv[i + 1]))
{ {
arg_value = m_argv[i+1]; arg_value = m_argv[i + 1];
break; break;
} }
} }
@@ -75,10 +70,8 @@ std::string CommandLine::get_arg(const std::string& ArgumentName) const
return arg_value; return arg_value;
} }
// Command // Command
/** Returns whether a given argument is an argument name /** Returns whether a given argument is an argument name
*/ */
bool CommandLine::is_arg_name(const std::string& Argument) bool CommandLine::is_arg_name(const std::string& Argument)

View File

@@ -24,23 +24,18 @@
#include <sal/config.h> #include <sal/config.h>
/** Simple command line abstraction /** Simple command line abstraction
*/ */
class CommandLine class CommandLine
{ {
public: public:
// Creation // Creation
CommandLine(size_t argc, char* argv[]); CommandLine(size_t argc, char* argv[]);
// Query // Query
/** Returns an argument by name. If there are /** Returns an argument by name. If there are
duplicate argument names in the command line, duplicate argument names in the command line,
the first one wins. the first one wins.
@@ -59,18 +54,16 @@ public:
*/ */
std::string get_arg(const std::string& ArgumentName) const; std::string get_arg(const std::string& ArgumentName) const;
private: private:
/** Returns whether a given argument is an argument name /** Returns whether a given argument is an argument name
*/ */
static bool is_arg_name(const std::string& Argument); static bool is_arg_name(const std::string& Argument);
private: private:
size_t m_argc; size_t m_argc;
char** m_argv; char** m_argv;
// prevent copy and assignment // prevent copy and assignment
private: private:
CommandLine(const CommandLine&) = delete; CommandLine(const CommandLine&) = delete;
CommandLine& operator=(const CommandLine&) = delete; CommandLine& operator=(const CommandLine&) = delete;

View File

@@ -21,15 +21,9 @@
/*********************** CKeywordsTag ***********************/ /*********************** CKeywordsTag ***********************/
void CKeywordsTag::startTag() void CKeywordsTag::startTag() { m_sCurrentKeyword.clear(); }
{
m_sCurrentKeyword.clear();
}
void CKeywordsTag::endTag() void CKeywordsTag::endTag() { m_slKeywords.push_back(m_sCurrentKeyword); }
{
m_slKeywords.push_back(m_sCurrentKeyword);
}
void CKeywordsTag::addCharacters(const std::wstring& characters) void CKeywordsTag::addCharacters(const std::wstring& characters)
{ {
@@ -41,13 +35,13 @@ void CKeywordsTag::addAttributes(const XmlTagAttributes_t& /*attributes*/)
// there are no attributes for keywords // there are no attributes for keywords
} }
std::wstring CKeywordsTag::getTagContent( ) std::wstring CKeywordsTag::getTagContent()
{ {
auto keywords_Iter= m_slKeywords.cbegin( ); auto keywords_Iter = m_slKeywords.cbegin();
auto keywords_Iter_end = m_slKeywords.cend( ); auto keywords_Iter_end = m_slKeywords.cend();
std::wstring ret_KeyWord_String = ( keywords_Iter != keywords_Iter_end) ? *keywords_Iter++ : L""; std::wstring ret_KeyWord_String = (keywords_Iter != keywords_Iter_end) ? *keywords_Iter++ : L"";
for ( ; keywords_Iter != keywords_Iter_end; ++keywords_Iter) for (; keywords_Iter != keywords_Iter_end; ++keywords_Iter)
ret_KeyWord_String += L"," + *keywords_Iter; ret_KeyWord_String += L"," + *keywords_Iter;
return ret_KeyWord_String; return ret_KeyWord_String;
} }

View File

@@ -24,7 +24,6 @@
#include <stdexcept> #include <stdexcept>
class RuntimeException : public std::exception class RuntimeException : public std::exception
{ {
public: public:
@@ -37,7 +36,6 @@ private:
int m_Error; int m_Error;
}; };
class ZipException : public RuntimeException class ZipException : public RuntimeException
{ {
public: public:
@@ -46,7 +44,6 @@ public:
virtual const char* what() const throw() override; virtual const char* what() const throw() override;
}; };
class Win32Exception : public RuntimeException class Win32Exception : public RuntimeException
{ {
public: public:
@@ -59,21 +56,18 @@ private:
mutable char* m_MsgBuff; mutable char* m_MsgBuff;
}; };
class ZipContentMissException : public ZipException class ZipContentMissException : public ZipException
{ {
public: public:
explicit ZipContentMissException(int Error); explicit ZipContentMissException(int Error);
}; };
class AccessViolationException : public Win32Exception class AccessViolationException : public Win32Exception
{ {
public: public:
explicit AccessViolationException(int Error); explicit AccessViolationException(int Error);
}; };
class IOException : public Win32Exception class IOException : public Win32Exception
{ {
public: public:

View File

@@ -11483,26 +11483,13 @@ shell/inc/columninfo.hxx
shell/inc/config.hxx shell/inc/config.hxx
shell/inc/contentreader.hxx shell/inc/contentreader.hxx
shell/inc/fileextensions.hxx shell/inc/fileextensions.hxx
shell/inc/filepath.hxx
shell/inc/global.hxx
shell/inc/i_xml_parser_event_handler.hxx shell/inc/i_xml_parser_event_handler.hxx
shell/inc/infotips.hxx shell/inc/infotips.hxx
shell/inc/iso8601_converter.hxx
shell/inc/metainforeader.hxx
shell/inc/propertyhdl.hxx shell/inc/propertyhdl.hxx
shell/inc/propsheets.hxx shell/inc/propsheets.hxx
shell/inc/registry.hxx shell/inc/registry.hxx
shell/inc/resource.h shell/inc/resource.h
shell/inc/shlxthdl.hxx
shell/inc/stream_helper.hxx
shell/inc/thumbviewer.hxx shell/inc/thumbviewer.hxx
shell/inc/types.hxx
shell/inc/utilities.hxx
shell/inc/xml_parser.hxx
shell/inc/zipfile.hxx
shell/qa/zip/testzipimpl.cxx
shell/qa/zip/testzipimpl.hxx
shell/qa/zip/ziptest.cxx
shell/source/all/xml_parser.cxx shell/source/all/xml_parser.cxx
shell/source/backends/desktopbe/desktopbackend.cxx shell/source/backends/desktopbe/desktopbackend.cxx
shell/source/backends/localebe/localebackend.cxx shell/source/backends/localebe/localebackend.cxx
@@ -11516,8 +11503,6 @@ shell/source/cmdmail/cmdmailsuppl.cxx
shell/source/cmdmail/cmdmailsuppl.hxx shell/source/cmdmail/cmdmailsuppl.hxx
shell/source/sessioninstall/SyncDbusSessionHelper.cxx shell/source/sessioninstall/SyncDbusSessionHelper.cxx
shell/source/sessioninstall/SyncDbusSessionHelper.hxx shell/source/sessioninstall/SyncDbusSessionHelper.hxx
shell/source/tools/lngconvex/cmdline.cxx
shell/source/tools/lngconvex/cmdline.hxx
shell/source/tools/lngconvex/lngconvex.cxx shell/source/tools/lngconvex/lngconvex.cxx
shell/source/tools/regsvrex/regsvrex.cxx shell/source/tools/regsvrex/regsvrex.cxx
shell/source/unix/exec/shellexec.cxx shell/source/unix/exec/shellexec.cxx
@@ -11531,7 +11516,6 @@ shell/source/win32/ooofilereader/basereader.cxx
shell/source/win32/ooofilereader/contentreader.cxx shell/source/win32/ooofilereader/contentreader.cxx
shell/source/win32/ooofilereader/dummytag.hxx shell/source/win32/ooofilereader/dummytag.hxx
shell/source/win32/ooofilereader/itag.hxx shell/source/win32/ooofilereader/itag.hxx
shell/source/win32/ooofilereader/keywordstag.cxx
shell/source/win32/ooofilereader/keywordstag.hxx shell/source/win32/ooofilereader/keywordstag.hxx
shell/source/win32/ooofilereader/metainforeader.cxx shell/source/win32/ooofilereader/metainforeader.cxx
shell/source/win32/ooofilereader/simpletag.cxx shell/source/win32/ooofilereader/simpletag.cxx
@@ -11571,7 +11555,6 @@ shell/source/win32/spsupp/spsuppServ.cxx
shell/source/win32/workbench/TestSmplMail.cxx shell/source/win32/workbench/TestSmplMail.cxx
shell/source/win32/workbench/TestSysShExec.cxx shell/source/win32/workbench/TestSysShExec.cxx
shell/source/win32/zipfile/zipexcptn.cxx shell/source/win32/zipfile/zipexcptn.cxx
shell/source/win32/zipfile/zipexcptn.hxx
shell/source/win32/zipfile/zipfile.cxx shell/source/win32/zipfile/zipfile.cxx
slideshow/source/engine/activities/accumulation.hxx slideshow/source/engine/activities/accumulation.hxx
slideshow/source/engine/activities/activitiesfactory.cxx slideshow/source/engine/activities/activitiesfactory.cxx