Terminal: Fix -Werror=class-memaccess

Fix -Werror=class-memaccess pointed out by gcc8.
* Use TerminalLine::Clear() instead of memset()
* Use rgb_color::operator=() instead of memcpy()

Change-Id: I41360e245fd55c526d9c2802a2f247ba22583080
Reviewed-on: https://review.haiku-os.org/483
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Murai Takashi
2018-08-28 03:26:01 +00:00
committed by waddlesplash
parent d34addaf3f
commit e998f2e4ac
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -1088,7 +1088,7 @@ BasicTerminalBuffer::_AllocateLines(int32 width, int32 count)
_FreeLines(lines, i);
return NULL;
}
memset(lines[i], 0, size);
lines[i]->Clear(0, width);
}
return lines;
+1 -1
View File
@@ -195,7 +195,7 @@ XColorsTable::LookUpColor(const char* name, rgb_color* color)
}
if (fTable[right].hash == hash) {
memcpy(color, &fTable[right].color, sizeof(rgb_color));
*color = fTable[right].color;
return B_OK;
}
+2 -2
View File
@@ -61,8 +61,8 @@ TerminalBuffer::Init(int32 width, int32 height, int32 historySize)
if (fColorsPalette == NULL)
return B_NO_MEMORY;
memcpy(fColorsPalette, TermApp::DefaultPalette(),
sizeof(rgb_color) * kTermColorCount);
for (uint i = 0; i < kTermColorCount; i++)
fColorsPalette[i] = TermApp::DefaultPalette()[i];
return BasicTerminalBuffer::Init(width, height, historySize);
}