From 7721e7a79733a5ac5e029869eeb88638ec00102e Mon Sep 17 00:00:00 2001 From: Philipp Hofer Date: Thu, 12 Nov 2020 12:59:30 +0100 Subject: tdf#123936 Formatting files in module hwpfilter with clang-format Change-Id: I0c2d06e03f2fbb15ddb35e3d24f1cf2f926dc4dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105676 Tested-by: Jenkins Reviewed-by: Christian Lohmaier --- hwpfilter/source/datecode.h | 5 +---- hwpfilter/source/hfont.cxx | 18 ++++++------------ hwpfilter/source/hstream.cxx | 12 +++--------- hwpfilter/source/hstyle.cxx | 35 ++++++++++++++--------------------- hwpfilter/source/htags.h | 12 ++++++------ hwpfilter/source/precompile.h | 6 +++--- hwpfilter/source/solver.h | 20 ++++++++++---------- 7 files changed, 43 insertions(+), 65 deletions(-) (limited to 'hwpfilter') diff --git a/hwpfilter/source/datecode.h b/hwpfilter/source/datecode.h index 0478dcce5e62..900d1e6c9d6b 100644 --- a/hwpfilter/source/datecode.h +++ b/hwpfilter/source/datecode.h @@ -20,10 +20,7 @@ #ifndef INCLUDED_HWPFILTER_SOURCE_DATECODE_H #define INCLUDED_HWPFILTER_SOURCE_DATECODE_H -const hchar defaultform[] = -{ - '1', 0x9165, 32, '2', 0xB6A9, 32, '3', 0xB7A9, 0 -}; +const hchar defaultform[] = { '1', 0x9165, 32, '2', 0xB6A9, 32, '3', 0xB7A9, 0 }; #endif diff --git a/hwpfilter/source/hfont.cxx b/hwpfilter/source/hfont.cxx index 71ca23451bd8..cdb77ec776da 100644 --- a/hwpfilter/source/hfont.cxx +++ b/hwpfilter/source/hfont.cxx @@ -32,13 +32,9 @@ HWPFont::HWPFont() } } +HWPFont::~HWPFont() {} -HWPFont::~HWPFont() -{ -} - - -void HWPFont::AddFont(int lang, const char *font) +void HWPFont::AddFont(int lang, const char* font) { int nfonts; @@ -53,8 +49,7 @@ void HWPFont::AddFont(int lang, const char *font) nFonts[lang]++; } - -const char *HWPFont::GetFontName(int lang, int id) +const char* HWPFont::GetFontName(int lang, int id) { if (lang < 0 || lang >= NLanguage) return nullptr; @@ -63,16 +58,15 @@ const char *HWPFont::GetFontName(int lang, int id) return fontnames[lang].get() + id * FONTNAMELEN; } - static char buffer[FONTNAMELEN]; -void HWPFont::Read(HWPFile & hwpf) +void HWPFont::Read(HWPFile& hwpf) { int lang = 0; short nfonts = 0; -//printf("HWPFont::Read : lang = %d\n",NLanguage); - for(lang = 0; lang < NLanguage; lang++) + //printf("HWPFont::Read : lang = %d\n",NLanguage); + for (lang = 0; lang < NLanguage; lang++) { hwpf.Read2b(&nfonts, 1); if (nfonts <= 0 || nfonts >= MAXFONTS) diff --git a/hwpfilter/source/hstream.cxx b/hwpfilter/source/hstream.cxx index 6b5bf98cb35d..a4ef16885c82 100644 --- a/hwpfilter/source/hstream.cxx +++ b/hwpfilter/source/hstream.cxx @@ -26,12 +26,9 @@ HStream::HStream() { } -void HStream::addData(const byte *buf, size_t aToAdd) -{ - seq.insert(seq.end(), buf, buf + aToAdd); -} +void HStream::addData(const byte* buf, size_t aToAdd) { seq.insert(seq.end(), buf, buf + aToAdd); } -size_t HStream::readBytes(byte * buf, size_t aToRead) +size_t HStream::readBytes(byte* buf, size_t aToRead) { auto size = seq.size(); if (aToRead >= (size - pos)) @@ -50,9 +47,6 @@ size_t HStream::skipBytes(size_t aToSkip) return aToSkip; } -size_t HStream::available() const -{ - return seq.size() - pos; -} +size_t HStream::available() const { return seq.size() - pos; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/hwpfilter/source/hstyle.cxx b/hwpfilter/source/hstyle.cxx index 88aa73b77ab0..33f143440c32 100644 --- a/hwpfilter/source/hstyle.cxx +++ b/hwpfilter/source/hstyle.cxx @@ -26,19 +26,20 @@ #include "hstyle.h" enum -{ MAXSTYLENAME = 20 }; - -#define DATA static_cast(style) +{ + MAXSTYLENAME = 20 +}; -namespace { +#define DATA static_cast(style) +namespace +{ struct StyleData { char name[MAXSTYLENAME + 1]; CharShape cshape; ParaShape pshape; }; - } static char buffer[MAXSTYLENAME + 1]; @@ -49,23 +50,20 @@ HWPStyle::HWPStyle() style = nullptr; } - HWPStyle::~HWPStyle() { - delete[]DATA; + delete[] DATA; nstyles = 0; } - -char *HWPStyle::GetName(int n) const +char* HWPStyle::GetName(int n) const { if (n < 0 || n >= nstyles) return nullptr; return DATA[n].name; } - -void HWPStyle::SetName(int n, char const *name) +void HWPStyle::SetName(int n, char const* name) { if (n < 0 || n >= nstyles) return; @@ -87,16 +85,14 @@ void HWPStyle::SetName(int n, char const *name) DATA[n].name[0] = 0; } - -CharShape *HWPStyle::GetCharShape(int n) const +CharShape* HWPStyle::GetCharShape(int n) const { if (n < 0 || n >= nstyles) return nullptr; return &DATA[n].cshape; } - -void HWPStyle::SetCharShape(int n, CharShape const * cshapep) +void HWPStyle::SetCharShape(int n, CharShape const* cshapep) { if (n >= 0 && n < nstyles) { @@ -107,16 +103,14 @@ void HWPStyle::SetCharShape(int n, CharShape const * cshapep) } } - -ParaShape *HWPStyle::GetParaShape(int n) const +ParaShape* HWPStyle::GetParaShape(int n) const { if (n < 0 || n >= nstyles) return nullptr; return &DATA[n].pshape; } - -void HWPStyle::SetParaShape(int n, ParaShape const * pshapep) +void HWPStyle::SetParaShape(int n, ParaShape const* pshapep) { if (n >= 0 && n < nstyles) { @@ -127,8 +121,7 @@ void HWPStyle::SetParaShape(int n, ParaShape const * pshapep) } } - -void HWPStyle::Read(HWPFile & hwpf) +void HWPStyle::Read(HWPFile& hwpf) { CharShape cshape; ParaShape pshape; diff --git a/hwpfilter/source/htags.h b/hwpfilter/source/htags.h index 3507633b0294..7265f5d11742 100644 --- a/hwpfilter/source/htags.h +++ b/hwpfilter/source/htags.h @@ -22,7 +22,7 @@ #include #ifdef _WIN32 -# include +#include #endif class HWPFile; @@ -32,8 +32,8 @@ class HWPFile; struct EmPicture { size_t size; - char name[16]; - char type[16]; + char name[16]; + char type[16]; std::unique_ptr data; explicit EmPicture(size_t size); @@ -48,7 +48,7 @@ struct HyperText { kchar filename[256]; hchar bookmark[16]; - char macro[325]; + char macro[325]; uchar type; char reserve[3]; bool Read(HWPFile& hwpf); @@ -58,10 +58,10 @@ struct HyperText */ struct OlePicture { - int size; + int size; uint signature; #ifdef _WIN32 - IStorage *pis; + IStorage* pis; #endif explicit OlePicture(int tsize); ~OlePicture(void); diff --git a/hwpfilter/source/precompile.h b/hwpfilter/source/precompile.h index 7ef673028a85..1c348f6b96f6 100644 --- a/hwpfilter/source/precompile.h +++ b/hwpfilter/source/precompile.h @@ -18,9 +18,9 @@ */ #ifdef _WIN32 - #define WIN32_LEAN_AND_MEAN - #include - #include +#define WIN32_LEAN_AND_MEAN +#include +#include #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/hwpfilter/source/solver.h b/hwpfilter/source/solver.h index 451ed068142a..85467ff78e1e 100644 --- a/hwpfilter/source/solver.h +++ b/hwpfilter/source/solver.h @@ -23,17 +23,17 @@ class mgcLinearSystemD { public: - static std::unique_ptr[]> NewMatrix (int N); - static std::unique_ptr NewVector (int N); + static std::unique_ptr[]> NewMatrix(int N); + static std::unique_ptr NewVector(int N); - static bool Solve (int N, std::unique_ptr[]> const & A, double* b); - // Input: - // A[N][N] coefficient matrix, entries are A[row][col] - // b[N] vector, entries are b[row] - // Output: - // return value is TRUE if successful, FALSE if pivoting failed - // A[N][N] is inverse matrix - // b[N] is solution x to Ax = b + static bool Solve(int N, std::unique_ptr[]> const& A, double* b); + // Input: + // A[N][N] coefficient matrix, entries are A[row][col] + // b[N] vector, entries are b[row] + // Output: + // return value is TRUE if successful, FALSE if pivoting failed + // A[N][N] is inverse matrix + // b[N] is solution x to Ax = b }; #endif -- cgit