lineInfoRun.visualToLogicalMapSecondHalf = reinterpret_cast<CharacterIndex*>(malloc(numberOfCharactersInSecondHalfLine * sizeof(CharacterIndex)));
- if(nullptr != lineInfoRun.visualToLogicalMap)
+ if(nullptr != lineInfoRun.visualToLogicalMap && nullptr != lineInfoRun.visualToLogicalMapSecondHalf)
{
// Reorders the line.
bidirectionalSupport.Reorder(bidirectionalParagraphInfo.bidirectionalInfoIndex,
const Length numberOfLeftToRightCharacters = paragraph.characterRun.characterIndex - index;
if(numberOfLeftToRightCharacters > 0u)
{
- memset(directionsBuffer + index - startIndex, false, numberOfLeftToRightCharacters * sizeof(bool));
+ memset(directionsBuffer + static_cast<std::size_t>(index - startIndex), false, static_cast<std::size_t>(numberOfLeftToRightCharacters) * sizeof(bool));
}
// Set the directions of the bidirectional text.
bidirectionalSupport.GetCharactersDirection(paragraph.bidirectionalInfoIndex,
- directionsBuffer + paragraph.characterRun.characterIndex - startIndex,
+ directionsBuffer + static_cast<std::size_t>(paragraph.characterRun.characterIndex - startIndex),
paragraph.characterRun.numberOfCharacters);
// Update the index.
}
// Fills with left to right those paragraphs without right to left characters.
- memset(directionsBuffer + index - startIndex, false, (lastCharacter - index) * sizeof(bool));
+ memset(directionsBuffer + static_cast<std::size_t>(index - startIndex), false, static_cast<std::size_t>(lastCharacter - index) * sizeof(bool));
// If the direction info is updated, it needs to be inserted in the model.
if(updateCurrentBuffer)