summaryrefslogtreecommitdiff
path: root/zen
diff options
context:
space:
mode:
authorDaniel Wilhelm <shieldwed@outlook.com>2018-05-09 00:07:47 +0200
committerDaniel Wilhelm <shieldwed@outlook.com>2018-05-09 00:07:47 +0200
commit48c8efc58c9eb41da96b053806deb395d2e66443 (patch)
treea6da12e987ad778bafe6da7069c7fa8b1e761c68 /zen
parent9.6 (diff)
downloadFreeFileSync-48c8efc58c9eb41da96b053806deb395d2e66443.tar.gz
FreeFileSync-48c8efc58c9eb41da96b053806deb395d2e66443.tar.bz2
FreeFileSync-48c8efc58c9eb41da96b053806deb395d2e66443.zip
9.7
Diffstat (limited to 'zen')
-rwxr-xr-xzen/file_io.cpp10
-rwxr-xr-xzen/zstring.h1
2 files changed, 4 insertions, 7 deletions
diff --git a/zen/file_io.cpp b/zen/file_io.cpp
index bb4848c6..1cbd970b 100755
--- a/zen/file_io.cpp
+++ b/zen/file_io.cpp
@@ -131,8 +131,6 @@ size_t FileInput::tryRead(void* buffer, size_t bytesToRead) //throw FileError, E
size_t FileInput::read(void* buffer, size_t bytesToRead) //throw FileError, ErrorFileLocked, X; return "bytesToRead" bytes unless end of stream!
{
- warn_static("implement PERF_AWESOME_BUFFER program wide for all buffers!?")
-
/*
FFS 8.9-9.5 perf issues on macOS: https://www.freefilesync.org/forum/viewtopic.php?t=4808
app-level buffering is essential to optimize random data sizes; e.g. "export file list":
@@ -155,13 +153,12 @@ size_t FileInput::read(void* buffer, size_t bytesToRead) //throw FileError, Erro
for (;;)
{
const size_t junkSize = std::min(static_cast<size_t>(itEnd - it), bufPosEnd_ - bufPos_);
- std::memcpy(it, &memBuf_[bufPos_], junkSize);
+ std::memcpy(it, &memBuf_[0] + bufPos_ /*caveat: vector debug checks*/, junkSize);
bufPos_ += junkSize;
it += junkSize;
if (it == itEnd)
break;
-
//--------------------------------------------------------------------
const size_t bytesRead = tryRead(&memBuf_[0], blockSize); //throw FileError, ErrorFileLocked; may return short, only 0 means EOF! => CONTRACT: bytesToRead > 0
bufPos_ = 0;
@@ -263,19 +260,18 @@ void FileOutput::write(const void* buffer, size_t bytesToWrite) //throw FileErro
if (memBuf_.size() - bufPos_ < blockSize) //support memBuf_.size() > blockSize to reduce memmove()s, but perf test shows: not really needed!
// || bufPos_ == bufPosEnd_) -> not needed while memBuf_.size() == blockSize
{
- std::memmove(&memBuf_[0], &memBuf_[bufPos_], bufPosEnd_ - bufPos_);
+ std::memmove(&memBuf_[0], &memBuf_[0] + bufPos_, bufPosEnd_ - bufPos_);
bufPosEnd_ -= bufPos_;
bufPos_ = 0;
}
const size_t junkSize = std::min(static_cast<size_t>(itEnd - it), blockSize - (bufPosEnd_ - bufPos_));
- std::memcpy(&memBuf_[bufPosEnd_], it, junkSize);
+ std::memcpy(&memBuf_[0] + bufPosEnd_ /*caveat: vector debug checks*/, it, junkSize);
bufPosEnd_ += junkSize;
it += junkSize;
if (it == itEnd)
return;
-
//--------------------------------------------------------------------
const size_t bytesWritten = tryWrite(&memBuf_[bufPos_], blockSize); //throw FileError; may return short! CONTRACT: bytesToWrite > 0
bufPos_ += bytesWritten;
diff --git a/zen/zstring.h b/zen/zstring.h
index 2a4a549e..b96842b5 100755
--- a/zen/zstring.h
+++ b/zen/zstring.h
@@ -74,6 +74,7 @@ S ciReplaceCpy(const S& str, const T& oldTerm, const U& newTerm);
//common unicode sequences
const wchar_t EM_DASH = L'\u2014';
+const wchar_t EN_DASH = L'\u2013';
const wchar_t* const SPACED_DASH = L" \u2013 "; //using 'EN DASH'
const wchar_t LTR_MARK = L'\u200E'; //UTF-8: E2 80 8E
const wchar_t RTL_MARK = L'\u200F'; //UTF-8: E2 80 8F
bgstack15