MCPcopy Create free account
hub / github.com/Simsys/qhexedit2 / lastIndexOf

Method lastIndexOf

src/chunks.cpp:191–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189}
190
191qint64 Chunks::lastIndexOf(const QByteArray &ba, qint64 from)
192{
193 qint64 result = -1;
194 QByteArray buffer;
195
196 for (qint64 pos=from; (pos > 0) && (result < 0); pos -= BUFFER_SIZE)
197 {
198 qint64 sPos = pos - BUFFER_SIZE - (qint64)ba.size() + 1;
199 if (sPos < 0)
200 sPos = 0;
201 buffer = data(sPos, pos - sPos);
202 int findPos = buffer.lastIndexOf(ba);
203 if (findPos >= 0)
204 result = sPos + (qint64)findPos;
205 }
206 return result;
207}
208
209
210// ***************************************** Char manipulations

Callers 1

findNextMethod · 0.45

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected