From 4225af05ae9a693ede36b9dca4a5f53c6f081b64 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 3 Apr 2012 17:51:58 +0400 Subject: [PATCH] fix compile warnings --- cr3qt/src/settings.cpp | 6 +-- crengine/Tools/HyphConv/mkpattern.cpp | 3 +- crengine/include/crgui.h | 6 +-- crengine/include/crskin.h | 4 +- crengine/include/crtxtenc.h | 12 +++--- crengine/include/cssdef.h | 26 ++++++------- crengine/include/hist.h | 2 +- crengine/include/hyphman.h | 3 +- crengine/include/lvdocview.h | 6 +-- crengine/include/lvdrawbuf.h | 4 +- crengine/include/lvfntman.h | 2 +- crengine/include/lvimg.h | 2 +- crengine/include/lvpagesplitter.h | 2 +- crengine/include/lvstream.h | 2 +- crengine/include/lvstring.h | 18 ++++----- crengine/include/lvstsheet.h | 2 +- crengine/include/lvstyles.h | 2 +- crengine/include/lvtextfm.h | 8 ++-- crengine/include/lvtinydom.h | 25 ++++++------ crengine/include/rtfimp.h | 11 +++--- crengine/include/txtselector.h | 8 ++-- crengine/src/chmfmt.cpp | 16 ++++---- crengine/src/cri18n.cpp | 2 +- crengine/src/epubfmt.cpp | 42 ++++++++++---------- crengine/src/hist.cpp | 4 +- crengine/src/hyphman.cpp | 39 ++++++++++--------- crengine/src/lvdocview.cpp | 8 ++-- crengine/src/lvfntman.cpp | 10 +++-- crengine/src/lvimg.cpp | 4 +- crengine/src/lvpagesplitter.cpp | 2 +- crengine/src/lvrend.cpp | 12 ++++-- crengine/src/lvstream.cpp | 6 +-- crengine/src/lvstring.cpp | 20 +++++----- crengine/src/lvstsheet.cpp | 2 +- crengine/src/lvtextfm.cpp | 22 +++++------ crengine/src/lvtinydom.cpp | 56 +++++++++++++++++---------- crengine/src/lvxml.cpp | 2 +- crengine/src/pdbfmt.cpp | 14 +++---- crengine/src/wordfmt.cpp | 3 +- tinydict/tinydict.cpp | 2 +- 40 files changed, 224 insertions(+), 196 deletions(-) diff --git a/cr3qt/src/settings.cpp b/cr3qt/src/settings.cpp index d51151c6..1ceb1852 100644 --- a/cr3qt/src/settings.cpp +++ b/cr3qt/src/settings.cpp @@ -172,8 +172,8 @@ SettingsDlg::SettingsDlg(QWidget *parent, CR3View * docView ) : int n = m_props->getIntDef( PROP_PAGE_MARGIN_LEFT, 8 ); int mi = 0; - for ( int i=0; igetIntDef(PROP_INTERLINE_SPACE, 100)) + "%"; QStringList isitems; - for ( int i=0; icbInterlineSpace->addItems(isitems); int isi = m_ui->cbInterlineSpace->findText(v); diff --git a/crengine/Tools/HyphConv/mkpattern.cpp b/crengine/Tools/HyphConv/mkpattern.cpp index 363c62b3..9aa5074c 100644 --- a/crengine/Tools/HyphConv/mkpattern.cpp +++ b/crengine/Tools/HyphConv/mkpattern.cpp @@ -17,7 +17,7 @@ class Convertor { } ~Convertor() { fprintf(out, "\n"); - fclose(out); + //fclose(out); } void processLine(lString16 & line) { if (line.lastChar()=='\r' || line.lastChar()=='\n') @@ -89,5 +89,6 @@ int main(int argc, char* argv[]) cnv.processLine(line); } fclose(src); + fclose(out); return 0; } diff --git a/crengine/include/crgui.h b/crengine/include/crgui.h index bf19328a..33371fd0 100644 --- a/crengine/include/crgui.h +++ b/crengine/include/crgui.h @@ -325,7 +325,7 @@ enum CRGUIEventType { CREV_WM_EVENTS_START=100, CREV_UPDATE = 100, - CREV_RESIZE, + CREV_RESIZE }; @@ -367,7 +367,7 @@ class CRGUIScreen // for turbo updates enum UpdateMode { NormalMode, - PrepareMode, + PrepareMode }; virtual void setTurboUpdateEnabled( bool flg ) { } virtual bool getTurboUpdateEnabled() { return false; } @@ -990,7 +990,7 @@ enum CRMenuControlCmd { }; enum CRGUICmd { - GCMD_PASS_TO_PARENT = 550, + GCMD_PASS_TO_PARENT = 550 }; class CRMenu; diff --git a/crengine/include/crskin.h b/crengine/include/crskin.h index f9e968c1..fbd7c6cd 100644 --- a/crengine/include/crskin.h +++ b/crengine/include/crskin.h @@ -253,7 +253,7 @@ enum page_skin_type_t { PAGE_SKIN_SCROLL, PAGE_SKIN_LEFT_PAGE, PAGE_SKIN_RIGHT_PAGE, - PAGE_SKIN_SINGLE_PAGE, + PAGE_SKIN_SINGLE_PAGE }; class CRPageSkin : public CRSkinnedItem @@ -314,7 +314,7 @@ class CRScrollSkin : public CRRectSkin public: enum Location { Title, - Status, + Status }; protected: diff --git a/crengine/include/crtxtenc.h b/crengine/include/crtxtenc.h index 4b4fd63e..fd03303f 100644 --- a/crengine/include/crtxtenc.h +++ b/crengine/include/crtxtenc.h @@ -37,19 +37,19 @@ enum char_encoding_type { ce_utf16_le = 3, ce_utf32_be = 4, ce_utf32_le = 5, - ce_8bit_cp = 6, + ce_8bit_cp = 6 #if GBK_ENCODING_SUPPORT == 1 - ce_gbk = 7, + ,ce_gbk = 7 #endif #if JIS_ENCODING_SUPPORT == 1 - ce_euc_jis = 8, - ce_shift_jis = 9, + ,ce_euc_jis = 8 + ,ce_shift_jis = 9 #endif #if JIS_ENCODING_SUPPORT == 1 - ce_big5 = 10, + ,ce_big5 = 10 #endif #if EUC_KR_ENCODING_SUPPORT == 1 - ce_euc_kr = 11, + ,ce_euc_kr = 11 #endif }; diff --git a/crengine/include/cssdef.h b/crengine/include/cssdef.h index 86daa074..6e686003 100644 --- a/crengine/include/cssdef.h +++ b/crengine/include/cssdef.h @@ -39,7 +39,7 @@ enum css_display_t { css_d_table_column, css_d_table_cell, css_d_table_caption, - css_d_none, + css_d_none }; /// white-space property values @@ -47,7 +47,7 @@ enum css_white_space_t { css_ws_inherit, css_ws_normal, css_ws_pre, - css_ws_nowrap, + css_ws_nowrap }; /// text-align property values @@ -56,7 +56,7 @@ enum css_text_align_t { css_ta_left, css_ta_right, css_ta_center, - css_ta_justify, + css_ta_justify }; /// vertical-align property values @@ -69,7 +69,7 @@ enum css_vertical_align_t { css_va_text_top, css_va_middle, css_va_bottom, - css_va_text_bottom, + css_va_text_bottom }; /// text-decoration property values @@ -80,14 +80,14 @@ enum css_text_decoration_t { css_td_underline = 2, css_td_overline = 3, css_td_line_through = 4, - css_td_blink = 5, + css_td_blink = 5 }; /// hyphenate property values enum css_hyphenate_t { css_hyph_inherit = 0, css_hyph_none = 1, - css_hyph_auto = 2, + css_hyph_auto = 2 }; /// font-style property values @@ -95,7 +95,7 @@ enum css_font_style_t { css_fs_inherit, css_fs_normal, css_fs_italic, - css_fs_oblique, + css_fs_oblique }; /// font-weight property values @@ -113,7 +113,7 @@ enum css_font_weight_t { css_fw_600, css_fw_700, css_fw_800, - css_fw_900, + css_fw_900 }; /// font-family property values @@ -123,7 +123,7 @@ enum css_font_family_t { css_ff_sans_serif, css_ff_cursive, css_ff_fantasy, - css_ff_monospace, + css_ff_monospace }; /// page split property values @@ -133,7 +133,7 @@ enum css_page_break_t { css_pb_always, css_pb_avoid, css_pb_left, - css_pb_right, + css_pb_right }; /// list-style-type property values @@ -147,14 +147,14 @@ enum css_list_style_type_t { css_lst_upper_roman, css_lst_lower_alpha, css_lst_upper_alpha, - css_lst_none, + css_lst_none }; /// list-style-position property values enum css_list_style_position_t { css_lsp_inherit, css_lsp_inside, - css_lsp_outside, + css_lsp_outside }; /// css length value types @@ -170,7 +170,7 @@ enum css_value_type_t { css_val_pt, // 1/72 in css_val_pc, // 12 pt css_val_percent, - css_val_color, + css_val_color }; /// css length value diff --git a/crengine/include/hist.h b/crengine/include/hist.h index ca58285f..9f01d4ee 100644 --- a/crengine/include/hist.h +++ b/crengine/include/hist.h @@ -19,7 +19,7 @@ enum bmk_type { bmkt_lastpos, bmkt_pos, bmkt_comment, - bmkt_correction, + bmkt_correction }; class CRBookmark { diff --git a/crengine/include/hyphman.h b/crengine/include/hyphman.h index 1cda4f60..efe75689 100644 --- a/crengine/include/hyphman.h +++ b/crengine/include/hyphman.h @@ -35,7 +35,7 @@ enum HyphDictType HDT_NONE, // disable hyphenation HDT_ALGORITHM, // universal HDT_DICT_ALAN, // tex/alreader - HDT_DICT_TEX, // tex/fbreader + HDT_DICT_TEX // tex/fbreader }; class HyphDictionary @@ -53,6 +53,7 @@ class HyphDictionary lString16 getFilename() { return _filename; } bool activate(); virtual lUInt32 getHash() { return getTitle().getHash(); } + virtual ~HyphDictionary() { } }; #define HYPH_DICT_ID_NONE L"@none" diff --git a/crengine/include/lvdocview.h b/crengine/include/lvdocview.h index 8c647add..4caf8aaf 100755 --- a/crengine/include/lvdocview.h +++ b/crengine/include/lvdocview.h @@ -318,7 +318,7 @@ enum LVDocCmd DCMD_EDIT_HOME, DCMD_EDIT_END, DCMD_EDIT_INSERT_CHAR, - DCMD_EDIT_REPLACE_CHAR, + DCMD_EDIT_REPLACE_CHAR }; #define LVDOCVIEW_COMMANDS_END DCMD_TOGGLE_BOLD @@ -326,7 +326,7 @@ enum LVDocCmd enum LVDocViewMode { DVM_SCROLL, - DVM_PAGES, + DVM_PAGES }; /// document scroll position info @@ -354,7 +354,7 @@ enum { PGHDR_CLOCK=16, PGHDR_BATTERY=32, PGHDR_CHAPTER_MARKS=64, - PGHDR_PERCENT=128, + PGHDR_PERCENT=128 }; diff --git a/crengine/include/lvdrawbuf.h b/crengine/include/lvdrawbuf.h index 83c45b9e..8ea58f7a 100644 --- a/crengine/include/lvdrawbuf.h +++ b/crengine/include/lvdrawbuf.h @@ -32,7 +32,7 @@ enum cr_rotate_angle_t { CR_ROTATE_ANGLE_0 = 0, CR_ROTATE_ANGLE_90, CR_ROTATE_ANGLE_180, - CR_ROTATE_ANGLE_270, + CR_ROTATE_ANGLE_270 }; class LVFont; @@ -228,7 +228,7 @@ enum DrawBufPixelFormat DRAW_BUF_4_BPP = 4, /// 4 bpp, 1 pixel per byte, higher 4 bits are significant DRAW_BUF_8_BPP = 8, /// 8 bpp, 1 pixel per byte, all 8 bits are significant DRAW_BUF_16_BPP = 16, /// color 16bit RGB 565 - DRAW_BUF_32_BPP = 32, /// color 32bit RGB 888 + DRAW_BUF_32_BPP = 32 /// color 32bit RGB 888 }; /** diff --git a/crengine/include/lvfntman.h b/crengine/include/lvfntman.h index 2c6f5f11..d819d284 100644 --- a/crengine/include/lvfntman.h +++ b/crengine/include/lvfntman.h @@ -125,7 +125,7 @@ struct LVFontGlyphCacheItem enum hinting_mode_t { HINTING_MODE_DISABLED, HINTING_MODE_BYTECODE_INTERPRETOR, - HINTING_MODE_AUTOHINT, + HINTING_MODE_AUTOHINT }; diff --git a/crengine/include/lvimg.h b/crengine/include/lvimg.h index 630a2a70..2e65678d 100644 --- a/crengine/include/lvimg.h +++ b/crengine/include/lvimg.h @@ -51,7 +51,7 @@ enum ImageTransform { IMG_TRANSFORM_NONE, // just draw w/o any resizing/tiling IMG_TRANSFORM_SPLIT, // split at specified pixel, fill extra middle space with value of this pixel IMG_TRANSFORM_STRETCH, // stretch image proportionally to fill whole area - IMG_TRANSFORM_TILE, // tile image + IMG_TRANSFORM_TILE // tile image }; /// creates image which stretches source image by filling center with pixels at splitX, splitY diff --git a/crengine/include/lvpagesplitter.h b/crengine/include/lvpagesplitter.h index 9d361fb7..5944ec09 100644 --- a/crengine/include/lvpagesplitter.h +++ b/crengine/include/lvpagesplitter.h @@ -49,7 +49,7 @@ enum page_type_t { PAGE_TYPE_NORMAL = 0, - PAGE_TYPE_COVER = 1, + PAGE_TYPE_COVER = 1 }; /// footnote fragment inside page diff --git a/crengine/include/lvstream.h b/crengine/include/lvstream.h index bcfff65e..20c67106 100644 --- a/crengine/include/lvstream.h +++ b/crengine/include/lvstream.h @@ -58,7 +58,7 @@ enum lverror_t { LVERR_FAIL, ///< failed (unknown error) LVERR_EOF, ///< end of file reached LVERR_NOTFOUND, ///< file not found - LVERR_NOTIMPL, ///< method is not implemented + LVERR_NOTIMPL ///< method is not implemented }; /// File open modes enum diff --git a/crengine/include/lvstring.h b/crengine/include/lvstring.h index 058c7c26..cea1b437 100644 --- a/crengine/include/lvstring.h +++ b/crengine/include/lvstring.h @@ -113,8 +113,8 @@ struct lstring_chunk_t { const lChar16 * data16() const { return buf16; } const lChar8 * data8() const { return buf8; } private: - lUInt32 size; // 0 for free chunk - lUInt32 len; // count of chars in string + lInt32 size; // 0 for free chunk + lInt32 len; // count of chars in string int nref; // reference counter union { lstring_chunk_t * nextfree; @@ -144,7 +144,7 @@ namespace fmt { explicit hex(lInt64 v) : value(v) { } lUInt64 get() const { return value; } }; -}; +} /** \brief lChar8 string @@ -664,11 +664,11 @@ class lString16Collection void parse( lString16 string, lString16 delimiter, bool flgTrim ); void reserve(int space); int add( const lString16 & str ); - int add(const lChar16 * str) { add(lString16(str)); } - int add(const lChar8 * str) { add(lString16(str)); } + int add(const lChar16 * str) { return add(lString16(str)); } + int add(const lChar8 * str) { return add(lString16(str)); } void addAll( const lString16Collection & v ) { - for ( unsigned i=0; iSetPos(offset) == offset; + return (int)_stream->SetPos(offset) == offset; } bool eof() { return _stream->Eof(); @@ -327,9 +327,9 @@ class CHMBinaryReader { bytes.clear(); bytes.reserve(length); if ( offset>=0 ) - if ( _stream->SetPos(offset)!=offset ) + if ((int)_stream->SetPos(offset) != offset) return false; - for ( int i=0; iReadByte(); if ( b==-1 ) return false; @@ -343,7 +343,7 @@ class CHMBinaryReader { if ( length==0 ) return lString8::empty_str; if ( offset>=0 ) - if ( _stream->SetPos(offset)!=offset ) + if ((int)_stream->SetPos(offset) != offset) return lString8::empty_str; lString8 res; if ( length>0 ) @@ -366,7 +366,7 @@ class CHMBinaryReader { if ( length==0 ) return lString16::empty_str; if ( offset>=0 ) - if ( _stream->SetPos(offset)!=offset ) + if ((int)_stream->SetPos(offset) != offset) return lString16::empty_str; lString16 res; if ( length>0 ) @@ -438,8 +438,10 @@ class CHMUrlStr { const lUInt8 * maxdata = ptr + size; while ( data + 8 < maxdata ) { lUInt32 offset = blockOffset + (data - ptr); - lUInt32 urlOffset = readInt32(data); - lUInt32 frameOffset = readInt32(data); + //lUInt32 urlOffset = + readInt32(data); + //lUInt32 frameOffset = + readInt32(data); if ( data < maxdata ) { //urlOffset > offset ) { CHMUrlStrEntry * item = new CHMUrlStrEntry(); item->offset = offset; diff --git a/crengine/src/cri18n.cpp b/crengine/src/cri18n.cpp index a26e8394..7b082bd0 100644 --- a/crengine/src/cri18n.cpp +++ b/crengine/src/cri18n.cpp @@ -143,7 +143,7 @@ bool CRMoFileTranslator::openMoFile( lString16 fileName ) return false; if ( stream->Read( dstTable.get(), count*2 * sizeof(lUInt32), &bytesRead )!=LVERR_OK || bytesRead!=count*2 * sizeof(lUInt32) ) return false; - int i; + lUInt32 i; if ( rev ) { for ( i=0; i { } }; -static void dumpZip( LVContainerRef arc ) { - lString16 arcName = LVExtractFilenameWithoutExtension( arc->GetName() ); - if ( arcName.empty() ) - arcName = "unziparc"; - lString16 outDir = lString16("/tmp/") + arcName; - LVCreateDirectory(outDir); - for ( int i=0; iGetObjectCount(); i++ ) { - const LVContainerItemInfo * info = arc->GetObjectInfo(i); - if ( !info->IsContainer() ) { - lString16 outFileName = outDir + "/" + info->GetName(); - LVCreateDirectory(LVExtractPath(outFileName)); - LVStreamRef in = arc->OpenStream(info->GetName(), LVOM_READ); - LVStreamRef out = LVOpenFileStream(outFileName.c_str(), LVOM_WRITE); - if ( !in.isNull() && !out.isNull() ) { - CRLog::trace("Writing %s", LCSTR(outFileName)); - LVPumpStream(out.get(), in.get()); - } - } - } -} +//static void dumpZip( LVContainerRef arc ) { +// lString16 arcName = LVExtractFilenameWithoutExtension( arc->GetName() ); +// if ( arcName.empty() ) +// arcName = "unziparc"; +// lString16 outDir = lString16("/tmp/") + arcName; +// LVCreateDirectory(outDir); +// for ( int i=0; iGetObjectCount(); i++ ) { +// const LVContainerItemInfo * info = arc->GetObjectInfo(i); +// if ( !info->IsContainer() ) { +// lString16 outFileName = outDir + "/" + info->GetName(); +// LVCreateDirectory(LVExtractPath(outFileName)); +// LVStreamRef in = arc->OpenStream(info->GetName(), LVOM_READ); +// LVStreamRef out = LVOpenFileStream(outFileName.c_str(), LVOM_WRITE); +// if ( !in.isNull() && !out.isNull() ) { +// CRLog::trace("Writing %s", LCSTR(outFileName)); +// LVPumpStream(out.get(), in.get()); +// } +// } +// } +//} bool DetectEpubFormat( LVStreamRef stream ) { @@ -188,6 +188,7 @@ class EncryptedItem { class EncryptedItemCallback { public: virtual void addEncryptedItem(EncryptedItem * item) = 0; + virtual ~EncryptedItemCallback() {} }; @@ -851,7 +852,6 @@ bool ImportEpubDocument( LVStreamRef stream, ldomDocument * m_doc, LVDocViewCall } } - ldomDocument * ncxdoc = NULL; if ( !ncxHref.empty() ) { LVStreamRef stream = m_arc->OpenStream(ncxHref.c_str(), LVOM_READ); lString16 codeBase = LVExtractPath( ncxHref ); diff --git a/crengine/src/hist.cpp b/crengine/src/hist.cpp index 9e20b516..fd46d49c 100644 --- a/crengine/src/hist.cpp +++ b/crengine/src/hist.cpp @@ -42,7 +42,7 @@ class CRHistoryFileParserCallback : public LVXMLParserCallback in_series, in_filename, in_filepath, - in_filesize, + in_filesize }; state_t state; public: @@ -388,7 +388,7 @@ int CRFileHistRecord::getLastShortcutBookmark() /// returns first available placeholder for new bookmark, -1 if no more space int CRFileHistRecord::getFirstFreeShortcutBookmark() { - int last = -1; + //int last = -1; char flags[MAX_SHORTCUT_BOOKMARKS+1]; memset( flags, 0, sizeof(flags) ); for ( int i=0; i<_bookmarks.length(); i++ ) { diff --git a/crengine/src/hyphman.cpp b/crengine/src/hyphman.cpp index 3982b55e..c4af6aef 100755 --- a/crengine/src/hyphman.cpp +++ b/crengine/src/hyphman.cpp @@ -649,25 +649,26 @@ bool TexHyph::match( const lChar16 * str, char * mask ) return found; } -/// returns false if there is rule disabling hyphenation at specified point -static bool checkHyphenRules( const lChar16 * str, int len, int pos ) -{ - if ( pos<1 || pos>len-3 ) - return false; - lUInt16 props[2] = { 0, 0 }; - lStr_getCharProps( str+pos+1, 1, props); - if ( props[0]&CH_PROP_ALPHA_SIGN ) - return false; - if ( pos==len-3 ) { - lStr_getCharProps( str+len-2, 2, props); - return (props[0]&CH_PROP_VOWEL) || (props[1]&CH_PROP_VOWEL); - } - if ( pos==1 ) { - lStr_getCharProps( str, 2, props); - return (props[0]&CH_PROP_VOWEL) || (props[1]&CH_PROP_VOWEL); - } - return true; -} +//TODO: do we need it? +///// returns false if there is rule disabling hyphenation at specified point +//static bool checkHyphenRules( const lChar16 * str, int len, int pos ) +//{ +// if ( pos<1 || pos>len-3 ) +// return false; +// lUInt16 props[2] = { 0, 0 }; +// lStr_getCharProps( str+pos+1, 1, props); +// if ( props[0]&CH_PROP_ALPHA_SIGN ) +// return false; +// if ( pos==len-3 ) { +// lStr_getCharProps( str+len-2, 2, props); +// return (props[0]&CH_PROP_VOWEL) || (props[1]&CH_PROP_VOWEL); +// } +// if ( pos==1 ) { +// lStr_getCharProps( str, 2, props); +// return (props[0]&CH_PROP_VOWEL) || (props[1]&CH_PROP_VOWEL); +// } +// return true; +//} bool TexHyph::hyphenate( const lChar16 * str, int len, lUInt16 * widths, lUInt8 * flags, lUInt16 hyphCharWidth, lUInt16 maxWidth ) { diff --git a/crengine/src/lvdocview.cpp b/crengine/src/lvdocview.cpp index 35558af5..f4451b43 100755 --- a/crengine/src/lvdocview.cpp +++ b/crengine/src/lvdocview.cpp @@ -1512,7 +1512,7 @@ void LVDocView::drawPageHeader(LVDrawBuf * drawbuf, const lvRect & headerRc, // CRLog::trace("Status color = TRANSPARENT, textColor=%06x", getTextColor()); // } lUInt32 cl1 = m_statusColor!=0xFF000000 ? m_statusColor : getTextColor(); - lUInt32 cl2 = getBackgroundColor(); + //lUInt32 cl2 = getBackgroundColor(); lUInt32 cl3 = 0xD0D0D0; lUInt32 cl4 = 0xC0C0C0; drawbuf->SetTextColor(cl1); @@ -4809,7 +4809,7 @@ bool LVDocView::exportBookmarks(lString16 filename) { if (newContent.length() > 0) if (os->Write(newContent.c_str(), newContent.length(), &bytesWritten) != LVERR_OK || bytesWritten - != newContent.length()) + != (lUInt32)newContent.length()) return false; } return true; @@ -5273,7 +5273,7 @@ int LVDocView::onSelectionCommand( int cmd, int param ) int y0 = GetPos(); int h = m_pageRects[0].height() - m_pageMargins.top - m_pageMargins.bottom - getPageHeaderHeight(); - int y1 = y0 + h; + //int y1 = y0 + h; if (makeSelStartVisible) { // make start of selection visible if (startPoint.y < y0 + m_font_size * 2 || startPoint.y > y0 + h * 3/4) @@ -5627,7 +5627,7 @@ CRPropRef LVDocView::propsApply(CRPropRef props) { } else if (name == PROP_PAGE_MARGIN_TOP || name == PROP_PAGE_MARGIN_LEFT || name == PROP_PAGE_MARGIN_RIGHT || name == PROP_PAGE_MARGIN_BOTTOM) { - lUInt32 margin = props->getIntDef(name.c_str(), 8); + int margin = props->getIntDef(name.c_str(), 8); int maxmargin = (name == PROP_PAGE_MARGIN_LEFT || name == PROP_PAGE_MARGIN_RIGHT) ? m_dx / 3 : m_dy / 3; if (margin > maxmargin) margin = maxmargin; diff --git a/crengine/src/lvfntman.cpp b/crengine/src/lvfntman.cpp index 3a5e9c42..619f807b 100644 --- a/crengine/src/lvfntman.cpp +++ b/crengine/src/lvfntman.cpp @@ -1760,10 +1760,12 @@ class LVFontBoldTransform : public LVFont // } //} +#if (DEBUG_FONT_SYNTHESIS==1) static LVFontRef dumpFontRef( LVFontRef fnt ) { CRLog::trace("%s %d (%d) w=%d %s", fnt->getTypeFace().c_str(), fnt->getSize(), fnt->getHeight(), fnt->getWeight(), fnt->getItalic()?"italic":"" ); return fnt; -}; +} +#endif class LVFreeTypeFontManager : public LVFontManager { @@ -2340,7 +2342,7 @@ class LVFreeTypeFontManager : public LVFontManager LVStreamRef stream = container->OpenStream(name.c_str(), LVOM_READ); if (stream.isNull()) return false; - int size = (int)stream->GetSize(); + lUInt32 size = (lUInt32)stream->GetSize(); if (size < 100 || size > 5000000) return false; LVByteArrayRef buf(new LVByteArray(size, 0)); @@ -2957,8 +2959,8 @@ void LVBaseFont::DrawTextString( LVDrawBuf * buf, int x, int y, const lChar16 * text, int len, lChar16 def_char, lUInt32 * palette, bool addHyphen, lUInt32 , int ) { - static lUInt8 glyph_buf[16384]; - LVFont::glyph_info_t info; + //static lUInt8 glyph_buf[16384]; + //LVFont::glyph_info_t info; int baseline = getBaseline(); while (len>=(addHyphen?0:1)) { diff --git a/crengine/src/lvimg.cpp b/crengine/src/lvimg.cpp index e581a816..778dfeb8 100644 --- a/crengine/src/lvimg.cpp +++ b/crengine/src/lvimg.cpp @@ -444,8 +444,8 @@ class LVXPMImageSource : public LVImageSource } if ( *src == '#' ) { src++; - int c; - if ( sscanf( src, "%x", &c )!=1 ) { + unsigned c; + if ( sscanf(src, "%x", &c) != 1 ) { err = true; break; } diff --git a/crengine/src/lvpagesplitter.cpp b/crengine/src/lvpagesplitter.cpp index f33d8ffe..725ff010 100644 --- a/crengine/src/lvpagesplitter.cpp +++ b/crengine/src/lvpagesplitter.cpp @@ -433,7 +433,7 @@ bool LVRendPageList::deserialize( SerialBuf & buf ) buf >> len; clear(); reserve(len); - for ( int i=0; ideserialize( buf ); item->index = i; diff --git a/crengine/src/lvrend.cpp b/crengine/src/lvrend.cpp index bbc7c310..9988f8bd 100755 --- a/crengine/src/lvrend.cpp +++ b/crengine/src/lvrend.cpp @@ -367,6 +367,10 @@ class CCRTable { caption = item; } break; + case erm_inline: + case erm_runin: + // do nothing + break; } } } @@ -1840,9 +1844,11 @@ void setNodeStyle( ldomNode * enode, css_style_ref_t parent_style, LVFontRef par } // update inherited style attributes -// #define UPDATE_STYLE_FIELD(fld,inherit_value) \ -// if (pstyle->fld == inherit_value) \ -// pstyle->fld = parent_style->fld +/* + #define UPDATE_STYLE_FIELD(fld,inherit_value) \ + if (pstyle->fld == inherit_value) \ + pstyle->fld = parent_style->fld +*/ #define UPDATE_STYLE_FIELD(fld,inherit_value) \ if (pstyle->fld == inherit_value) \ pstyle->fld = parent_style->fld diff --git a/crengine/src/lvstream.cpp b/crengine/src/lvstream.cpp index 49b9a9d1..f5dd6fd0 100644 --- a/crengine/src/lvstream.cpp +++ b/crengine/src/lvstream.cpp @@ -1765,7 +1765,7 @@ class LVCachedStream : public LVNamedStream //if ( m_stream->SetPos( item->start )==(lvpos_t)(~0) ) if ( m_stream->SetPos( item->start )!=(lvpos_t)item->start ) return false; - int streamSize=m_stream->GetSize(); int bytesLeft = m_stream->GetSize() - m_stream->GetPos(); + //int streamSize=m_stream->GetSize(); int bytesLeft = m_stream->GetSize() - m_stream->GetPos(); lvsize_t bytesRead = 0; if ( m_stream->Read( item->buf, item->size, &bytesRead )!=LVERR_OK || bytesRead!=item->size ) return false; @@ -3831,10 +3831,10 @@ class LVBlockWriteStream : public LVNamedStream CRLog::trace("block %x save %x, %x", (int)block_start, (int)pos, (int)len); #endif int offset = (int)(pos - block_start); - if ( offset>size || (int)offset < 0 || len > size || (int)offset + (int)len > size ) { + if (offset > size || offset < 0 || (int)len > size || offset + (int)len > size) { CRLog::error("Unaligned access to block %x", (int)block_start); } - for ( unsigned i=0; iblock_end || ch1!=ptr[i] ) { buf[offset+i] = ptr[i]; diff --git a/crengine/src/lvstring.cpp b/crengine/src/lvstring.cpp index a5ba40d7..6b924d7f 100644 --- a/crengine/src/lvstring.cpp +++ b/crengine/src/lvstring.cpp @@ -1052,7 +1052,7 @@ bool lString16::atoi( lInt64 &n ) const lUInt32 lString16::getHash() const { lUInt32 res = 0; - for (lUInt32 i=0; ilen; i++) + for (lInt32 i=0; ilen; i++) res = res * STRING_HASH_MULT + pchunk->buf16[i]; return res; } @@ -1277,7 +1277,7 @@ bool lString16HashedCollection::deserialize( SerialBuf & buf ) clear(); int start = buf.pos(); buf.putMagic( str_hash_magic ); - lUInt32 count = 0; + lInt32 count = 0; buf >> count; for ( int i=0; i0 ) { + if (hashSize > 0) { hash = (HashPair *)malloc( sizeof(HashPair) * hashSize ); for ( int i=0; ilen && - (pchunk->buf8[firstns]==' ' || - pchunk->buf8[firstns]=='\t'); + firstns < pchunk->len && + (pchunk->buf8[firstns] == ' ' || + pchunk->buf8[firstns] == '\t'); ++firstns) ; if (firstns >= pchunk->len) @@ -2134,7 +2134,7 @@ lString8 & lString8::trim() (pchunk->buf8[lastns]==' ' || pchunk->buf8[lastns]=='\t'); --lastns) ; - size_t newlen = lastns-firstns+1; + int newlen = lastns-firstns+1; if (newlen == pchunk->len) return *this; if (pchunk->nref == 1) @@ -2472,7 +2472,7 @@ lString16 lString16::itoa( lUInt64 n ) lUInt32 lString8::getHash() const { lUInt32 res = 0; - for (lUInt32 i=0; ilen; i++) + for (int i=0; i < pchunk->len; i++) res = res * STRING_HASH_MULT + pchunk->buf8[i]; return res; } diff --git a/crengine/src/lvstsheet.cpp b/crengine/src/lvstsheet.cpp index 43f007dc..aed6e0c6 100644 --- a/crengine/src/lvstsheet.cpp +++ b/crengine/src/lvstsheet.cpp @@ -62,7 +62,7 @@ enum css_decl_code { cssd_list_style_type, cssd_list_style_position, cssd_list_style_image, - cssd_stop, + cssd_stop }; static const char * css_decl_name[] = { diff --git a/crengine/src/lvtextfm.cpp b/crengine/src/lvtextfm.cpp index 6ce3262e..47c2064d 100755 --- a/crengine/src/lvtextfm.cpp +++ b/crengine/src/lvtextfm.cpp @@ -76,7 +76,7 @@ void lvtextFreeFormattedLine( formatted_line_t * pline ) formatted_word_t * lvtextAddFormattedWord( formatted_line_t * pline ) { - lUInt32 size = (pline->word_count + FRM_ALLOC_SIZE-1) / FRM_ALLOC_SIZE * FRM_ALLOC_SIZE; + int size = (pline->word_count + FRM_ALLOC_SIZE-1) / FRM_ALLOC_SIZE * FRM_ALLOC_SIZE; if ( pline->word_count >= size) { size += FRM_ALLOC_SIZE; @@ -87,8 +87,8 @@ formatted_word_t * lvtextAddFormattedWord( formatted_line_t * pline ) formatted_line_t * lvtextAddFormattedLine( formatted_text_fragment_t * pbuffer ) { - lUInt32 size = (pbuffer->frmlinecount + FRM_ALLOC_SIZE-1) / FRM_ALLOC_SIZE * FRM_ALLOC_SIZE; - if ( pbuffer->frmlinecount >= size) + int size = (pbuffer->frmlinecount + FRM_ALLOC_SIZE-1) / FRM_ALLOC_SIZE * FRM_ALLOC_SIZE; + if (pbuffer->frmlinecount >= size) { size += FRM_ALLOC_SIZE; pbuffer->frmlines = (formatted_line_t**)realloc( pbuffer->frmlines, sizeof(formatted_line_t*)*(size) ); @@ -98,7 +98,7 @@ formatted_line_t * lvtextAddFormattedLine( formatted_text_fragment_t * pbuffer ) formatted_line_t * lvtextAddFormattedLineCopy( formatted_text_fragment_t * pbuffer, formatted_word_t * words, int words_count ) { - lUInt32 size = (pbuffer->frmlinecount + FRM_ALLOC_SIZE-1) / FRM_ALLOC_SIZE * FRM_ALLOC_SIZE; + int size = (pbuffer->frmlinecount + FRM_ALLOC_SIZE-1) / FRM_ALLOC_SIZE * FRM_ALLOC_SIZE; if ( pbuffer->frmlinecount >= size) { size += FRM_ALLOC_SIZE; @@ -131,7 +131,7 @@ void lvtextFreeFormatter( formatted_text_fragment_t * pbuffer ) { if (pbuffer->srctext) { - for (lUInt32 i=0; isrctextlen; i++) + for (int i=0; isrctextlen; i++) { if (pbuffer->srctext[i].flags & LTEXT_FLAG_OWNTEXT) free( (void*)pbuffer->srctext[i].t.text ); @@ -140,7 +140,7 @@ void lvtextFreeFormatter( formatted_text_fragment_t * pbuffer ) } if (pbuffer->frmlines) { - for (lUInt32 i=0; ifrmlinecount; i++) + for (int i=0; ifrmlinecount; i++) { lvtextFreeFormattedLine( pbuffer->frmlines[i] ); } @@ -164,7 +164,7 @@ void lvtextAddSourceLine( formatted_text_fragment_t * pbuffer, lInt8 letter_spacing ) { - lUInt32 srctextsize = (pbuffer->srctextlen + FRM_ALLOC_SIZE-1) / FRM_ALLOC_SIZE * FRM_ALLOC_SIZE; + int srctextsize = (pbuffer->srctextlen + FRM_ALLOC_SIZE-1) / FRM_ALLOC_SIZE * FRM_ALLOC_SIZE; if ( pbuffer->srctextlen >= srctextsize) { srctextsize += FRM_ALLOC_SIZE; @@ -206,7 +206,7 @@ void lvtextAddSourceObject( lInt8 letter_spacing ) { - lUInt32 srctextsize = (pbuffer->srctextlen + FRM_ALLOC_SIZE-1) / FRM_ALLOC_SIZE * FRM_ALLOC_SIZE; + int srctextsize = (pbuffer->srctextlen + FRM_ALLOC_SIZE-1) / FRM_ALLOC_SIZE * FRM_ALLOC_SIZE; if ( pbuffer->srctextlen >= srctextsize) { srctextsize += FRM_ALLOC_SIZE; @@ -1093,7 +1093,7 @@ static void freeFrmLines( formatted_text_fragment_t * m_pbuffer ) // clear existing formatted data, if any if (m_pbuffer->frmlines) { - for (lUInt32 i=0; ifrmlinecount; i++) + for (int i=0; ifrmlinecount; i++) { lvtextFreeFormattedLine( m_pbuffer->frmlines[i] ); } @@ -1187,7 +1187,7 @@ void DrawBookmarkTextUnderline(LVDrawBuf & drawbuf, int x0, int y0, int x1, int void LFormattedText::Draw( LVDrawBuf * buf, int x, int y, ldomMarkedRangeList * marks, ldomMarkedRangeList *bookmarks ) { - lUInt32 i, j; + int i, j; formatted_line_t * frmline; src_text_fragment_t * srcline; formatted_word_t * word; @@ -1205,7 +1205,7 @@ void LFormattedText::Draw( LVDrawBuf * buf, int x, int y, ldomMarkedRangeList * { // process background - lUInt32 bgcl = buf->GetBackgroundColor(); + //lUInt32 bgcl = buf->GetBackgroundColor(); //buf->FillRect( x+frmline->x, y + frmline->y, x+frmline->x + frmline->width, y + frmline->y + frmline->height, bgcl ); // draw background for each word diff --git a/crengine/src/lvtinydom.cpp b/crengine/src/lvtinydom.cpp index 8265e343..274d9081 100755 --- a/crengine/src/lvtinydom.cpp +++ b/crengine/src/lvtinydom.cpp @@ -126,7 +126,7 @@ enum CacheFileBlockType { CBT_STYLE_DATA, CBT_BLOB_INDEX, //15 CBT_BLOB_DATA, - CBT_FONT_DATA, //17 + CBT_FONT_DATA //17 }; @@ -754,7 +754,7 @@ CacheFileItem * CacheFile::allocBlock( lUInt16 type, lUInt16 index, int size ) bool CacheFile::validate( CacheFileItem * block ) { lUInt8 * buf = NULL; - int size = 0; + unsigned size = 0; if ( (int)_stream->SetPos( block->_blockFilePos )!=block->_blockFilePos ) { CRLog::error("CacheFile::validate: Cannot set position for block %d:%d of size %d", block->_dataType, block->_dataIndex, (int)size); @@ -1690,7 +1690,7 @@ bool tinyNodeCollection::loadNodeData( lUInt16 type, ldomNode ** list, int nodec if ( !_cacheFile->read( type, i, p, buflen ) ) return false; ldomNode * buf = (ldomNode *)p; - if ( !buf || (int)buflen != sizeof(ldomNode)*sz ) + if (!buf || (unsigned)buflen != sizeof(ldomNode)*sz ) return false; list[i] = buf; for ( int j=0; j> uncompsize; if ( buf.error() ) { _chunks.clear(); @@ -2291,26 +2291,26 @@ ldomDataStorageManager::~ldomDataStorageManager() /// create chunk to be read from cache file ldomTextStorageChunk::ldomTextStorageChunk( ldomDataStorageManager * manager, int index, int compsize, int uncompsize ) : _manager(manager) +, _nextRecent(NULL) +, _prevRecent(NULL) , _buf(NULL) /// buffer for uncompressed data , _bufsize(0) /// _buf (uncompressed) area size, bytes , _bufpos(uncompsize) /// _buf (uncompressed) data write position (for appending of new data) , _index(index) /// ? index of chunk in storage , _type( manager->_type ) -, _nextRecent(NULL) -, _prevRecent(NULL) , _saved(true) { } ldomTextStorageChunk::ldomTextStorageChunk( int preAllocSize, ldomDataStorageManager * manager, int index ) : _manager(manager) +, _nextRecent(NULL) +, _prevRecent(NULL) , _buf(NULL) /// buffer for uncompressed data , _bufsize(preAllocSize) /// _buf (uncompressed) area size, bytes , _bufpos(preAllocSize) /// _buf (uncompressed) data write position (for appending of new data) , _index(index) /// ? index of chunk in storage , _type( manager->_type ) -, _nextRecent(NULL) -, _prevRecent(NULL) , _saved(false) { _buf = (lUInt8*)malloc(preAllocSize); @@ -2320,13 +2320,13 @@ ldomTextStorageChunk::ldomTextStorageChunk( int preAllocSize, ldomDataStorageMan ldomTextStorageChunk::ldomTextStorageChunk( ldomDataStorageManager * manager, int index ) : _manager(manager) +, _nextRecent(NULL) +, _prevRecent(NULL) , _buf(NULL) /// buffer for uncompressed data , _bufsize(0) /// _buf (uncompressed) area size, bytes , _bufpos(0) /// _buf (uncompressed) data write position (for appending of new data) , _index(index) /// ? index of chunk in storage , _type( manager->_type ) -, _nextRecent(NULL) -, _prevRecent(NULL) , _saved(false) { } @@ -2929,6 +2929,7 @@ lxmlDocBase::lxmlDocBase( lxmlDocBase & doc ) /// creates empty document which is ready to be copy target of doc partial contents ldomDocument::ldomDocument( ldomDocument & doc ) : lxmlDocBase(doc) +, m_toc(this) #if BUILD_LITE!=1 , _def_font(doc._def_font) // default font , _def_style(doc._def_style) @@ -2938,7 +2939,6 @@ ldomDocument::ldomDocument( ldomDocument & doc ) #endif , _container(doc._container) , lists(100) -, m_toc(this) { } @@ -4957,7 +4957,7 @@ bool ldomXPointer::getRect(lvRect & rect) const const formatted_line_t * frmline = txtform->GetLineInfo(l); for ( int w=0; w<(int)frmline->word_count; w++ ) { const formatted_word_t * word = &frmline->words[w]; - bool lastWord = (l==txtform->GetLineCount()-1 && w==frmline->word_count-1); + bool lastWord = (l == txtform->GetLineCount() - 1 && w == frmline->word_count - 1); if ( word->src_text_index>=srcIndex || lastWord ) { // found word from same src line if ( word->src_text_index>srcIndex || offset<=word->t.start ) { @@ -6797,6 +6797,8 @@ int ldomMarkedRange::calcDistance( int x, int y, MoveDirection dir ) { case DIR_UP: case DIR_DOWN: return dx + dy*100; + case DIR_ANY: + return dx + dy; } @@ -6955,6 +6957,11 @@ ldomWordEx * ldomWordExList::findNearestWord( int x, int y, MoveDirection dir ) if ( middle.x<=x ) continue; break; + case DIR_UP: + case DIR_DOWN: + case DIR_ANY: + // none + break; } if ( middle.y!=thisLineY ) continue; @@ -8532,7 +8539,7 @@ class ldomDocCacheImpl : public ldomDocCache lUInt32 start = buf.pos(); lUInt32 count; buf >> count; - for ( int i=0; i> item->filename; @@ -9359,7 +9366,7 @@ ldomNode * ldomNode::getChildNode( lUInt32 index ) const } /// returns element child count -lUInt32 ldomNode::getChildCount() const +int ldomNode::getChildCount() const { ASSERT_NODE_NOT_NULL; if ( !isElement() ) @@ -9387,7 +9394,7 @@ lUInt32 ldomNode::getChildCount() const } /// returns element attribute count -lUInt32 ldomNode::getAttrCount() const +int ldomNode::getAttrCount() const { ASSERT_NODE_NOT_NULL; if ( !isElement() ) @@ -9740,8 +9747,8 @@ lString8 ldomNode::getText8( lChar8 blockDelimiter, int maxSize ) const case NT_PELEMENT: { lString8 txt; - unsigned cc = getChildCount(); - for ( unsigned i=0; igetText8(blockDelimiter, maxSize); if (maxSize != 0 && txt.length() > maxSize) @@ -10285,7 +10292,7 @@ bool ldomNode::getNodeListMarker( int & counterValue, lString16 & marker, int & // calculate counter ldomNode * parent = getParentNode(); counterValue = 0; - for ( unsigned i=0; igetChildCount(); i++ ) { + for (int i = 0; i < parent->getChildCount(); i++) { ldomNode * child = parent->getChildNode(i); css_style_ref_t cs = child->getStyle(); if ( cs.isNull() ) @@ -10311,19 +10318,19 @@ bool ldomNode::getNodeListMarker( int & counterValue, lString16 & marker, int & static const char * lower_roman[] = {"i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix", "x", "xi", "xii", "xiii", "xiv", "xv", "xvi", "xvii", "xviii", "xix", "xx", "xxi", "xxii", "xxiii"}; - if ( counterValue>0 ) { + if (counterValue > 0) { switch (st) { case css_lst_decimal: marker = lString16::itoa(counterValue); break; case css_lst_lower_roman: - if ( counterValue-1>= 1) { if (!(_mobiExtraDataFlags & flag)) continue; - lUInt32 n = buf[buf.length()-1]; + lInt32 n = buf[buf.length()-1]; if (flag == 1) { n &= 3; @@ -778,7 +778,7 @@ class PDBFile : public LVNamedStream { cnv.rev(&recCount); } LVArray buf; - for (int i=0; iRead(&recType); @@ -834,7 +834,7 @@ class PDBFile : public LVNamedStream { lString16 name = lString16(MOBI_IMAGE_NAME_PREFIX) + fmt::decimal((int)(index-preamble.firstImageIndex)); //CRLog::debug("Adding image %s [%d] %s", LCSTR(name), _records[index].size, fmt); container->addItem( new LVPDBRegionContainerItem( stream, this, name, _records[index].offset, _records[index].size ) ); - if (index == preamble.firstImageIndex + coverOffset) { + if ((unsigned)index == preamble.firstImageIndex + coverOffset) { m_doc_props->setString(DOC_PROP_COVER_FILE, name); CRLog::trace("MOBI COVER: %s", LCSTR(name)); } @@ -945,9 +945,9 @@ class PDBFile : public LVNamedStream { } #endif - if ( _textSize==-1 ) + if (_textSize == (lUInt32)-1) _textSize = unpoffset; - else if ( unpoffset<_textSize ) { + else if (unpoffset < _textSize) { CRLog::warn("PDB: Unpacked text size is %d but expected %d", unpoffset, _textSize); _textSize = unpoffset; //return false; // text size does not match diff --git a/crengine/src/wordfmt.cpp b/crengine/src/wordfmt.cpp index 55e8cfca..ebd948e6 100644 --- a/crengine/src/wordfmt.cpp +++ b/crengine/src/wordfmt.cpp @@ -316,7 +316,7 @@ vSubstring2Diagram(diagram_type *pDiag, extern "C" { void vStoreStyle(diagram_type *pDiag, output_type *pOutput, const style_block_type *pStyle); -}; +} /* * vStoreStyle - store a style @@ -723,7 +723,6 @@ bool DetectWordFormat( LVStreamRef stream ) setOptions(); - BOOL bResult = 0; lUInt32 lFilesize = (lUInt32)stream->GetSize(); int iWordVersion = iGuessVersionNumber(file, lFilesize); if (iWordVersion < 0 || iWordVersion == 3) { diff --git a/tinydict/tinydict.cpp b/tinydict/tinydict.cpp index ff63f883..ad96c51c 100644 --- a/tinydict/tinydict.cpp +++ b/tinydict/tinydict.cpp @@ -453,7 +453,7 @@ bool TinyDictIndexFile::open( const char * filename ) enum { DICT_TEXT, DICT_GZIP, - DICT_DZIP, + DICT_DZIP }; bool TinyDictZStream::zinit( unsigned char * next_in, unsigned avail_in, unsigned char * next_out, unsigned avail_out )