GCC 4 fixes.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25885 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-06-09 18:52:09 +00:00
parent c61dc72f6c
commit bdc33077f9
5 changed files with 25 additions and 9 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ public:
virtual void ValueChanged(float newValue) virtual void ValueChanged(float newValue)
{ {
if (BView* target = Target()) if (BView* target = Target())
Target()->ScrollTo(0, newValue); target->ScrollTo(0, newValue);
} }
}; };
+3 -3
View File
@@ -689,7 +689,7 @@ void
TermView::_InvalidateTextRange(TermPos start, TermPos end) TermView::_InvalidateTextRange(TermPos start, TermPos end)
{ {
if (end < start) if (end < start)
swap(start, end); std::swap(start, end);
if (start.y == end.y) { if (start.y == end.y) {
_InvalidateTextRect(start.x, start.y, end.x, end.y); _InvalidateTextRect(start.x, start.y, end.x, end.y);
@@ -871,7 +871,7 @@ TermView::_DrawCursor()
memcpy(buffer, character.bytes, bytes); memcpy(buffer, character.bytes, bytes);
buffer[bytes] = '\0'; buffer[bytes] = '\0';
_DrawLinePart(fCursor.x * fFontWidth, _LineOffset(fCursor.y), _DrawLinePart(fCursor.x * fFontWidth, (int32)_LineOffset(fCursor.y),
attr, buffer, width, selected, true, this); attr, buffer, width, selected, true, this);
} else { } else {
if (selected) if (selected)
@@ -1022,7 +1022,7 @@ TermView::Draw(BRect updateRect)
continue; continue;
} }
_DrawLinePart(fFontWidth * i, _LineOffset(j), _DrawLinePart(fFontWidth * i, (int32)_LineOffset(j),
attr, buf, count, insideSelection, false, this); attr, buf, count, insideSelection, false, this);
i += count; i += count;
if (i >= fTermColumns) if (i >= fTermColumns)
+1 -1
View File
@@ -487,7 +487,7 @@ TermWindow::MessageReceived(BMessage *message)
font.SetSize(size); font.SetSize(size);
view->SetTermFont(&font); view->SetTermFont(&font);
PrefHandler::Default()->setInt32(PREF_HALF_FONT_SIZE, size); PrefHandler::Default()->setInt32(PREF_HALF_FONT_SIZE, (int32)size);
_ResizeView(view); _ResizeView(view);
break; break;
+2 -4
View File
@@ -561,8 +561,7 @@ TerminalBuffer::Find(const char* _pattern, const TermPos& start, bool forward,
while (*_pattern != '\0') { while (*_pattern != '\0') {
int32 charLen = UTF8Char::ByteCount(*_pattern); int32 charLen = UTF8Char::ByteCount(*_pattern);
if (charLen > 0) { if (charLen > 0) {
pattern[patternLen].bytes = (char[]){ 0, 0, 0, 0 }; pattern[patternLen].SetTo(_pattern, charLen);
memcpy(pattern[patternLen].bytes, _pattern, charLen);
// if not case sensitive, convert to lower case // if not case sensitive, convert to lower case
if (!caseSensitive && charLen == 1) if (!caseSensitive && charLen == 1)
@@ -678,8 +677,7 @@ void
TerminalBuffer::Insert(uchar* string, ushort attr) TerminalBuffer::Insert(uchar* string, ushort attr)
{ {
// TODO: Remove! Use InsertChar instead! // TODO: Remove! Use InsertChar instead!
UTF8Char character; UTF8Char character((const char*)string, 4);
character.bytes = (char[]){ string[0], string[1], string[2], string[3] };
InsertChar(character, attr); InsertChar(character, attr);
} }
+18
View File
@@ -21,6 +21,24 @@ struct UTF8Char {
bytes[0] = c; bytes[0] = c;
} }
UTF8Char(const char* c, int32 count)
{
SetTo(c, count);
}
void SetTo(const char* c, int32 count)
{
bytes[0] = c[0];
if (count > 1) {
bytes[1] = c[1];
if (count > 2) {
bytes[2] = c[2];
if (count > 3)
bytes[3] = c[3];
}
}
}
static int32 ByteCount(char firstChar) static int32 ByteCount(char firstChar)
{ {
// Note, this does not recognize invalid chars // Note, this does not recognize invalid chars