| 189 | } |
| 190 | |
| 191 | qint64 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 |