From e8837f7137db5ad3e293e40931ec45a714b659d4 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Fri, 8 Nov 2019 15:20:01 +0000 Subject: [PATCH] MCOL-3605 Fix Block Filling --- writeengine/dictionary/we_dctnry.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/writeengine/dictionary/we_dctnry.cpp b/writeengine/dictionary/we_dctnry.cpp index 3fa5d7f13..e8b5e03c8 100644 --- a/writeengine/dictionary/we_dctnry.cpp +++ b/writeengine/dictionary/we_dctnry.cpp @@ -667,9 +667,9 @@ int Dctnry::insertDctnry2(Signature& sig) while (sig.size > 0) { - if (sig.size > (m_freeSpace - m_totalHdrBytes)) + if (sig.size > (m_freeSpace - HDR_UNIT_SIZE)) { - write_size = (m_freeSpace - m_totalHdrBytes); + write_size = (m_freeSpace - HDR_UNIT_SIZE); } else { @@ -891,8 +891,8 @@ int Dctnry::insertDctnry(const char* buf, //...String not found in cache, so proceed. // If room is available in current block then insert into block. // @bug 3960: Add MAX_OP_COUNT check to handle case after bulk rollback - if ( ((totalUseSize <= m_freeSpace) || - ((curSig.size > 8176) && (m_freeSpace > m_totalHdrBytes))) && + if ( ((totalUseSize <= m_freeSpace - HDR_UNIT_SIZE) || + ((curSig.size > 8176) && (m_freeSpace > HDR_UNIT_SIZE))) && (m_curOp < (MAX_OP_COUNT - 1)) ) { RETURN_ON_ERROR(insertDctnry2(curSig)); //m_freeSpace updated! @@ -1115,14 +1115,14 @@ int Dctnry::insertDctnry(const int& sgnature_size, for (i = m_lastFbo; i < m_numBlocks; i++) { // @bug 3960: Add MAX_OP_COUNT check to handle case after bulk rollback - if ( ((m_freeSpace >= size) || - ((size > 8176) && (m_freeSpace > m_totalHdrBytes))) && + if ( ((m_freeSpace - HDR_UNIT_SIZE >= size) || + ((size > 8176) && (m_freeSpace > HDR_UNIT_SIZE))) && (m_curOp < (MAX_OP_COUNT - 1)) ) { // found the perfect block; signature size fit in this block - if (size > (m_freeSpace - m_totalHdrBytes)) + if (size > (m_freeSpace - HDR_UNIT_SIZE)) { - write_size = (m_freeSpace - m_totalHdrBytes); + write_size = (m_freeSpace - HDR_UNIT_SIZE); } else {