#define _CRT_SECURE_NO_DEPRECATE #include <windows.h> #include "filewriter_immediate.h" const int cImmediateBufferSize = 16384; unsigned char* FileWriterImmediate::mBuffer = NULL; FileWriterImmediate* FileWriterImmediate::GetFileWriter(const std::string& inName, long long inFileSize) { if (!mBuffer) mBuffer = new unsigned char[cImmediateBufferSize]; return new FileWriterImmediate(inName, inFileSize); } void FileWriterImmediate::Finalize() { delete mBuffer; } FileWriterImmediate::FileWriterImmediate(const std::string& inName, long long inFileSize) : FileWriter(inName, inFileSize), mHandle(INVALID_HANDLE_VALUE) { } bool FileWriterImmediate::Open() { mHandle = CreateFile(false); return mHandle != INVALID_HANDLE_VALUE; } bool FileWriterImmediate::Close() { return CloseFile(mHandle); } void FileWriterImmediate::GetWriteBuffer(unsigned char*& outBuf, int& outLength) { outBuf = mBuffer; outLength = cImmediateBufferSize; } bool FileWriterImmediate::ReleaseWriteBuffer(int inRemainingLength) { int length = cImmediateBufferSize - inRemainingLength; if (length > 0) { DWORD written; if (::WriteFile(mHandle, mBuffer, length, &written, NULL) == 0 || written != length) return false; if (mWriteCallback) mWriteCallback(written); } return true; } void FileWriterImmediate::HandleAbort() { CloseFile(mHandle); // Aborted before file actions could be finished, so delete DeleteFile(); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 6420 | Frank Compagner |
A number of improvements: - p4fs now supports the global -s (scripted output) option. - p4fs and P4fsV now support the modtime client option. - P4CHARSET is now correctly handled (though no full Unicode support yet). - Increased the maximum command line length for p4fs to the Windows maximum 32768. - Improved error handling. - Fixed a crash when cancelling a sync using the async or multithreaded writers. - P4fsV progressbar now behaves well when passing more than one filespec - P4fsV will now offer the option to overwrite any locally changed (but not checked out) files when it finds these during a sync (cannot clobber ...). - Made the P4fsV error dialog resizeable. - P4fsV Windows layout fixed so it works properly with all Windows style setings. - Ooh, and prettier icons too. |
||
#2 | 6280 | Frank Compagner | Added support for +w filetype | ||
#1 | 6187 | Frank Compagner | Added p4fs project |