[haiku-commits] haiku: hrev52294 - src/apps/terminal

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 27 Aug 2018 23:26:07 -0400 (EDT)

hrev52294 adds 1 changeset to branch 'master'
old head: d34addaf3fdd0a9c64402d595a7e45c770143460
new head: e998f2e4ac63415a637177c0ec438b3329f6521b
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=e998f2e4ac63+%5Ed34addaf3fdd

----------------------------------------------------------------------------

e998f2e4ac63: 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 <pulkomandy@xxxxxxxxxxxxx>

                                      [ Murai Takashi <tmurai01@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev52294
Commit:      e998f2e4ac63415a637177c0ec438b3329f6521b
URL:         https://git.haiku-os.org/haiku/commit/?id=e998f2e4ac63
Author:      Murai Takashi <tmurai01@xxxxxxxxx>
Date:        Fri May 18 23:46:58 2018 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Tue Aug 28 03:26:01 2018 UTC

----------------------------------------------------------------------------

3 files changed, 4 insertions(+), 4 deletions(-)
src/apps/terminal/BasicTerminalBuffer.cpp | 2 +-
src/apps/terminal/Colors.cpp              | 2 +-
src/apps/terminal/TerminalBuffer.cpp      | 4 ++--

----------------------------------------------------------------------------

diff --git a/src/apps/terminal/BasicTerminalBuffer.cpp 
b/src/apps/terminal/BasicTerminalBuffer.cpp
index a1f0d10f60..43e3629e2b 100644
--- a/src/apps/terminal/BasicTerminalBuffer.cpp
+++ b/src/apps/terminal/BasicTerminalBuffer.cpp
@@ -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;
diff --git a/src/apps/terminal/Colors.cpp b/src/apps/terminal/Colors.cpp
index 7f667e418a..190881d7e1 100644
--- a/src/apps/terminal/Colors.cpp
+++ b/src/apps/terminal/Colors.cpp
@@ -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;
        }
 
diff --git a/src/apps/terminal/TerminalBuffer.cpp 
b/src/apps/terminal/TerminalBuffer.cpp
index 14362d1b11..84c32d83f7 100644
--- a/src/apps/terminal/TerminalBuffer.cpp
+++ b/src/apps/terminal/TerminalBuffer.cpp
@@ -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);
 }


Other related posts:

  • » [haiku-commits] haiku: hrev52294 - src/apps/terminal - waddlesplash