Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix -Wall warnings #579

Draft
wants to merge 37 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a56f6c0
lvptrvec: fix compiler warnings
benoit-pierre Jul 21, 2024
c96a3f3
qimagescale: fix compiler warnings
benoit-pierre Jul 21, 2024
b446873
lvstring: fix compiler warnings
benoit-pierre Jul 21, 2024
76e6e24
EPUB: fix compiler warnings
benoit-pierre Jul 21, 2024
c891656
crtxtenc: fix compiler warning
benoit-pierre Jul 21, 2024
3913efd
mathml: fix compiler warnings
benoit-pierre Jul 21, 2024
405bb94
lvstsheet: fix `parse_integer` prototype and associated compiler warn…
benoit-pierre Jul 21, 2024
7f5ae87
lvstsheet: remove dead code
benoit-pierre Jul 21, 2024
b9f5d57
lvstsheet: fix remaining compiler warnings
benoit-pierre Jul 21, 2024
d4f5a64
hyphman: fix compiler warnings
benoit-pierre Jul 21, 2024
97b1ddd
cri18n: fix compiler warning
benoit-pierre Jul 21, 2024
01c9b19
lvdocview: fix compiler warnings
benoit-pierre Jul 21, 2024
d2aeb52
lvtextfm: fix compiler warnings
benoit-pierre Jul 21, 2024
f8d7ed7
lvtinydom: fix compiler warnings
benoit-pierre Jul 21, 2024
273050c
lvstream: fix compiler warning
benoit-pierre Jul 21, 2024
b9a02df
lvxml: fix compiler warnings
benoit-pierre Jul 21, 2024
3a2e6e7
hist: fix compiler warnings
benoit-pierre Jul 21, 2024
a35c257
lvfntman: fix compiler warnings
benoit-pierre Jul 21, 2024
a9d7528
lvrend: fix compiler warnings
benoit-pierre Jul 21, 2024
30033b6
antiword: compile with `-Wall`
benoit-pierre Jul 21, 2024
6deea77
antiword: fix compiler warnings
benoit-pierre Jul 21, 2024
6b69446
chmlib: compile with `-Wall`
benoit-pierre Jul 21, 2024
e5ccfb4
chmlib: fix compiler warnings
benoit-pierre Jul 21, 2024
682a79b
docxfmt: fix compiler warnings
benoit-pierre Jul 21, 2024
b313d56
odtfmt: fix compiler warnings
benoit-pierre Jul 21, 2024
aba10b1
cp_stats: fix compiler warnings
benoit-pierre Jul 21, 2024
e99d4ab
lvimg: fix compiler warning
benoit-pierre Jul 21, 2024
fa5fead
pdbfmt: fix compiler warning
benoit-pierre Jul 21, 2024
8d3e28b
lvmemman: fix compiler warning
benoit-pierre Jul 21, 2024
8d3543a
lvdrawbuf: fix compiler warning
benoit-pierre Jul 21, 2024
45cecae
crtxtenc: fix cppcheck reported memory leak
benoit-pierre Jul 21, 2024
71715fa
crtxtenc: suppress cppcheck warning
benoit-pierre Jul 21, 2024
b908a75
lvstring: suppress cppcheck false positive
benoit-pierre Jul 21, 2024
541eb11
lvref: fix cppcheck warnings
benoit-pierre Jul 21, 2024
f74dab9
lvref: fix cppcheck warning
benoit-pierre Jul 21, 2024
3fca07a
wordfmt: fix clang-tidy warning
benoit-pierre Jul 21, 2024
a67e93e
lvarray: fix cppcheck warnings
benoit-pierre Jul 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crengine/include/hyphman.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class UserHyphDict
{
private:
static lString32 _filename;
static size_t _filesize;
static lvsize_t _filesize;
static lUInt32 _hash_value; // for calculating rendering hashes

static lUInt32 words_in_memory;
Expand Down
10 changes: 2 additions & 8 deletions crengine/include/lvarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ class LVArray
/// copies range to beginning of array
void trim( int pos, int count, int reserved )
{
#if defined(_DEBUG) && !defined(ANDROID)
if ( pos<0 || count<=0 || pos+count > _count )
throw;
#endif
assert(pos >= 0 && count > 0 && pos+count <= _count);
int i;
int new_sz = count;
if (new_sz < reserved)
Expand All @@ -154,10 +151,7 @@ class LVArray
/// removes several items from vector
void erase( int pos, int count )
{
#if defined(_DEBUG) && !defined(ANDROID)
if ( pos<0 || count<=0 || pos+count > _count )
throw;
#endif
assert(pos >= 0 && count > 0 && pos+count <= _count);
int i;
for (i=pos+count; i<_count; i++)
{
Expand Down
4 changes: 2 additions & 2 deletions crengine/include/lvptrvec.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ template<class _Ty > class LVMatrix {
int numrows;
_Ty ** rows;
public:
LVMatrix<_Ty> () : numcols(0), numrows(0), rows(NULL) {}
LVMatrix () : numcols(0), numrows(0), rows(NULL) {}
void Clear() {
if (rows) {
if (numrows && numcols) {
Expand All @@ -280,7 +280,7 @@ template<class _Ty > class LVMatrix {
numrows = 0;
numcols = 0;
}
~LVMatrix<_Ty> () {
~LVMatrix () {
Clear();
}

Expand Down
9 changes: 5 additions & 4 deletions crengine/include/lvref.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#ifndef __LVREF_H_INCLUDED__
#define __LVREF_H_INCLUDED__

#include <cassert>
#include "lvtypes.h"
#include "lvmemman.h"
#include "crlocks.h"
Expand Down Expand Up @@ -387,13 +388,15 @@ template <class T> class LVRef
//========================================
public:

#if 0
/// creates reference to copy
LVRef & clone()
{
if ( isNull() )
return LVRef(NULL);
return LVRef( new T( *_ptr ) );
}
#endif

/// Default constructor.
/** Initializes pointer to NULL */
Expand Down Expand Up @@ -592,8 +595,7 @@ class LVRefVec
/// copies range to beginning of array
void trim( int pos, int count, int reserved )
{
if ( pos<0 || count<=0 || pos+count > _count )
throw;
assert(pos >= 0 && count > 0 && pos+count <= _count);
int i;
int new_sz = count;
if (new_sz < reserved)
Expand All @@ -614,8 +616,7 @@ class LVRefVec
/// removes several items from vector
void erase( int pos, int count )
{
if ( pos<0 || count<=0 || pos+count > _count )
throw;
assert(pos >= 0 && count > 0 && pos+count <= _count);
int i;
for (i=pos+count; i<_count; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion crengine/include/lvtinydom.h
Original file line number Diff line number Diff line change
Expand Up @@ -2052,7 +2052,7 @@ class ldomXRange {
/// returns true if this interval intersects specified interval
bool checkIntersection( ldomXRange & v );
/// returns text between two XPointer positions
lString32 getRangeText( lChar32 blockDelimiter='\n', int maxTextLen=0, lChar32 imageReplacement=0, LVArray<ldomNode*> * imageNodes=NULL);
lString32 getRangeText( lChar32 blockDelimiter='\n', lChar32 imageReplacement=0, LVArray<ldomNode*> * imageNodes=NULL);
/// get all words from specified range
void getRangeWords( LVArray<ldomWord> & list );
/// returns href attribute of <A> element, null string if not found
Expand Down
12 changes: 12 additions & 0 deletions crengine/qimagescale/qimagescale.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ static QImageScaleInfo* QImageScale::qimageCalcScaleInfo(const unsigned char* __
}


#if defined(FBINK_QIS_NO_SIMD) || (!defined(__SSE4_1__) && !defined(__ARM_NEON__))

static void qt_qimageScaleAARGBA_up_x_down_y(QImageScaleInfo *isi, unsigned int * __restrict dest,
int dw, int dh, int dow, int sow);

Expand All @@ -281,6 +283,8 @@ static void qt_qimageScaleAARGBA_down_x_up_y(QImageScaleInfo *isi, unsigned int
static void qt_qimageScaleAARGBA_down_xy(QImageScaleInfo *isi, unsigned int * __restrict dest,
int dw, int dh, int dow, int sow);

#endif

#ifndef FBINK_QIS_NO_SIMD
#if defined(__SSE4_1__)
template<bool RGB>
Expand Down Expand Up @@ -397,6 +401,8 @@ static void qt_qimageScaleAARGBA(QImageScaleInfo *isi, unsigned int * __restrict
}
}

#if defined(FBINK_QIS_NO_SIMD) || (!defined(__SSE4_1__) && !defined(__ARM_NEON__))

inline static void qt_qimageScaleAARGBA_helper(const unsigned int * __restrict pix, const int xyap, const int Cxy, const int step, int &r, int &g, int &b, int &a)
{
r = qRed(*pix) * xyap;
Expand Down Expand Up @@ -553,6 +559,8 @@ static void qt_qimageScaleAARGB_down_x_up_y(QImageScaleInfo *isi, unsigned int *
static void qt_qimageScaleAARGB_down_xy(QImageScaleInfo *isi, unsigned int * __restrict dest,
int dw, int dh, int dow, int sow);

#endif

/* scale by area sampling - IGNORE the ALPHA byte*/
static void qt_qimageScaleAARGB(QImageScaleInfo *isi, unsigned int * __restrict dest,
int dw, int dh, int dow, int sow)
Expand Down Expand Up @@ -606,6 +614,8 @@ static void qt_qimageScaleAARGB(QImageScaleInfo *isi, unsigned int * __restrict
}


#if defined(FBINK_QIS_NO_SIMD) || (!defined(__SSE4_1__) && !defined(__ARM_NEON__))

inline static void qt_qimageScaleAARGB_helper(const unsigned int * __restrict pix, const int xyap, const int Cxy, const int step, int &r, int &g, int &b)
{
r = qRed(*pix) * xyap;
Expand Down Expand Up @@ -743,6 +753,8 @@ static void qt_qimageScaleAARGB_down_xy(QImageScaleInfo *isi, unsigned int * __r
}
}

#endif

unsigned char* qSmoothScaleImage(const unsigned char* __restrict src, int sw, int sh, bool ignore_alpha, int dw, int dh)
{
unsigned char* __restrict buffer = nullptr;
Expand Down
2 changes: 2 additions & 0 deletions crengine/src/cp_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ static const dbl_char_stat_t dbl_ch_stat_cp1250_cs1[256] = {
};


#if 0

static const short ch_stat_iso8859_2_cs2[256]={
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,// 0..15
Expand Down Expand Up @@ -601,6 +602,7 @@ static const dbl_char_stat_t dbl_ch_stat_iso8859_2_cs2[256] = {
{0xec,0x6a,0x0025}, {0xec,0x6b,0x0023}, {0xec,0x6c,0x0051}, {0xec,0x74,0x001d}, {0xed,0x20,0x00d8}, {0xed,0x63,0x0029}, {0xed,0x6b,0x002f}, {0xed,0x6d,0x0041}, {0xed,0x74,0x0024}, {0xf8,0x65,0x0087}, {0xf8,0x69,0x0045}, {0xf8,0xed,0x003c}, {0xf9,0x20,0x0027}, {0xfd,0x20,0x0060}, {0xfd,0x63,0x001d}, {0xfd,0x6d,0x0020}, // 240..255
};

#endif


static const short ch_stat_cp1250_pl1[256]={
Expand Down
4 changes: 1 addition & 3 deletions crengine/src/cri18n.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ const char * CRI18NTranslator::translate( const char * src )
}
return src; // return untranslated
}
const char * res = src;
#if CR_EMULATE_GETTEXT==1
res = src;
CRLog::trace("translation is not supported. returning source string: %s", src);
return src;
#else
res = gettext(src);
const char * res = gettext(src);
CRLog::trace("gettext(%s) is %s", src, res);
return res;
#endif
Expand Down
7 changes: 4 additions & 3 deletions crengine/src/crtxtenc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1697,7 +1697,7 @@ class CDoubleCharStat2
pData[k].count = 0;
}
}
delete[] pdata;
delete[] pdata; // cppcheck-suppress uninitdata
Close();
}

Expand Down Expand Up @@ -2070,10 +2070,11 @@ void MakeStatsForFile( const char * fname, const char * cp_name, const char * la
if (!in)
return;
fseek( in, 0, SEEK_END );
int buf_size = ftell(in);
long buf_size = ftell(in);
fseek( in, 0, SEEK_SET );
unsigned char * buf = new unsigned char[buf_size];
if ( fread(buf, 1, buf_size, in) != buf_size ) {
if ( (long)fread(buf, 1, buf_size, in) != buf_size ) {
delete [] buf;
fclose(in);
return;
}
Expand Down
Loading
Loading