MCPcopy Create free account
hub / github.com/KDE/kdiff3 / slotPutData

Method slotPutData

src/DefaultFileAccessJobHandler.cpp:164–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162
163#if HAS_KFKIO
164void DefaultFileAccessJobHandler::slotPutData(KIO::Job* pJob, QByteArray& data)
165{
166 if(pJob->error() != KJob::NoError)
167 {
168 qCDebug(kdiffFileAccess) << "slotPutData: pJob->error() = " << pJob->error();
169 pJob->uiDelegate()->showErrorMessage();
170 }
171 else
172 {
173 /*
174 Think twice before doing this in new code.
175 The maxChunkSize must be able to fit a 32-bit int. Given that the fallowing is safe for qt5.
176 Qt6 resolves this issue as it uses 64 bit sizes.
177 */
178 qint64 maxChunkSize = 100000;
179 qint64 length = std::min(maxChunkSize, m_maxLength - m_transferredBytes);
180 if(length > 0)
181 {
182 data.resize((qsizetype)length);
183 if(data.size() == (qsizetype)length)
184 {
185 ::memcpy(data.data(), m_pTransferBuffer + m_transferredBytes, data.size());
186 m_transferredBytes += length;
187 }
188 }
189 else
190 {
191 if(length < 0)
192 {
193 KMessageBox::error(g_pProgressDialog, i18n("Out of memory"));
194 data.resize(0);
195 m_bSuccess = false;
196 }
197 }
198 }
199}
200
201void DefaultFileAccessJobHandler::slotPutJobResult(KJob* pJob)
202{

Callers

nothing calls this directly

Calls 2

dataMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected