#define _CRT_SECURE_NO_DEPRECATE #include <windows.h> #include "filewriter_sync.h" unsigned char* FileWriterSync::mBuffer = NULL; FileWriterSync* FileWriterSync::GetFileWriter(const std::string& inName, long long inFileSize) { if (!mBuffer) mBuffer = new unsigned char[mMaxMemSize]; return new FileWriterSync(inName, inFileSize); } void FileWriterSync::Finalize() { delete mBuffer; } FileWriterSync::FileWriterSync(const std::string& inName, long long inFileSize) : FileWriter(inName, inFileSize), mHandle(INVALID_HANDLE_VALUE), mLength(0) { } bool FileWriterSync::Open(bool inWriteable, int inModTime) { mLength = 0; mHandle = CreateFile(inWriteable, false, inModTime); return mHandle != INVALID_HANDLE_VALUE; } bool FileWriterSync::Close() { bool flush_ok = Flush(); bool close_res = CloseFile(mHandle); return flush_ok && close_res; } void FileWriterSync::GetWriteBuffer(unsigned char*& outBuf, int& outLength) { outBuf = mBuffer + mLength; outLength = mMaxMemSize - mLength; } bool FileWriterSync::ReleaseWriteBuffer(int inRemainingLength) { mLength = mMaxMemSize - inRemainingLength; // We need to have at least two bytes free, as we may need to do a line-end conversion if (mLength >= mMaxMemSize - 1) return Flush(); return true; } bool FileWriterSync::Flush() { Log("Flush\n"); if (mLength > 0) { DWORD written; if (::WriteFile(mHandle, mBuffer, mLength, &written, NULL) == 0 || written != mLength) return false; if (mWriteCallback) mWriteCallback(written); mLength = 0; } return true; } void FileWriterSync::HandleAbort() { CloseFile(mHandle); // Aborted before file actions could be finished, so delete DeleteFile(); } bool FileWriterSync::ChModTime(int inModTime) { return FileWriter::ChModTime(mHandle, inModTime); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 6451 | Frank Compagner |
- Now fully support unicode & utf-16 files - Improved accuracy of P4fsV progress bar - Added logging to help in remote debugging |
||
#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 |