Commit b472c4f7 authored by Michael Reeves's avatar Michael Reeves

Mark deprecated code

parent 1fd1583b
......@@ -80,10 +80,10 @@ class SourceData
{
private:
friend SourceData;
const char* m_pBuf = nullptr;
const char* m_pBuf = nullptr; //TODO: Phase out needlessly wastes memmory and time by keeping second copy of file data.
qint64 m_size = 0;
qint64 m_vSize = 0; // Nr of lines in m_pBuf1 and size of m_v1, m_dv12 and m_dv13
QString m_unicodeBuf; //TODO: Phase out needlessly wastes memmory and time by keeping second copy of file data.
QString m_unicodeBuf;
QVector<LineData> m_v;
bool m_bIsText = false;
bool m_bIncompleteConversion = false;
......@@ -97,8 +97,8 @@ class SourceData
bool writeFile(const QString& filename);
bool preprocess(bool bPreserveCR, QTextCodec* pEncoding);
void reset();
void removeComments();
void copyBufFrom(const FileData& src);
Q_DECL_DEPRECATED void removeComments();
Q_DECL_DEPRECATED void copyBufFrom(const FileData& src);
void checkLineForComments(
const QChar* p, // pointer to start of buffer
......
......@@ -1160,18 +1160,20 @@ void Diff3LineList::calcWhiteDiff3Lines(
}
// My own diff-invention:
void calcDiff(const QChar* p1, const LineRef size1, const QChar* p2, const LineRef size2, DiffList& diffList, int match, int maxSearchRange)
void calcDiff(const QString& line1, const QString& line2, DiffList& diffList, int match, int maxSearchRange)
{
diffList.clear();
const QChar* p1start = p1;
const QChar* p2start = p2;
const QChar* p1end = p1 + size1;
const QChar* p2end = p2 + size2;
const QChar *p1start = line1.constData(), *p1=line1.constData(), *p2=line2.constData();
const QChar *p2start = line2.constData();
const QChar *p1end = p1start + line1.size();
const QChar *p2end = p2start + line2.size();
const int size1 = line1.size(), size2 = line2.size();
for(;;)
{
int nofEquals = 0;
while(p1 != p1end && p2 != p2end && *p1 == *p2)
while(nofEquals < size1 && nofEquals < size2 && line1[nofEquals] == line2[nofEquals])
{
++p1;
++p2;
......@@ -1183,6 +1185,7 @@ void calcDiff(const QChar* p1, const LineRef size1, const QChar* p2, const LineR
int bestI2 = 0;
int i1 = 0;
int i2 = 0;
for(i1 = 0;; ++i1)
{
if(&p1[i1] == p1end || (bBestValid && i1 >= bestI1 + bestI2))
......@@ -1244,6 +1247,7 @@ void calcDiff(const QChar* p1, const LineRef size1, const QChar* p2, const LineR
int nofUnmatched = 0;
const QChar* pu1 = p1 - 1;
const QChar* pu2 = p2 - 1;
while(pu1 >= p1start && pu2 >= p2start && *pu1 == *pu2)
{
++nofUnmatched;
......@@ -1311,7 +1315,7 @@ void calcDiff(const QChar* p1, const LineRef size1, const QChar* p2, const LineR
l2 += (it->nofEquals + it->diff2);
}
Q_ASSERT(l1 == size1 && l2 == size2);
Q_ASSERT(l1 == line1.size() && l2 == line2.size());
}
}
......@@ -1348,7 +1352,7 @@ bool Diff3Line::fineDiff(bool inBTextsTotalEqual, const e_SrcSelector selector,
{
bTextsTotalEqual = false;
DiffList* pDiffList = new DiffList;
calcDiff((*v1)[k1].getRawLine(), (*v1)[k1].size(), (*v2)[k2].getRawLine(), (*v2)[k2].size(), *pDiffList, 2, maxSearchLength);
calcDiff((*v1)[k1].getLine(), (*v2)[k2].getLine(), *pDiffList, 2, maxSearchLength);
// Optimize the diff list.
DiffList::iterator dli;
......
......@@ -77,26 +77,26 @@ class LineData
{
private:
QString pLine;
const QChar* pLine_old = nullptr;
Q_DECL_DEPRECATED const QChar* pLine_old = nullptr;
const QChar* pFirstNonWhiteChar = nullptr;
Q_DECL_DEPRECATED const QChar* pFirstNonWhiteChar = nullptr;
int mSize = 0;
qint64 mOffset = 0;
bool bContainsPureComment = false;
Q_DECL_DEPRECATED bool bContainsPureComment = false;
public:
LineData() = default;
inline LineData(const qint64 inOffset) { mOffset = inOffset; }
inline int size() const { return mSize; }
inline void setSize(const int newSize) { mSize = newSize; }
Q_REQUIRED_RESULT inline int size() const { Q_ASSERT(pLine.length() == mSize); return pLine.length(); }
Q_DECL_DEPRECATED inline void setSize(const int newSize) { mSize = newSize; }
inline void setFirstNonWhiteChar(const QChar* firstNonWhiteChar) { pFirstNonWhiteChar = firstNonWhiteChar;}
Q_DECL_DEPRECATED inline void setFirstNonWhiteChar(const QChar* firstNonWhiteChar) { pFirstNonWhiteChar = firstNonWhiteChar;}
inline const QChar* getFirstNonWhiteChar() const { return pFirstNonWhiteChar; }
inline const QString getLine() const { return pLine; }
inline const QChar* getRawLine() const { return pLine_old; }
inline void setLine(const QChar* line) { pLine_old = line;}
Q_REQUIRED_RESULT inline const QString getLine() const { return pLine; }
Q_DECL_DEPRECATED Q_REQUIRED_RESULT inline const QChar* getRawLine() const { return pLine_old; }
Q_DECL_DEPRECATED inline void setLine(const QChar* line) { pLine_old = line;}
inline void setLine(const QString& line) { pLine = line;}
inline qint64 getOffset() { return mOffset; }
inline void setOffset(qint64 inOffset) { mOffset = inOffset; }
......@@ -382,6 +382,8 @@ class ManualDiffHelpList: public std::list<ManualDiffHelpEntry>
Options* pOptions);
};
void calcDiff(const QString &line1, const QString &line2, DiffList& diffList, int match, int maxSearchRange);
void calcDiff3LineListUsingAB(
const DiffList* pDiffListAB,
Diff3LineList& d3ll);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment