Changeset View
Changeset View
Standalone View
Standalone View
src/ioslaves/file/file.cpp
Show First 20 Lines • Show All 558 Lines • ▼ Show 20 Line(s) | 555 | { | |||
---|---|---|---|---|---|
559 | if (mFile->seek(offset)) { | 559 | if (mFile->seek(offset)) { | ||
560 | position(offset); | 560 | position(offset); | ||
561 | } else { | 561 | } else { | ||
562 | error(KIO::ERR_CANNOT_SEEK, mFile->fileName()); | 562 | error(KIO::ERR_CANNOT_SEEK, mFile->fileName()); | ||
563 | closeWithoutFinish(); | 563 | closeWithoutFinish(); | ||
564 | } | 564 | } | ||
565 | } | 565 | } | ||
566 | 566 | | |||
567 | void FileProtocol::truncate(KIO::filesize_t length) | ||||
568 | { | ||||
569 | Q_ASSERT(mFile && mFile->isOpen()); | ||||
570 | | ||||
571 | if (mFile->resize(length)) { | ||||
572 | truncated(length); | ||||
573 | } else { | ||||
574 | error(KIO::ERR_CANNOT_TRUNCATE, mFile->fileName()); | ||||
575 | closeWithoutFinish(); | ||||
576 | } | ||||
577 | } | ||||
578 | | ||||
567 | void FileProtocol::closeWithoutFinish() | 579 | void FileProtocol::closeWithoutFinish() | ||
568 | { | 580 | { | ||
569 | Q_ASSERT(mFile); | 581 | Q_ASSERT(mFile); | ||
570 | 582 | | |||
571 | delete mFile; | 583 | delete mFile; | ||
572 | mFile = nullptr; | 584 | mFile = nullptr; | ||
573 | } | 585 | } | ||
574 | 586 | | |||
▲ Show 20 Lines • Show All 983 Lines • Show Last 20 Lines |