don't assign in while
Fixes MSVC's warning C4706: assignment within conditional expression Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
b324f80443
commit
dde8765a49
@ -321,9 +321,9 @@ size_t FileIo::write(BasicIo& src) {
|
||||
return 0;
|
||||
|
||||
byte buf[4096];
|
||||
size_t readCount = 0;
|
||||
size_t writeTotal = 0;
|
||||
while ((readCount = src.read(buf, sizeof(buf)))) {
|
||||
size_t readCount = src.read(buf, sizeof(buf));
|
||||
while (readCount != 0) {
|
||||
size_t writeCount = std::fwrite(buf, 1, readCount, p_->fp_);
|
||||
writeTotal += writeCount;
|
||||
if (writeCount != readCount) {
|
||||
@ -331,6 +331,7 @@ size_t FileIo::write(BasicIo& src) {
|
||||
src.seek(writeCount - readCount, BasicIo::cur);
|
||||
break;
|
||||
}
|
||||
readCount = src.read(buf, sizeof(buf));
|
||||
}
|
||||
|
||||
return writeTotal;
|
||||
@ -746,11 +747,12 @@ size_t MemIo::write(BasicIo& src) {
|
||||
return 0;
|
||||
|
||||
byte buf[4096];
|
||||
size_t readCount = 0;
|
||||
size_t writeTotal = 0;
|
||||
while ((readCount = src.read(buf, sizeof(buf)))) {
|
||||
size_t readCount = src.read(buf, sizeof(buf));
|
||||
while (readCount != 0) {
|
||||
write(buf, readCount);
|
||||
writeTotal += readCount;
|
||||
readCount = src.read(buf, sizeof(buf));
|
||||
}
|
||||
|
||||
return writeTotal;
|
||||
|
||||
@ -914,10 +914,11 @@ void JpegBase::doWriteMetadata(BasicIo& outIo) {
|
||||
throw Error(ErrorCode::kerImageWriteFailed);
|
||||
|
||||
DataBuf buf(4096);
|
||||
size_t readSize = 0;
|
||||
while ((readSize = io_->read(buf.data(), buf.size()))) {
|
||||
size_t readSize = io_->read(buf.data(), buf.size());
|
||||
while (readSize != 0) {
|
||||
if (outIo.write(buf.c_data(), readSize) != readSize)
|
||||
throw Error(ErrorCode::kerImageWriteFailed);
|
||||
readSize = io_->read(buf.data(), buf.size());
|
||||
}
|
||||
if (outIo.error())
|
||||
throw Error(ErrorCode::kerImageWriteFailed);
|
||||
|
||||
@ -203,10 +203,11 @@ void PgfImage::doWriteMetadata(BasicIo& outIo) {
|
||||
// Copy the rest of PGF image data.
|
||||
|
||||
DataBuf buf(4096);
|
||||
size_t readSize = 0;
|
||||
while ((readSize = io_->read(buf.data(), buf.size()))) {
|
||||
size_t readSize = io_->read(buf.data(), buf.size());
|
||||
while (readSize != 0) {
|
||||
if (outIo.write(buf.c_data(), readSize) != readSize)
|
||||
throw Error(ErrorCode::kerImageWriteFailed);
|
||||
readSize = io_->read(buf.data(), buf.size());
|
||||
}
|
||||
if (outIo.error())
|
||||
throw Error(ErrorCode::kerImageWriteFailed);
|
||||
|
||||
@ -523,10 +523,11 @@ void PsdImage::doWriteMetadata(BasicIo& outIo) {
|
||||
io_->populateFakeData();
|
||||
|
||||
// Copy remaining data
|
||||
size_t readSize = 0;
|
||||
while ((readSize = io_->read(lbuf.data(), lbuf.size()))) {
|
||||
size_t readSize = io_->read(lbuf.data(), lbuf.size());
|
||||
while (readSize != 0) {
|
||||
if (outIo.write(lbuf.c_data(), readSize) != readSize)
|
||||
throw Error(ErrorCode::kerImageWriteFailed);
|
||||
readSize = io_->read(lbuf.data(), lbuf.size());
|
||||
}
|
||||
if (outIo.error())
|
||||
throw Error(ErrorCode::kerImageWriteFailed);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user