From 5b916e8d20cf796d368a06ac4e387e8ff94cb6d6 Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 31 Jul 2016 05:49:54 +0000 Subject: [PATCH] RichText: Fixed parti issue in GetValPos, lz4 now using Function instead of Gate for progress git-svn-id: svn://ultimatepp.org/upp/trunk@10116 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Callback.h | 5 +++-- uppsrc/RichText/TxtPaint.cpp | 3 ++- uppsrc/plugin/lz4/lz4.h | 25 ++++++++++++------------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/uppsrc/Core/Callback.h b/uppsrc/Core/Callback.h index f13fec1ed..2b97ee419 100644 --- a/uppsrc/Core/Callback.h +++ b/uppsrc/Core/Callback.h @@ -1,3 +1,5 @@ +enum CNULLer { CNULL }; + template class Function : Moveable> { struct WrapperBase { @@ -48,6 +50,7 @@ class Function : Moveable> { public: Function() { ptr = NULL; } + Function(CNULLer) { ptr = NULL; } template Function(F fn) { ptr = new Wrapper(pick(fn)); } @@ -77,8 +80,6 @@ public: ~Function() { Free(ptr); } }; -enum CNULLer { CNULL }; - // we need "isolation level" to avoid overloading issues template class Event : Moveable> { diff --git a/uppsrc/RichText/TxtPaint.cpp b/uppsrc/RichText/TxtPaint.cpp index 4b7b18ac8..7a79f04bc 100644 --- a/uppsrc/RichText/TxtPaint.cpp +++ b/uppsrc/RichText/TxtPaint.cpp @@ -322,7 +322,7 @@ void RichTxt::GatherValPos(Vector& f, RichContext rc, int pos, int t int parti = 0; while(parti < part.GetCount()) { RichContext begin; - Advance(parti++, rc, begin); + Advance(parti, rc, begin); if(part[parti].Is()) GetTable(parti).GatherValPos(f, begin, pos, type); else { @@ -336,6 +336,7 @@ void RichTxt::GatherValPos(Vector& f, RichContext rc, int pos, int t Get(parti, *begin.styles, true).GatherIndexes(f, begin.page, begin.py, pos); } pos += GetPartLength(parti) + 1; + parti++; } } diff --git a/uppsrc/plugin/lz4/lz4.h b/uppsrc/plugin/lz4/lz4.h index df2acbbd2..5be1c2a4c 100644 --- a/uppsrc/plugin/lz4/lz4.h +++ b/uppsrc/plugin/lz4/lz4.h @@ -110,21 +110,20 @@ public: ~LZ4DecompressStream(); }; - -int64 LZ4Compress(Stream& out, Stream& in, Function progress = false); -int64 LZ4Decompress(Stream& out, Stream& in, Function progress = false); -String LZ4Compress(const void *data, int64 len, Function progress = false); -String LZ4Compress(const String& s, Function progress = false); -String LZ4Decompress(const void *data, int64 len, Function progress = false); -String LZ4Decompress(const String& s, Function progress = false); +int64 LZ4Compress(Stream& out, Stream& in, Function progress = CNULL); +int64 LZ4Decompress(Stream& out, Stream& in, Function progress = CNULL); +String LZ4Compress(const void *data, int64 len, Function progress = CNULL); +String LZ4Compress(const String& s, Function progress = CNULL); +String LZ4Decompress(const void *data, int64 len, Function progress = CNULL); +String LZ4Decompress(const String& s, Function progress = CNULL); #ifdef _MULTITHREADED -int64 CoLZ4Compress(Stream& out, Stream& in, Function progress = false); -int64 CoLZ4Decompress(Stream& out, Stream& in, Function progress = false); -String CoLZ4Compress(const void *data, int64 len, Function progress = false); -String CoLZ4Compress(const String& s, Function progress = false); -String CoLZ4Decompress(const void *data, int64 len, Function progress = false); -String CoLZ4Decompress(const String& s, Function progress = false); +int64 CoLZ4Compress(Stream& out, Stream& in, Function progress = CNULL); +int64 CoLZ4Decompress(Stream& out, Stream& in, Function progress = CNULL); +String CoLZ4Compress(const void *data, int64 len, Function progress = CNULL); +String CoLZ4Compress(const String& s, Function progress = CNULL); +String CoLZ4Decompress(const void *data, int64 len, Function progress = CNULL); +String CoLZ4Decompress(const String& s, Function progress = CNULL); #endif bool IsLZ4(Stream& s);