Skip to content

Commit 106091a

Browse files
committed
Code review changes
1 parent 72ee608 commit 106091a

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

system/jhtree/jhblockcompressed.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,12 @@ bool CJHBlockCompressedSearchNode::fetchPayload(unsigned int index, char *dst, P
143143
const char * p = keyBuf + index*keyRecLen;
144144
if (keyHdr->hasSpecialFileposition())
145145
{
146-
memcpy(dst+keyCompareLen, p+keyCompareLen, keyLen-keyCompareLen);
147146
if (hasFilePosition)
148-
memcpy(dst+keyLen, p+keyLen, sizeof(offset_t));
147+
memcpy(dst+keyCompareLen, p+keyCompareLen, keyLen + sizeof(offset_t) - keyCompareLen);
149148
else
150149
{
151-
offset_t zeroPos = 0;
152-
memcpy(dst+keyLen, &zeroPos, sizeof(offset_t));
150+
memcpy(dst+keyCompareLen, p+keyCompareLen, keyLen-keyCompareLen);
151+
*((offset_t*) dst+keyLen) = 0;
153152
}
154153
}
155154
else
@@ -265,7 +264,7 @@ bool CBlockCompressedWriteNode::add(offset_t pos, const void *indata, size32_t i
265264
hdr.keyBytes += sizeof(context.compressionMethod);
266265

267266
bool hasFilepos = !context.zeroFilePos;
268-
memcpy(keyPtr, &hasFilepos, sizeof(bool));
267+
*(bool*)keyPtr = hasFilepos;
269268
keyPtr += sizeof(bool);
270269
hdr.keyBytes += sizeof(bool);
271270

@@ -278,8 +277,7 @@ bool CBlockCompressedWriteNode::add(offset_t pos, const void *indata, size32_t i
278277
}
279278

280279
unsigned writeOptions = KeyCompressor::TrailingFilePosition | (context.zeroFilePos ? KeyCompressor::NoFilePosition : 0);
281-
int written = compressor.writekey(pos, (const char *)indata, insize, writeOptions);
282-
if (0xffff == hdr.numKeys || written == 0)
280+
if (0xffff == hdr.numKeys || 0 == compressor.writekey(pos, (const char *)indata, insize, writeOptions))
283281
return false;
284282

285283
if (insize>keyLen)
@@ -372,13 +370,12 @@ bool CJHBlockCompressedVarNode::fetchPayload(unsigned int num, char *dst, Payloa
372370
_WINREV(reclen);
373371
if (keyHdr->hasSpecialFileposition())
374372
{
375-
memcpy(dst+keyCompareLen, p+keyCompareLen, reclen-keyCompareLen);
376373
if (hasFilePosition)
377-
memcpy(dst+reclen, p+reclen, sizeof(offset_t));
374+
memcpy(dst+keyCompareLen, p+keyCompareLen, reclen + sizeof(offset_t) - keyCompareLen);
378375
else
379376
{
380-
offset_t zeroPos = 0;
381-
memcpy(dst+reclen, &zeroPos, sizeof(offset_t));
377+
memcpy(dst+keyCompareLen, p+keyCompareLen, reclen-keyCompareLen);
378+
*((offset_t*) dst+reclen) = 0;
382379
}
383380
}
384381
else

testing/regress/ecl/key/stresstext.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,8 @@
119119
<Row><Result_40>true</Result_40></Row>
120120
</Dataset>
121121
<Dataset name='Result 41'>
122+
<Row><Result_40>true</Result_40></Row>
123+
</Dataset>
124+
<Dataset name='Result 42'>
122125
<Row><Result_41>Done</Result_41></Row>
123126
</Dataset>

testing/regress/ecl/stresstext.ecl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
//version multiPart=false,variant='inplace_zstd'
2626
//version multiPart=false,variant='inplace_var'
2727
//version multiPart=false,variant='hybrid'
28+
//version multiPart=true,variant='hybrid'
2829
//version multiPart=false,variant='hybrid_var'
2930

3031
// The settings below may be useful when trying to analyse Roxie keyed join behaviour, as they will

0 commit comments

Comments
 (0)