Ticket #9290: 0001-Fix-more-GCC4-narrowing-conversion-warnings.patch

File 0001-Fix-more-GCC4-narrowing-conversion-warnings.patch, 5.0 KB (added by mt, 11 years ago)
  • headers/os/bluetooth/LinkKeyUtils.h

    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:  
    4848                            &l14, &l15);
    4949
    5050            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}};
    5355            }
    5456        }
    5557
  • headers/os/bluetooth/bdaddrUtils.h

    diff --git a/headers/os/bluetooth/bdaddrUtils.h b/headers/os/bluetooth/bdaddrUtils.h
    index cec9fb8..4085854 100644
    a b public:  
    6666                        &b5, &b4, &b3, &b2, &b1, &b0);
    6767
    6868            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}});
    7071        }
    7172
    7273        return NullAddress();
  • src/add-ons/print/drivers/pdf/source/PDFText.cpp

    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  
    320320PDFWriter::ToPDFUnicode(const char *string, BString &unicode)
    321321{
    322322    // 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
    324324    BString s;
    325325    ToUnicode(string, s);
    326326    unicode << marker;
  • src/add-ons/screen_savers/message/Message.cpp

    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)  
    176176    buffer.Lock();
    177177
    178178    // 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)};
    180181    offscreen.SetHighColor(base_color);
    181182    offscreen.SetLowColor(tint_color(base_color, 0.815F));
    182183    offscreen.FillRect(offscreen.Bounds(), kCheckered);
  • src/apps/icon-o-matic/generic/gui/panel/color_picker/ColorSlider.cpp

    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,  
    439439        R*=255.0; G*=255.0; B*=255.0;
    440440    }
    441441   
    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 };
    443444   
    444445    fMode = mode;
    445446    SetOtherValues(value1, value2);
    void  
    638639ColorSlider::_DrawColorLineY(BView *view, float y,
    639640                             int r, int g, int b)
    640641{
    641     rgb_color color = { r, g, b, 255 };
     642    rgb_color color = {(uint8)r, (uint8)g, (uint8)b, 255 };
    642643    y = 255.0 - y;
    643644    view->AddLine( BPoint(8.0, y + 5.0), BPoint(27.0, y + 5.0), color );
    644645}
    void  
    648649ColorSlider::_DrawColorLineX(BView *view, float x,
    649650                             int r, int g, int b)
    650651{
    651     rgb_color color = { r, g, b, 255 };
     652    rgb_color color = {(uint8)r, (uint8)g, (uint8)b, 255 };
    652653    BRect bounds(view->Bounds());
    653654    x = (255.0 - x) * (bounds.Width() - 2.0) / 255.0 + 2.0;
    654655    view->AddLine( BPoint(x, bounds.top + 2.0), BPoint(x, bounds.bottom - 2.0), color );
  • src/apps/mediaplayer/media_node_framework/NodeManager.cpp

    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,  
    393393    format.type = B_MEDIA_RAW_VIDEO;
    394394    media_raw_video_format videoFormat = {
    395395        FramesPerSecond(), 1, 0,
    396         fVideoBounds.IntegerWidth(),
     396        (uint32)fVideoBounds.IntegerWidth(),
    397397        B_VIDEO_TOP_LEFT_RIGHT, 1, 1,
    398398        {
    399399            preferredVideoFormat,
    400             fVideoBounds.IntegerWidth() + 1,
    401             fVideoBounds.IntegerHeight() + 1,
     400            (uint32)(fVideoBounds.IntegerWidth() + 1),
     401            (uint32)(fVideoBounds.IntegerHeight() + 1),
    402402            0, 0, 0
    403403        }
    404404    };