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 a bunch of -Wall warnings, part 3 #595

Merged
merged 17 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
e8e60c2
cp_stats: fix compiler warnings [-Wunused-const-variable]
benoit-pierre Aug 1, 2024
4891978
docxfmt & odtfmt: fix compiler warnings [-Woverloaded-virtual]
benoit-pierre Aug 1, 2024
c254597
docxfmt: fix compiler warnings [-Woverloaded-virtual]
benoit-pierre Aug 1, 2024
c1d9610
docxfmt: fix compiler warning [-Wunused-const-variable]
benoit-pierre Aug 1, 2024
7079bef
docxfmt: fix compiler warning [-Wunused-private-field]
benoit-pierre Aug 1, 2024
7ce911b
lvdrawbuf: fix compiler warning [-Wunused-function]
benoit-pierre Aug 1, 2024
3d56978
lvfntman: fix spurious compiler warning [-Wmaybe-uninitialized]
benoit-pierre Aug 1, 2024
b29b5f2
lvimg: fix compiler warning [-Wmisleading-indentation]
benoit-pierre Aug 1, 2024
330a2a9
lvmemman: fix compiler warning [-Wmissing-braces]
benoit-pierre Aug 1, 2024
cffecac
lvrend: fix spurious compiler warning [-Wmaybe-uninitialized]
benoit-pierre Aug 1, 2024
dbe0d6a
lvstsheet: fix spurious compiler warning [-Wmaybe-uninitialized]
benoit-pierre Aug 1, 2024
ae0791c
lvtextfm: fix compiler warning [-Wmaybe-uninitialized]
benoit-pierre Aug 1, 2024
9d00e13
lvtinydom: fix compiler warning [-Wunneeded-internal-declaration]
benoit-pierre Aug 1, 2024
19e71b4
lvxml: fix compiler warning [-Wmisleading-indentation]
benoit-pierre Aug 1, 2024
9bab237
lvxml: fix compiler warning [-Wunused-private-field]
benoit-pierre Aug 1, 2024
faec570
mathml: fix compiler warning [-Wmaybe-uninitialized]
benoit-pierre Aug 1, 2024
4b300d7
pdbfmt: fix compiler warning [-Wmissing-braces]
benoit-pierre Aug 1, 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: 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
70 changes: 32 additions & 38 deletions crengine/src/docxfmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ const struct item_def_t styles_elements[] = {
DOCX_LAST_ITEM
};

enum docx_multilevel_type {
docx_hybrid_multilevel,
docx_multilevel,
docx_singlelevel
};

#define DOCX_NUM_FMT(itm) docx_numFormat_##itm ,
#define DOCX_TAG(itm)
enum docx_numFormat_type {
Expand Down Expand Up @@ -215,10 +209,6 @@ const struct item_def_t footnotes_elements[] = {
DOCX_LAST_ITEM
};

const struct item_def_t no_elements[] = {
DOCX_LAST_ITEM
};

const struct item_def_t jc_attr_values[] = {
{ css_ta_left, U"left"},
{ css_ta_right, U"right" },
Expand Down Expand Up @@ -337,7 +327,6 @@ typedef LVFastRef< docxNumLevel > docxNumLevelRef;
class docxAbstractNum : public LVRefCounter
{
private:
docx_multilevel_type m_multilevel;
css_length_t m_abstractNumId;
LVHashTable<lUInt32, docxNumLevelRef> m_levels;
public:
Expand Down Expand Up @@ -442,7 +431,8 @@ class docx_rPrHandler : public docx_ElementHandler
{
}
ldomNode * handleTagOpen(int tagId);
void handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue);
void handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue);
void start() { docx_ElementHandler::start(); };
void start(odx_rPr *rPr);
void reset();
};
Expand All @@ -457,7 +447,7 @@ class docx_drawingHandler : public docx_ElementHandler
{
}
ldomNode * handleTagOpen(int tagId);
void handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue);
void handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue);
void handleTagClose( const lChar32 * nsname, const lChar32 * tagname );
void reset() { m_level = 1; }
};
Expand All @@ -484,7 +474,7 @@ class docx_rHandler : public docx_ElementHandler
{
}
ldomNode * handleTagOpen(int tagId);
void handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue);
void handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue);
void handleText( const lChar32 * text, int len, lUInt32 flags );
void handleTagClose( const lChar32 * nsname, const lChar32 * tagname );
void reset();
Expand All @@ -500,8 +490,9 @@ class docx_pPrHandler : public docx_ElementHandler
{
}
ldomNode * handleTagOpen(int tagId);
void handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue);
void handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue);
void handleTagClose( const lChar32 * nsname, const lChar32 * tagname );
void start() { docx_ElementHandler::start(); };
void start(odx_pPr *pPr);
void reset();
};
Expand All @@ -518,7 +509,7 @@ class docx_hyperlinkHandler : public docx_ElementHandler
{
}
ldomNode * handleTagOpen(int tagId);
void handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue);
void handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue);
void handleTagClose( const lChar32 * nsname, const lChar32 * tagname );
void reset() { m_target.clear(); m_rHandler.reset(); m_runCount = 0; }
};
Expand All @@ -545,7 +536,7 @@ class docx_pHandler : public docx_ElementHandler, public odx_styleTagsHandler
{
}
ldomNode * handleTagOpen(int tagId);
void handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue);
void handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue);
void handleTagClose( const lChar32 * nsname, const lChar32 * tagname );
void reset();
};
Expand Down Expand Up @@ -587,7 +578,7 @@ class docx_tblHandler : public docx_ElementHandler
{
}
ldomNode * handleTagOpen(int tagId);
void handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue);
void handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue);
void handleTagClose( const lChar32 * nsname, const lChar32 * tagname );
void reset();
};
Expand All @@ -607,7 +598,7 @@ class docx_footnotesHandler : public docx_ElementHandler
{
}
ldomNode * handleTagOpen(int tagId);
void handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue);
void handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue);
void handleTagClose( const lChar32 * nsname, const lChar32 * tagname );
};

Expand Down Expand Up @@ -646,7 +637,7 @@ class docx_styleHandler : public docx_ElementHandler
{
}
ldomNode * handleTagOpen(int tagId);
void handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue);
void handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue);
void handleTagClose( const lChar32 * nsname, const lChar32 * tagname );
void start();
};
Expand Down Expand Up @@ -686,11 +677,14 @@ class docx_lvlHandler : public docx_ElementHandler
m_rPrHandler(reader, writer, context)
{
}
void start() {
docx_ElementHandler::start();
}
void start(docxNumLevel* level) {
m_lvl = level;
docx_ElementHandler::start();
start();
}
void handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue);
void handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue);
ldomNode * handleTagOpen(int tagId);
void reset();
};
Expand All @@ -706,7 +700,7 @@ class docx_numHandler : public docx_ElementHandler
m_lvlHandler(reader, writer, context)
{
}
void handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue);
void handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue);
ldomNode * handleTagOpen(int tagId);
void handleTagClose( const lChar32 * nsname, const lChar32 * tagname );
void start();
Expand All @@ -723,7 +717,7 @@ class docx_abstractNumHandler : public docx_ElementHandler
m_lvlHandler(reader, writer, context)
{
}
void handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue);
void handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue);
ldomNode * handleTagOpen(int tagId);
void handleTagClose( const lChar32 * nsname, const lChar32 * tagname );
void start();
Expand Down Expand Up @@ -854,7 +848,7 @@ ldomNode * docx_rPrHandler::handleTagOpen(int tagId)
return NULL;
}

void docx_rPrHandler::handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue)
void docx_rPrHandler::handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue)
{
int attr_value;
switch(m_state) {
Expand Down Expand Up @@ -926,7 +920,7 @@ void docx_rPrHandler::reset()
void docx_rPrHandler::start(odx_rPr * const rPr)
{
m_rPr = rPr;
docx_ElementHandler::start();
start();
}

void docx_rHandler::handleInstruction(lString32 &instruction, lString32 parameters)
Expand Down Expand Up @@ -980,7 +974,7 @@ ldomNode *docx_rHandler::handleTagOpen(int tagId)
return NULL;
}

void docx_rHandler::handleAttribute(const lChar32 *attrname, const lChar32 *attrvalue)
void docx_rHandler::handleAttribute(const lChar32 * nsname, const lChar32 *attrname, const lChar32 *attrvalue)
{
if( (docx_el_footnoteReference == m_state || docx_el_endnoteReference == m_state) &&
!lStr_cmp(attrname, "id") ) {
Expand Down Expand Up @@ -1110,7 +1104,7 @@ ldomNode * docx_pPrHandler::handleTagOpen(int tagId)
return NULL;
}

void docx_pPrHandler::handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue)
void docx_pPrHandler::handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue)
{
switch(m_state) {
case docx_el_pStyle:
Expand Down Expand Up @@ -1277,7 +1271,7 @@ ldomNode * docx_pHandler::handleTagOpen(int tagId)
return NULL;
}

void docx_pHandler::handleAttribute(const lChar32 *attrname, const lChar32 *attrvalue)
void docx_pHandler::handleAttribute(const lChar32 * nsname, const lChar32 *attrname, const lChar32 *attrvalue)
{
if( docx_el_bookmarkStart == m_state && !lStr_cmp(attrname, "name") ) {
m_writer->OnTagOpen(U"", U"a");
Expand Down Expand Up @@ -1380,7 +1374,7 @@ ldomNode * docx_styleHandler::handleTagOpen(int tagId)
return NULL;
}

void docx_styleHandler::handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue)
void docx_styleHandler::handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue)
{
switch(m_state) {
case docx_el_style:
Expand Down Expand Up @@ -1727,7 +1721,7 @@ ldomNode * docx_lvlHandler::handleTagOpen(int tagId)
return NULL;
}

void docx_lvlHandler::handleAttribute(const lChar32 *attrname, const lChar32 *attrvalue)
void docx_lvlHandler::handleAttribute(const lChar32 * nsname, const lChar32 *attrname, const lChar32 *attrvalue)
{
css_length_t result;

Expand Down Expand Up @@ -1842,7 +1836,7 @@ ldomNode *docx_footnotesHandler::handleTagOpen(int tagId)
return NULL;
}

void docx_footnotesHandler::handleAttribute(const lChar32 *attrname, const lChar32 *attrvalue)
void docx_footnotesHandler::handleAttribute(const lChar32 * nsname, const lChar32 *attrname, const lChar32 *attrvalue)
{
switch(m_state) {
case docx_el_footnote:
Expand Down Expand Up @@ -1892,7 +1886,7 @@ ldomNode *docx_hyperlinkHandler::handleTagOpen(int tagId)
return NULL;
}

void docx_hyperlinkHandler::handleAttribute(const lChar32 *attrname, const lChar32 *attrvalue)
void docx_hyperlinkHandler::handleAttribute(const lChar32 * nsname, const lChar32 *attrname, const lChar32 *attrvalue)
{
if( docx_el_hyperlink == m_state) {
if ( !lStr_cmp(attrname, "id") ) {
Expand Down Expand Up @@ -1923,7 +1917,7 @@ ldomNode *docx_drawingHandler::handleTagOpen(int tagId)
return NULL;
}

void docx_drawingHandler::handleAttribute(const lChar32 *attrname, const lChar32 *attrvalue)
void docx_drawingHandler::handleAttribute(const lChar32 * nsname, const lChar32 *attrname, const lChar32 *attrvalue)
{
if( m_state == docx_el_blip && !lStr_cmp(attrname, "embed") ) {
lString32 imgPath = m_importContext->getImageTarget(lString32(attrvalue));
Expand Down Expand Up @@ -1990,7 +1984,7 @@ ldomNode *docx_tblHandler::handleTagOpen(int tagId)
return NULL;
}

void docx_tblHandler::handleAttribute(const lChar32 *attrname, const lChar32 *attrvalue)
void docx_tblHandler::handleAttribute(const lChar32 * nsname, const lChar32 *attrname, const lChar32 *attrvalue)
{
if( m_state == docx_el_gridSpan && !lStr_cmp( attrname, "val" ) ) {
m_colSpan = lString32(attrvalue).atoi();
Expand Down Expand Up @@ -2117,7 +2111,7 @@ ldomNode *docx_abstractNumHandler::handleTagOpen(int tagId)
return NULL;
}

void docx_abstractNumHandler::handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue)
void docx_abstractNumHandler::handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue)
{
switch(m_state) {
case docx_el_abstractNum:
Expand Down Expand Up @@ -2153,7 +2147,7 @@ void docx_abstractNumHandler::start()
docx_ElementHandler::start();
}

void docx_numHandler::handleAttribute(const lChar32 *attrname, const lChar32 *attrvalue)
void docx_numHandler::handleAttribute(const lChar32 * nsname, const lChar32 *attrname, const lChar32 *attrvalue)
{
switch(m_state) {
case docx_el_num:
Expand Down Expand Up @@ -2248,7 +2242,7 @@ void docxAbstractNum::addLevel(docxNumLevelRef docxLevel)
m_levels.set(docxLevel->getLevel().value, docxLevel);
}

docxAbstractNum::docxAbstractNum() : m_multilevel(docx_singlelevel),
docxAbstractNum::docxAbstractNum() :
m_abstractNumId(css_val_unspecified, 0), m_levels(10)
{
}
Expand Down
2 changes: 2 additions & 0 deletions crengine/src/lvdrawbuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1606,9 +1606,11 @@ inline static lUInt32 BB(lUInt32 color) {
return color & 0xFF;
}

#if 0
inline static lUInt32 RRGGBB(lUInt32 r, lUInt32 g, lUInt32 b) {
return ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF);
}
#endif

inline static lUInt32 AARRGGBB(lUInt32 a, lUInt32 r, lUInt32 g, lUInt32 b) {
return ((a & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF);
Expand Down
2 changes: 1 addition & 1 deletion crengine/src/lvfntman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ class LVFontCache
{
int base_weight = bold ? 700 : 400;
LVFontDef * best_def = NULL;
int best_delta;
int best_delta = INT_MAX;
for ( int i=0; i<_registered_list.length(); i++ ) {
if (_registered_list[i]->getDef()->getDocumentId() == -1) {
LVFontDef * fdef = _registered_list[i]->getDef();
Expand Down
2 changes: 1 addition & 1 deletion crengine/src/lvimg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ bool LVPngImageSource::Decode( LVImageDecoderCallback * callback )
png_set_packing(png_ptr);

//if (color_type == PNG_COLOR_TYPE_RGB)
png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
Frenzie marked this conversation as resolved.
Show resolved Hide resolved

//if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
// png_set_swap_alpha(png_ptr);
Expand Down
8 changes: 4 additions & 4 deletions crengine/src/odtfmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class odt_stylesHandler : public xml_ElementHandler
{
}
ldomNode * handleTagOpen(int tagId);
void handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue);
void handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue);
void handleTagClose( const lChar32 * nsname, const lChar32 * tagname );
};

Expand Down Expand Up @@ -381,7 +381,7 @@ class odt_documentHandler : public xml_ElementHandler, odx_styleTagsHandler
}
inline bool isInList() { return m_ListLevels.length() != 0; }
ldomNode *handleTagOpen(int tagId);
void handleAttribute(const lChar32 *attrname, const lChar32 *attrValue);
void handleAttribute(const lChar32 * nsname, const lChar32 *attrname, const lChar32 *attrValue);
void handleTagBody();
void handleTagClose(const lChar32 *nsname, const lChar32 *tagname);
void handleText(const lChar32 *text, int len, lUInt32 flags);
Expand Down Expand Up @@ -615,7 +615,7 @@ ldomNode *odt_documentHandler::handleTagOpen(int tagId)
return NULL;
}

void odt_documentHandler::handleAttribute(const lChar32 *attrname, const lChar32 *attrValue)
void odt_documentHandler::handleAttribute(const lChar32 * nsname, const lChar32 *attrname, const lChar32 *attrValue)
{
switch (m_state) {
case odt_el_bookmark:
Expand Down Expand Up @@ -890,7 +890,7 @@ ldomNode *odt_stylesHandler::handleTagOpen(int tagId)
return NULL;
}

void odt_stylesHandler::handleAttribute(const lChar32 *attrname, const lChar32 *attrvalue)
void odt_stylesHandler::handleAttribute(const lChar32 * nsname, const lChar32 *attrname, const lChar32 *attrvalue)
{
switch(m_state) {
case odt_el_style:
Expand Down
9 changes: 2 additions & 7 deletions crengine/src/odxutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,14 +408,9 @@ class xml_ElementHandler
void setChildrenInfo(const struct item_def_t *tags);
ldomNode * handleTagOpen(const lChar32 * nsname, const lChar32 * tagname);
virtual ldomNode * handleTagOpen(int tagId);
void handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue)
virtual void handleAttribute(const lChar32 * nsname, const lChar32 * attrname, const lChar32 * attrvalue)
{
CR_UNUSED(nsname);

handleAttribute(attrname, attrvalue);
}
virtual void handleAttribute(const lChar32 * attrname, const lChar32 * attrvalue) {
CR_UNUSED2(attrname, attrvalue);
CR_UNUSED3(nsname, attrname, attrvalue);
}
virtual void handleTagBody() {}
virtual void handleText( const lChar32 * text, int len, lUInt32 flags ) {
Expand Down