From bcf7d01b2e5b32196cba48c6518e3d96c9defa6a Mon Sep 17 00:00:00 2001
From: Murai Takashi <tmurai01@gmail.com>
Date: Tue, 30 Apr 2013 13:16:25 +0900
Subject: [PATCH] Fix more GCC4 narrowing conversion warnings
---
headers/os/bluetooth/LinkKeyUtils.h | 6 ++++--
headers/os/bluetooth/bdaddrUtils.h | 3 ++-
src/add-ons/print/drivers/pdf/source/PDFText.cpp | 2 +-
src/add-ons/screen_savers/message/Message.cpp | 3 ++-
.../generic/gui/panel/color_picker/ColorSlider.cpp | 7 ++++---
.../media_node_framework/NodeManager.cpp | 6 +++---
6 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/headers/os/bluetooth/LinkKeyUtils.h b/headers/os/bluetooth/LinkKeyUtils.h
index 5009735..650c1a8 100644
a
|
b
|
public:
|
48 | 48 | &l14, &l15); |
49 | 49 | |
50 | 50 | if (count == 16) { |
51 | | return (linkkey_t){{l0, l1, l2, l3, l4, l5, l6, l7, l8, |
52 | | l9, l10, l11, l12, l13, l14, l15}}; |
| 51 | return (linkkey_t){{(uint8)l0, (uint8)l1, (uint8)l2, (uint8)l3, |
| 52 | (uint8)l4, (uint8)l5, (uint8)l6, (uint8)l7, (uint8)l8, |
| 53 | (uint8)l9, (uint8)l10, (uint8)l11, (uint8)l12, (uint8)l13, |
| 54 | (uint8)l14, (uint8)l15}}; |
53 | 55 | } |
54 | 56 | } |
55 | 57 | |
diff --git a/headers/os/bluetooth/bdaddrUtils.h b/headers/os/bluetooth/bdaddrUtils.h
index cec9fb8..4085854 100644
a
|
b
|
public:
|
66 | 66 | &b5, &b4, &b3, &b2, &b1, &b0); |
67 | 67 | |
68 | 68 | if (count == 6) |
69 | | return ((bdaddr_t) {{b0, b1, b2, b3, b4, b5}}); |
| 69 | return ((bdaddr_t) {{(uint8)b0, (uint8)b1, (uint8)b2, |
| 70 | (uint8)b3, (uint8)b4, (uint8)b5}}); |
70 | 71 | } |
71 | 72 | |
72 | 73 | return NullAddress(); |
diff --git a/src/add-ons/print/drivers/pdf/source/PDFText.cpp b/src/add-ons/print/drivers/pdf/source/PDFText.cpp
index e3c82f0..1af2801 100644
a
|
b
|
void
|
320 | 320 | PDFWriter::ToPDFUnicode(const char *string, BString &unicode) |
321 | 321 | { |
322 | 322 | // PDFlib requires BOM at begin and two 0 at end of string |
323 | | char marker[3] = { 0xfe, 0xff, 0}; // byte order marker |
| 323 | char marker[3] = {'\xfe', '\xff', 0}; // byte order marker |
324 | 324 | BString s; |
325 | 325 | ToUnicode(string, s); |
326 | 326 | unicode << marker; |
diff --git a/src/add-ons/screen_savers/message/Message.cpp b/src/add-ons/screen_savers/message/Message.cpp
index f45643d..3cbf41c 100644
a
|
b
|
Message::Draw(BView *view, int32 frame)
|
176 | 176 | buffer.Lock(); |
177 | 177 | |
178 | 178 | // Set up the colors |
179 | | rgb_color base_color = {rand() % 25, rand() % 25, rand() % 25}; |
| 179 | rgb_color base_color = {(uint8)(rand() % 25), (uint8)(rand() % 25), |
| 180 | (uint8)(rand() % 25)}; |
180 | 181 | offscreen.SetHighColor(base_color); |
181 | 182 | offscreen.SetLowColor(tint_color(base_color, 0.815F)); |
182 | 183 | offscreen.FillRect(offscreen.Bounds(), kCheckered); |
diff --git a/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorSlider.cpp b/src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorSlider.cpp
index 83aa2f4..1a96139 100644
a
|
b
|
ColorSlider::SetModeAndValues(selected_color_mode mode,
|
439 | 439 | R*=255.0; G*=255.0; B*=255.0; |
440 | 440 | } |
441 | 441 | |
442 | | rgb_color color = { round(R), round(G), round(B), 255 }; |
| 442 | rgb_color color = {(uint8)round(R), (uint8)round(G), |
| 443 | (uint8)round(B), 255 }; |
443 | 444 | |
444 | 445 | fMode = mode; |
445 | 446 | SetOtherValues(value1, value2); |
… |
… |
void
|
638 | 639 | ColorSlider::_DrawColorLineY(BView *view, float y, |
639 | 640 | int r, int g, int b) |
640 | 641 | { |
641 | | rgb_color color = { r, g, b, 255 }; |
| 642 | rgb_color color = {(uint8)r, (uint8)g, (uint8)b, 255 }; |
642 | 643 | y = 255.0 - y; |
643 | 644 | view->AddLine( BPoint(8.0, y + 5.0), BPoint(27.0, y + 5.0), color ); |
644 | 645 | } |
… |
… |
void
|
648 | 649 | ColorSlider::_DrawColorLineX(BView *view, float x, |
649 | 650 | int r, int g, int b) |
650 | 651 | { |
651 | | rgb_color color = { r, g, b, 255 }; |
| 652 | rgb_color color = {(uint8)r, (uint8)g, (uint8)b, 255 }; |
652 | 653 | BRect bounds(view->Bounds()); |
653 | 654 | x = (255.0 - x) * (bounds.Width() - 2.0) / 255.0 + 2.0; |
654 | 655 | view->AddLine( BPoint(x, bounds.top + 2.0), BPoint(x, bounds.bottom - 2.0), color ); |
diff --git a/src/apps/mediaplayer/media_node_framework/NodeManager.cpp b/src/apps/mediaplayer/media_node_framework/NodeManager.cpp
index 0e976b6..a6ec141 100644
a
|
b
|
NodeManager::_SetUpVideoNodes(color_space preferredVideoFormat,
|
393 | 393 | format.type = B_MEDIA_RAW_VIDEO; |
394 | 394 | media_raw_video_format videoFormat = { |
395 | 395 | FramesPerSecond(), 1, 0, |
396 | | fVideoBounds.IntegerWidth(), |
| 396 | (uint32)fVideoBounds.IntegerWidth(), |
397 | 397 | B_VIDEO_TOP_LEFT_RIGHT, 1, 1, |
398 | 398 | { |
399 | 399 | preferredVideoFormat, |
400 | | fVideoBounds.IntegerWidth() + 1, |
401 | | fVideoBounds.IntegerHeight() + 1, |
| 400 | (uint32)(fVideoBounds.IntegerWidth() + 1), |
| 401 | (uint32)(fVideoBounds.IntegerHeight() + 1), |
402 | 402 | 0, 0, 0 |
403 | 403 | } |
404 | 404 | }; |